Skip to content

Commit

Permalink
riscv_step: Fix -i/--mtval-has-illegal-inst-bits option (#174)
Browse files Browse the repository at this point in the history
This option causes handle_illegal to pass instbits as the value to set
for xtval, but instbits is never set so it ends up being 0 just as if
the option was never enabled. Fix this by initialising instbits during
fetch; we could make this conditional on whether the option is enabled
but that seems unnecessary and introduces tighter coupling.

Note that this option appears to have always been broken; when it was
originally added, instbits was only written two in two cases which were
both dead code and later removed in eb17611.

Closes: #173
  • Loading branch information
jrtc27 authored Nov 1, 2022
1 parent 5cc5a93 commit 4d05aa1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions model/riscv_step.sail
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function step(step_no : int) -> bool = {
},
/* non-error cases: */
F_RVC(h) => {
instbits = EXTZ(h);
let ast = decodeCompressed(h);
if get_config_print_instr()
then {
Expand All @@ -113,6 +114,7 @@ function step(step_no : int) -> bool = {
}
},
F_Base(w) => {
instbits = EXTZ(w);
let ast = decode(w);
if get_config_print_instr()
then {
Expand Down

0 comments on commit 4d05aa1

Please sign in to comment.