-
Notifications
You must be signed in to change notification settings - Fork 674
Add Zcb and Zcmp extensions DV #2324
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
base: master
Are you sure you want to change the base?
Conversation
rswarbrick
left a comment
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.
Lots of nitty comments on the draft (sorry, but I'd started reading so thought I may as well review it properly...)
I really like this though! Thank you all so much for the improvement.
Thank you for the feedback. Sorry for the delay in implementing it. I just pushed an updated version that should address all your comments. |
b2a5cfd to
7e13fc3
Compare
df64cbe to
5fafcac
Compare
5fafcac to
0fd913c
Compare
|
Here are the regression results when running the full regression with the new compiler and the Zcb/Zcmp tests included. Note, those tests do not include the bitmanipulation tests, because the new compiler I used for testing doesn't support our curstom bitmanip versions.
|
0fd913c to
c5935b9
Compare
andreaskurth
left a comment
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.
RTL changes LGTM, thanks @SamuelRiedel!
Just a couple of smaller points, then I'm happy to merge the RTL changes ahead of the DV changes
c5935b9 to
e202708
Compare
|
Thank you @andreaskurth for your feedback. As discussed offline, we split the RTL part into a separate PR #2347 and I implemented your feedback. It also includes a fix for the formal CI by disabling the newly added Zc extensions in the formal flow for now. This PR is currently rebased on top of it and then adds all the DV environment. The new DV still passes with the following full regression results:
|
e202708 to
c814446
Compare
This refactors `instr_vif` to use `rvfi_id_done` instead of `instr_new_id` to track when a new instruction appears in the ID stage. This interface and signal are only used to keep track of instruction fetch errors by using the aforementioned valid signal and checking whether the `rvfi_order_id` has changed. However, if an instruction fetch error is consecutive to another error, `instr_new_id` will be gated, which leads us to miss the `fetch_err` in the verification. This will fix failing `riscv_mem_error_test`
Add a function and state to process multiple Ibex instructions that are modeled as a single instruction in riscv-isa-sim. The current function checks that the same registers are written overall.
Instead of stepping Spike once at the beginning of the expanded instruction and then comparing each next operation with Spike's changes, this commit logs all of Ibex's changes and then steps spike at the last expanded instruction, i.e., the committing instruction. This then allows checking a list of changes from Ibex with a list of changes from Spike. The reason to do it this way around is that the memory access checks are triggered by Spike. Therefore, when Spike steps through the expanded instruction, it simultaneously checks all memory accesses. Previously, only the first instructions on Ibex were executed at this stage and only those memory accesses were visible. Now, Ibex will also have completed the entire instruction and memory accesses, and the check initiated by Spike will succeed.
Clean up once our changes are upstreamed
Update code from upstream repository https://github.com/SamuelRiedel/riscv-dv to revision 71ceff7bb7d332fcf8037752ccdec19b33c2d210 Signed-off-by: Samuel Riedel <[email protected]>
Temporarily disable the Zcb/Zcmp tests while we wait to upgrade the compiler. This ensures the CI can run regressions with the current compiler to verify that we do not introduce breaking changes.
c814446 to
5f3e8a6
Compare
This PR adds support for the Zcb and Zcmp code-saving extensions. This support is implemented in a parameterizable way via the
RV32ZCparameter, which allows choosing none, either, or both extensions. By default, both extensions are enabled because their combined hardware overhead is small, approximately 800 gate equivalents.The Zcb extension introduces new compressed encodings for common instructions already supported in Ibex. The Zcmp extension introduces single compressed instructions that expand into multiple existing instructions within Ibex. For example, a stack push expands into multiple store instructions and a stack pointer update. Therefore, both extensions are implemented in the IF stage.
Adding these new instructions requires updates to the following components:
riscv-isa-sim(Spike): Updated Spike to support those new extensions Add the Zc* extensions riscv-isa-sim#27riscv-dv: Add both extensions to riscv-dv. We can either try to upstream those or create a fork.Missing Components and Known Issues:
The verification for the Zcmp's CMPP instructions (cm.push, cm.pop(ret(z))) is not fully working yet. The primary issue lies in the cosimulation interface with Spike. Checking multiple memory accesses that occur within a single step causes riscv-isa-sim to throw an error.Fixed.This PR depends on Fix theMergedriscv_dret_test#2338 to fix a DV error that is triggered with the new tests, but unrelated to the new changes.id_doneto accurately track instruction monitor #2346 to fix a DV error that is triggered in the CI here, but unrelated to the new changes.