Skip to content

Commit 5349f23

Browse files
authored
Merge pull request #48 from 2011eric/master
Enforce zero register in floating point operation
2 parents e1dfd9c + 565c6b8 commit 5349f23

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

emulate.c

+4
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,10 @@ static inline bool op_fp(struct riscv_t *rv, uint32_t insn)
11431143
return false;
11441144
}
11451145

1146+
/* enforce zero register */
1147+
if (rd == rv_reg_zero)
1148+
rv->X[rv_reg_zero] = 0;
1149+
11461150
/* step over instruction */
11471151
rv->PC += 4;
11481152
return true;

0 commit comments

Comments
 (0)