Skip to content

Commit

Permalink
Merge pull request sysprog21#48 from 2011eric/master
Browse files Browse the repository at this point in the history
Enforce zero register in floating point operation
  • Loading branch information
jserv authored Sep 5, 2022
2 parents 6e6d4a6 + 421785f commit cd0dc79
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,10 @@ static inline bool op_fp(struct riscv_t *rv, uint32_t insn)
return false;
}

/* enforce zero register */
if (rd == rv_reg_zero)
rv->X[rv_reg_zero] = 0;

/* step over instruction */
rv->PC += 4;
return true;
Expand Down

0 comments on commit cd0dc79

Please sign in to comment.