chipsalliance / Cores-VeeR-EH1

VeeR EH1 core
Apache License 2.0
808 stars 219 forks source link

RISCV-Compliance check - Some Fails #33

Closed cr8601 closed 4 years ago

cr8601 commented 4 years ago

Hi, I successfully run the RISC-V Compliance check (https://github.com/riscv/riscv-compliance) on the provided SweRV RTL and I was able to pass most of the tests except the following:

  1. ree_rv32i.I-MISALIGN_JMP-01
  2. ree_rv32i.I-MISALIGN_LDST-01
  3. ree_rv32mi.breakpoint
  4. ree_rv32Zifencei.I-FENCE.I-01
  5. ree_rv32ui.fence_i

Unfortunately I couldn't find any information about RISC-V-Compliance check regarding SweRV.

Has anyone ever run RISC-V compliance on SweRV and can comment on the above issues?

Thanks and best regards cr

aprnath commented 4 years ago

Misalign tests will fail because SweRV supports unaligned accesses to normal memory. IO (non-idempotent) ld/st will take misalignment exceptions, but you will need to mark the region as such using the MRAC CSR. SweRV also supports compressed (16 bit) instructions, and there is no way to turn off 16 bit support - so you cannot get alignment exceptions on branch/jump instructions either.

Regarding the fence instructions - it depends on your test setup and if it supports a unified instruction.data memory. The (currently*) provide simple TB does not support self-modifying code since the stores are not reflected in the instruction memory. To really test the fence.i instruction, you need your system to have share memory between the fetch and data buses.

aprnath commented 4 years ago

Regarding the breakpoint test, note that SweRV disables breakpoints when mstatus.mie is cleared.

cr8601 commented 4 years ago

Hi aprnath, thank you very much for this information. This helps a lot in further debugging and understanding!

cr8601 commented 4 years ago

Hi aprnath,

After digging some more in the latest ISA spec, 3.1.6 Machine Status Registers, I am wondering whether mstatus.MIE should be '1' by default, but I didn't find anything about the default values for mstatus... Can you comment on that?

Best regards cr

cr8601 commented 4 years ago

Hi aprnath, I think it's cleared in chapter 3.3:

Upon reset, a hart’s privilege mode is set to M. The mstatus fields MIE and MPRV are reset to 0.

Correct? Then I am wondering about the compliance check and why it works for others... I probably need to open an issue at their repo. Do you agree, or do you you have any other idea?

Best regards cr

tmw-wdc commented 4 years ago

Hi,

I think the answer to your question above is covered in Section 5.1, ‘Native M-Mode Triggers’ of the RISC-V External Debug Support specification, Version 0.13.2. There are two implementation options to deal with breakpoints in M-mode only cores. SweRV disables breakpoints when MSTATUS.MIE is cleared. Presumably, the breakpoint test might pass on cores which implement the other option.

Thanks, Thomas

cr8601 commented 4 years ago

Hi, thanks for your support and quick feedback. I'll request to add the register settings within the compliance test. Thanks cr

tmw-wdc commented 4 years ago

Thank you for reporting these test cases! They will be documented in the next PRM release.

Thanks, Thomas