NeoRV32 formal verification results #1374
Replies: 3 comments 1 reply
-
|
Wow, that's really impressive! Thanks for sharing this!
v1.9.3, right? Are you planning to update to a newer version?
That's still on my TODO list... At least we already have a simple trace port, but it doesn't provide nearly all the information required by RVFI. Anyway, I would of course like to have full support for RVFI + frameworkat some point... Maybe we should set up a few "help wanted" issues...
Do you have any further details? I think your findings could be very valuable for the further improvement of GHDL.
That looks great! Did you integrate the RVFI directly into the core, or are you using VHDL's external names at the top level?
I'm definitely no expert when it comes to formal verification, but as far as I can tell, it looks pretty good! Thank you for publishing these results. I think this gives the project another little boost in quality. 😉
That's the bug you've reported in #1373, right? |
Beta Was this translation helpful? Give feedback.
-
|
As you know formal verification of the neorv32 has been on both our lists for quite a while. This summer I had the opportunity to get a skilled intern to look at the task. So why not share the good results with you all :) Its on my list to upgrade to a newer version. I've held of mostly because the older version we have is currently in silicon so any upgrade of the core for that project has big impact on the overall verification effort. It was a bit easier for us to get to RVFI as we already had an RVVI interface setup. Beyond the interface there are a number of additional models that are required around the core. When I get to upgrading the core I can see what can be done to push up an example for formal verification. For GHDL I believe we issued a bug report.. I think. In our case GHDL consistently removes 1 signal driver inside the core. The signal removed was always the same signal which is why we could script our way out of it. For RVFI, as it has to be synthesizable we can't use anything by reference like we do for RVVI. A lot of the VHDL external name stuff/by reference etc are for test only per the standard.. I think.. I might be wrong?. This means we have to route signal up to the top from various sub-modules into the RVFI test framework. The yosys results includes our fix to #1373 of where you already caught the main one which is that illegal access are allowed to execute. The fix in the latest version of the core is identical to our fix to the problem :) One caveat here is that we are waiving the FSR write on illegal access from e.g. an FADD getting kicked off. I think this is a side effect of having the FSR inside the FPU without the ability to flag to the FPU that write backs should be blocked. The CEX is #1373 and bugs in our porting of riscv-formal to SVA properties syntax for JasperGold. |
Beta Was this translation helpful? Give feedback.
-
Oh cool, now I'm curious. 😅 I guess you can't give any more details, right?
That's a good point. I would like to extend the trace interface to support at least the minimum features of RVFI. Do you use the CSR signals? Could you perhaps give an overview of which signals from the spec you have used?
That's great! 👍
Ah, I see. I'm not sure if synthesizers support VHDL external names at all, but they should be synthesizable.
That's why I would like to extend the trace port. Since it is already used by the processor's trace buffer, this would also ensure that the RVFI is synthesizable.
For this, I always use a VHDL top wrapper that only has individual wires or vectors, but no structs/records.
That should now be fixed with #1376 too. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Over the summer Skyworks has run an older version of the NeoRV32 core though RISCV-Formal. Beyond 1 bug (illegal instruction access fault), the core came back clean. See screen caps below.
Getting NeoRV32 through formal verification is quite cumbersome, hence why I haven't pushed the core changes needed for formal verification. Suffice to say the requirements are that the RVFI interface must be added to the core and the whole thing is required to be synthesizable. Meaning RVFI is sticky in the core.

Further formal verification using symbiyosys requires verilog as an input code base. Using GHDL to convert NeoRV32 to verilog, while feasible, is error prone as there are bugs in the GHDL->Verilog conversion. These require post processing of the resulting verilog code base to make it "sane".
To highlight the amount of wrapping required:
With that said here are the good results:

Restricted bounded model checks (we only check the NeoRV32 internal state is valid at the end of the formal check)
Full bounded model checks (the NeoRV32 internal state is check on all "clocks")

Note: the failing test case here is a bug in yosys that has been reported.
Note: the floating point instruction tests are Skyworks specific and not part of the official RISCV-formal suite.
For completeness we also run NeoRV32 through a commercial tool, in this case JasperGold. The results where:

The interpretation here is:
As we are still on quite an old version of the core the applicability on the current RTL I will leave up to the reader.
Beta Was this translation helpful? Give feedback.
All reactions