-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Formal cleanup #2245
base: master
Are you sure you want to change the base?
Formal cleanup #2245
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
98d948d
to
d1ddec1
Compare
@@ -5,6 +5,15 @@ Prerequisities (in your PATH): | |||
- [psgen](https://github.com/mndstrmr/psgen) | |||
|
|||
Build instructions: | |||
- Clone this repository | |||
- `cd dv/formal` | |||
- `nix develop .#formal` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I don't think I know where this flake gets defined. (Maybe just pull this line to the following commit?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flake is at the root of the repo. Nix automatically searches up parent directories within the same repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that wasn't very clear of me. I think the "formal" flake is only defined in the next commit. To avoid a commit with inconsistent documentation, maybe it's worth moving this line to the next commit.
7cd534d
to
82bc8ad
Compare
Here's a high-level overview of what this commit does: - Compiles Sail into SystemVerilog including patchin compiler bugs - Create a TCL file that tells JasperGold what to prove and assume - Check memory operations modelling the LSU Most of these properties now prove without time-bound on the response from memory due to alternative LSUs - Check memory even with Smepmp errors: Continues on top of riscv/sail-riscv#196 - CSR verification - Checks for instruction types such as B-Type, I-Type, R-Type - Check illegal instructions and WFI instructions - Using psgen language for proof generation - Documentation on how to use the setup - Wrap around proof that proves instructions executed in a row still match the specification. - Liveness proof to guarantee instructions will retire within a upper bound of cycles. All of these proofs make heavy use of the concept of k-induction. All the different properties and steps are necessary to help the tool get the useful properties it needs to prove the next step. The instruction correctness, wrap-around and liveness all give us increased confidence that Ibex is trace-equivalent to Sail. Throughout this process an issue was found in Ibex where the pipeline was not flushing properly on changing PMP registers using clear: lowRISC#2193 Alternative LSUs: This makes all top level memory properties prove quickly and at a low proof effort (1 or 2-induction). Three 'alternative LSUs' representing three stages of memory instructions: 1. Before the first response is received, in the EX stage 2. After the first response is received, but not the second grant, also in the EX stage 3. Before the last response is received in the WB stage. In each case we ask 'if the response came now, would the result be correct?'. Similar is applied for CSRs/PC though less directly. This is particularly interesting (read: ugly) in the case of a PMP error wbexc_exists makes Wrap properties fast to prove. The bottleneck becomes SpecPastNoWbexcPC, which fails only due to a bug. See the comment in riscv.proof. Co-authored-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
This lets fusesoc do the heavy lifting in identify the correct files for us. Fusesoc is already extensively used for this purpose for synthesis and simulation. This also allows us to automatically patch the fusesoc-provided src files to work around some current restrictions in the formal flow, without modifying the main repository tree. Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
This includes Flake setup prove_no_liveness isn't great by any means, but it will prove everything orders of magnitude faster than prove -bg -all. The dev shell (nix develop .#formal-dev) is identical to the normal shell, but prints some information on how to swap out components. This is also documented in the README. Jasper Gold options: - allow_unsupported_OS is required on both the machines I use. - acquire_proj means that if JG is killed (which happens somewhat often) the next it runs it will still be able to take ownership of the project. Co-authored-by: Louis-Emile Ploix <louis-emile.ploix@lowrisc.org> Co-authored-by: Marno van der Maas <mvdmaas+git@lowrisc.org> Signed-off-by: Harry Callahan <hcallahan@lowrisc.org>
This includes renaming Jasper Gold to just Jasper
Mostly line lengths and indexes. This commits also adds a Verible waiver file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Thank you for shepherding it to make this mergeable.
82bc8ad
to
9a5fdd5
Compare
I'm converting this back to draft because Ibex_FetchErrRoot is producing a counter-example. |
9a5fdd5
to
d50fe25
Compare
This adds an initial formal flow to the Ibex repository. It proves equivalence of the Ibex RTL and the Sail specification. For details and limitations please see the documentation.
A big thank you to @mndstrmr and @hcallahan-lowrisc for putting this work together.