Skip to content

sim_riscv_zmmul

Tsukasa OI edited this page Sep 21, 2022 · 9 revisions

sim/riscv: Fix RISC-V multiply instructions on simulator

Based On

Issue Solved

After adding the Zmmul extension, the simulator is broken.

The cause is simple. The RISC-V simulator supports I, M and A extensions and the instruction is identified by those instruction classes:

  • INSN_CLASS_I (for I)
  • INSN_CLASS_M (for M)
  • INSN_CLASS_A (for A)

After adding the Zmmul extension, INSN_CLASS_M is splitted to:

  • INSN_CLASS_ZMMUL (multiply instructions)
  • INSN_CLASS_M (division instructions)

So, the simulator must handle INSN_CLASS_ZMMUL separately.

My patchset fixed that and I added a testcase (checks whether all RV32M instructions run without any fault) but only opcodes part is applied so it's now broken state for the simulator.

Clone this wiki locally