aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--encoding.h4
-rwxr-xr-xparse.py4
2 files changed, 5 insertions, 3 deletions
diff --git a/encoding.h b/encoding.h
index 6de74b3..a85f5a3 100644
--- a/encoding.h
+++ b/encoding.h
@@ -240,14 +240,14 @@
#define HSTATEEN0_CS 0x00000001
#define HSTATEEN0_FCSR 0x00000002
#define HSTATEEN0_JVT 0x00000004
-#define MSTATEEN0_CTR 0x0040000000000000
+#define HSTATEEN0_CTR 0x0040000000000000
#define HSTATEEN0_SCONTEXT 0x0200000000000000
#define HSTATEEN0_AIA 0x0800000000000000
#define HSTATEEN0_CSRIND 0x1000000000000000
#define HSTATEEN0_SENVCFG 0x4000000000000000
#define HSTATEEN_SSTATEEN 0x8000000000000000
-#define MSTATEEN0H_CTR 0x00400000
+#define HSTATEEN0H_CTR 0x00400000
#define HSTATEEN0H_SCONTEXT 0x02000000
#define HSTATEEN0H_AIA 0x08000000
#define HSTATEEN0H_CSRIND 0x10000000
diff --git a/parse.py b/parse.py
index 8a50caf..4553e06 100755
--- a/parse.py
+++ b/parse.py
@@ -941,6 +941,7 @@ import "cmd/internal/obj"
type inst struct {
opcode uint32
funct3 uint32
+ rs1 uint32
rs2 uint32
csr int64
funct7 uint32
@@ -960,11 +961,12 @@ func encode(a obj.As) *inst {
enc_match = int(instr_dict[i]['match'],0)
opcode = (enc_match >> 0) & ((1<<7)-1)
funct3 = (enc_match >> 12) & ((1<<3)-1)
+ rs1 = (enc_match >> 15) & ((1<<5)-1)
rs2 = (enc_match >> 20) & ((1<<5)-1)
csr = (enc_match >> 20) & ((1<<12)-1)
funct7 = (enc_match >> 25) & ((1<<7)-1)
instr_str += f''' case A{i.upper().replace("_","")}:
- return &inst{{ {hex(opcode)}, {hex(funct3)}, {hex(rs2)}, {signed(csr,12)}, {hex(funct7)} }}
+ return &inst{{ {hex(opcode)}, {hex(funct3)}, {hex(rs1)}, {hex(rs2)}, {signed(csr,12)}, {hex(funct7)} }}
'''
with open('inst.go','w') as file: