Skip to content

Commit d3fd742

Browse files
committed
Fix miss value fencei instrucition in branch list
In the previous implementation, fencei was treated as a branch instruction, but it was assigned a missing value in the new branch list. As a result, emulator fails to pass Zifencei test. Close: #98
1 parent a34aedb commit d3fd742

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/decode.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
_(mret, 1) \
6363
/* RV32 Zifencei Standard Extension */ \
6464
IIF(RV32_HAS(Zifencei))( \
65-
_(fencei, 0) \
65+
_(fencei, 1) \
6666
) \
6767
/* RV32 Zicsr Standard Extension */ \
6868
IIF(RV32_HAS(Zicsr))( \

src/emulate.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,10 @@ RVOP(hret, {
616616
RVOP(mret, { rv->PC = rv->csr_mepc; })
617617

618618
#if RV32_HAS(Zifencei) /* RV32 Zifencei Standard Extension */
619-
RVOP(fencei,
620-
{
621-
/* FIXME: fill real implementations */
622-
})
619+
RVOP(fencei, {
620+
rv->PC += ir->insn_len;
621+
/* FIXME: fill real implementations */
622+
})
623623
#endif
624624

625625
#if RV32_HAS(Zicsr) /* RV32 Zicsr Standard Extension */

0 commit comments

Comments
 (0)