Replies: 4 comments 3 replies
-
Hey @mikaelsky!
Absolutely! Thank you very much for sharing! Could you give some additional information about your implementation of the RVVI interface? Or is there a repository where I could have a look at the sources? |
Beta Was this translation helpful? Give feedback.
-
Fundamentally the RVVI trace system is tapping into various internal signals from the cpu_control, regfile, pmp and FPU blocks and performing a "re-alignment" operation to get all the various state changes that happen during a given instructions multi-cycle execution to a common clock cycle where we can assert the valid indicator (for neorv32 this is pc_we) towards the RVVI trace target. I'm currently working on getting the latest version of the core (1.9.3) working with the RVVI testing system. Patience is advised :) |
Beta Was this translation helpful? Give feedback.
-
@stnolting This should be the branch where I've ported the RVVI trace system into a module using aliasing. I've had to create packages for the modules that we grab trace information from as the struct types need to be the same and we can't just re-declare them. In general one could argue that it is beneficial to have per module packages as it allows the use of structs across boundaries, e.g. between the controller and the FPU I add the generic and defaulted it to false, so if nothing else is done the RVVI trace module isn't instantiated. Because aliasing isn't supported by a lot of synthesis tools there is an rvvi package file that only contains a component declaration of the rvvi trace entity. This allows the code to be built with the RVVI disabled without having to read in the neorv32_cpu_rvvi.vhd file as that will cause synth tools to.. have a bad time. I've tested the setup internally with our trace compare an everything still works fine, so yeah :) I've also synthesized the code base with genus and as long as the neorv32_cpu_rvvi.vhd file isn't read in the core synthesizes with no issues. Its also been tested with RTL based MBIST insertion and that also passed as long as the neorv32_cpu_rvvi.vhd isn't read in. I haven't tested it with the github setup and GHDL as my internal "branch" is somewhat feature wise out of data with the current main. Note: I haven't tested PMP CSRs with RVVI, so for now its only wired up and might work. |
Beta Was this translation helpful? Give feedback.
-
It looks complex :) mostly its finding the right probe points and then doing a ton of realignment. It is Very core implementation specific though. I have no opinions on individual repo or not. From our side we use RVVI extensively to validate core function vs a simulator. Ideally if I had all the time in the world, then one could imagine adding that feature using a combo of cocotb, ghdl and spike. This would be especially useful when extending the core with new functions and/or refactoring code. I took a brief glance at the RVFI. Beyond a few small difference its fairly compliant. The "big" difference is the CSR reporting where RVVI generates this giant one-hot vector where RVFI generates a N * {r/w mask + r/w data) for each CSR in the core.. so a Lot of signals. The masks do seem to be static per CSR though. RVVI doesn't provide a memory model either, but that is more simple to add. What isn't super clear with the RVFI is the timing around the signals. Thats the big challenge with RVVI - realignment of internal state. The core is a multi-cycle core but the formal model/simulator are all single cycle assumptions. So any information that changes during the multi-cycle execution has be to captured and held until the valid indicator is asserted... with some exceptions like trap. Let me think about the RVFI and maybe extend the RVVI with some RVFI features and/or add a neorv32_cpu_rvfi module in the same vein as the RVVI module. |
Beta Was this translation helpful? Give feedback.
-
As part of the core verification we are performing I've added an RVVI trace port to connect the NEORV32 core to an external ISA model that is used to validate that the NEORV32 performs correctly and adheres the RISCV specification.
This method allows us to do things like throw random instruction sequences at the core and determine correct execution etc.
I already have an internal branch of the core with the RVVI trace port added. This includes a enable/disable parameter as the RVVI logic does incur some area overhead. When RVVI trace is disabled the port turns undefined and all logic and signal assignments get removed.
There are already some tools that function with RVVI trace ports like OVPSim.
If there is interest in this debug feature I can push into the main line with some additional documentation for the NEORV32 on the RVVI interface and what all the signals do and how they are to be used. This as it the RVVI documentation is somewhat lacking.
RVVI home: https://github.com/riscv-verification/RVVI
Beta Was this translation helpful? Give feedback.
All reactions