Skip to content

Commit 9a9ad89

Browse files
committed
Fix compiler error with when Zicsr is disabled
When using 'make ENABLE_Zicsr=0', the following error is observed: src/emulate.c:561:10: error: ‘rv_insn_csrrw’ undeclared (first use in this function); did you mean ‘rv_insn_csrai’? 561 | case rv_insn_csrrw: | ^~~~~~~~~~~~~ | rv_insn_csrai The error occurs because CSR instruction enums are only defined when the Zicsr extension is enabled. By adding the feature guard, we ensure the switch cases are only compiled when the required instruction definitions are available.
1 parent 4d95244 commit 9a9ad89

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/emulate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,9 @@ FORCE_INLINE bool insn_is_unconditional_branch(uint8_t opcode)
558558
case rv_insn_jal:
559559
case rv_insn_jalr:
560560
case rv_insn_mret:
561+
#if RV32_HAS(Zicsr)
561562
case rv_insn_csrrw:
563+
#endif
562564
#if RV32_HAS(SYSTEM)
563565
case rv_insn_sret:
564566
#endif

0 commit comments

Comments
 (0)