Fix mvsa01/mva01s in rvcpp

This commit is contained in:
Luke Wren 2023-03-21 21:54:04 +00:00
parent 410d002372
commit 8f461b63b4
2 changed files with 4 additions and 4 deletions

View File

@ -8,4 +8,4 @@ all:
g++ -std=c++17 -O3 -Wall -Wno-parentheses $(SRCS) -o $(EXECUTABLE)
clean:
rm -f (EXECUTABLE)
rm -f $(EXECUTABLE)

View File

@ -134,7 +134,7 @@ static inline uint32_t zcmp_reg_mask(uint32_t instr) {
}
static inline uint zcmp_s_mapping(uint s_raw) {
return s_raw + 8 + 8 * ((s_raw & 0x6) == 0);
return s_raw + 8 + 8 * ((s_raw & 0x6) != 0);
}
struct RVCSR {
@ -568,10 +568,10 @@ struct RVCore {
regnum_rd = 2;
rd_wdata = regs[2] + zcmp_stack_adj(instr);
} else if (RVOPC_MATCH(instr, CM_MVSA01)) {
regs[zcmp_s_mapping(GETBITS(instr, 9, 8))] = regs[10];
regs[zcmp_s_mapping(GETBITS(instr, 9, 7))] = regs[10];
regs[zcmp_s_mapping(GETBITS(instr, 4, 2))] = regs[11];
} else if (RVOPC_MATCH(instr, CM_MVA01S)) {
regs[10] = regs[zcmp_s_mapping(GETBITS(instr, 9, 8))];
regs[10] = regs[zcmp_s_mapping(GETBITS(instr, 9, 7))];
regs[11] = regs[zcmp_s_mapping(GETBITS(instr, 4, 2))];
} else {
instr_invalid = true;