rvcpp simulator: fix bad regnum decode for c.slli outside of x8..x15

This commit is contained in:
Luke Wren 2023-04-01 06:02:45 +01:00
parent 54f0a593c8
commit 26d699e18c
2 changed files with 3 additions and 3 deletions

View File

@ -508,7 +508,7 @@ struct RVCore {
}
// RVC Quadrant 10:
} else if (RVOPC_MATCH(instr, C_SLLI)) {
regnum_rd = c_rs1_s(instr);
regnum_rd = c_rs1_l(instr);
rd_wdata = regs[regnum_rd] << GETBITS(instr, 6, 2);
} else if (RVOPC_MATCH(instr, C_MV)) {
if (c_rs2_l(instr) == 0) {
@ -587,7 +587,7 @@ struct RVCore {
} else {
printf(" %04x : ", instr & 0xffffu);
}
if (regnum_rd != 0) {
if (regnum_rd != 0 && rd_wdata) {
printf("%-3s <- %08x ", friendly_reg_names[regnum_rd], *rd_wdata);
} else {
printf(" ");

View File

@ -334,7 +334,7 @@
#define RVOPC_CM_MVA01S_BITS 0b1010110001100010
#define RVOPC_CM_MVA01S_MASK 0b1111110001100011
#define _RVOPC_MATCH(x, instr_mask, instr_bits) ((x & instr_mask) == instr_bits)
#define _RVOPC_MATCH(x, instr_mask, instr_bits) (((x) & (instr_mask)) == (instr_bits))
#define RVOPC_MATCH(x, instr) _RVOPC_MATCH(x, RVOPC_ ## instr ## _MASK, RVOPC_ ## instr ## _BITS)
static const char *friendly_reg_names[32] = {