aboutsummaryrefslogtreecommitdiff
path: root/src/arch/riscv64/Encoding.zig
diff options
context:
space:
mode:
authorDavid Rubin <daviru007@icloud.com>2024-04-13 23:11:32 -0700
committerDavid Rubin <daviru007@icloud.com>2024-05-11 02:17:24 -0700
commitd9e0cafe64dd7dc56fc2d46bc29c18630a108356 (patch)
treeff0850456daae960d0530068d4d8e76ef94b4e63 /src/arch/riscv64/Encoding.zig
parente622485df8d162fd2696b6ab1149262aa6b74407 (diff)
downloadzig-d9e0cafe64dd7dc56fc2d46bc29c18630a108356.tar.gz
zig-d9e0cafe64dd7dc56fc2d46bc29c18630a108356.zip
riscv: add stage2_riscv to test matrix and bypass failing tests
Diffstat (limited to 'src/arch/riscv64/Encoding.zig')
-rw-r--r--src/arch/riscv64/Encoding.zig13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/arch/riscv64/Encoding.zig b/src/arch/riscv64/Encoding.zig
index d145e21603..c23ba10d9b 100644
--- a/src/arch/riscv64/Encoding.zig
+++ b/src/arch/riscv64/Encoding.zig
@@ -14,6 +14,8 @@ pub const Mnemonic = enum {
sltu,
xori,
andi,
+ slli,
+ srli,
addi,
jalr,
@@ -35,6 +37,7 @@ pub const Mnemonic = enum {
// R Type
add,
+ sub,
slt,
mul,
xor,
@@ -48,6 +51,7 @@ pub const Mnemonic = enum {
return switch (mnem) {
// zig fmt: off
.add => .{ .opcode = 0b0110011, .funct3 = 0b000, .funct7 = 0b0000000 },
+ .sub => .{ .opcode = 0b0110011, .funct3 = 0b000, .funct7 = 0b0100000 },
.ld => .{ .opcode = 0b0000011, .funct3 = 0b011, .funct7 = null },
.lw => .{ .opcode = 0b0000011, .funct3 = 0b010, .funct7 = null },
@@ -63,6 +67,8 @@ pub const Mnemonic = enum {
.andi => .{ .opcode = 0b0010011, .funct3 = 0b111, .funct7 = null },
.xori => .{ .opcode = 0b0010011, .funct3 = 0b100, .funct7 = null },
.jalr => .{ .opcode = 0b1100111, .funct3 = 0b000, .funct7 = null },
+ .slli => .{ .opcode = 0b0010011, .funct3 = 0b001, .funct7 = null },
+ .srli => .{ .opcode = 0b0010011, .funct3 = 0b101, .funct7 = null },
.lui => .{ .opcode = 0b0110111, .funct3 = null, .funct7 = null },
@@ -103,9 +109,6 @@ pub const InstEnc = enum {
pub fn fromMnemonic(mnem: Mnemonic) InstEnc {
return switch (mnem) {
- .add,
- => .R,
-
.addi,
.ld,
.lw,
@@ -118,6 +121,8 @@ pub const InstEnc = enum {
.sltiu,
.xori,
.andi,
+ .slli,
+ .srli,
=> .I,
.lui,
@@ -139,6 +144,8 @@ pub const InstEnc = enum {
.sltu,
.mul,
.xor,
+ .add,
+ .sub,
=> .R,
.ecall,