Skip to content

fix build issue when close ENABLE_COMPUTED_GOTO #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,28 +1414,32 @@ void rv_step(struct riscv_t *rv, int32_t cycles)

// standard uncompressed instruction
if ((inst & 3) == 3) {
index = (inst & INST_6_2) >> 2;
uint32_t index = (inst & INST_6_2) >> 2;

// dispatch this opcode
TABLE_TYPE op = jump_table[index];
assert(op);
if (!op(rv, inst))
break;
rv->inst_len = INST_32;

} else {
// standard compressed instruction
inst &= 0x0000FFFF;
const uint16_t c_index =
(inst & FR_C_15_13 >> 11) | (inst & FR_C_1_0);
(inst & FC_FUNC3 >> 11) | (inst & FC_OPCODE);

// dispactch c_opcode (compressed instructions)
TABLE_TYPE_RVC op = jump_tablec[c_index];
TABLE_TYPE_RVC op = jump_table_rvc[c_index];
assert(op);
if (!op(rv, inst))
break;
rv->inst_len = INST_16;
}

if (!op(rv, inst))
break;

// increment the cycles csr
rv->csr_cycle++;
}
#endif // ENABLE_COMPUTED_GOTO
}

Expand Down