-
Notifications
You must be signed in to change notification settings - Fork 428
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
Use cv32e40p_wrapper to bind in RTL assertions. #421
Use cv32e40p_wrapper to bind in RTL assertions. #421
Conversation
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
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.
Hi Mike,
Thanks for showing an example. I agree with the general approach, but I have some comments on specifics. For us (meaning people working in the cv32e40p repos) it is a must that the design assertions can be used as before in a non-UVM environment as well. I agree that we want to use error reporting from uvm_pkg::*, but maybe this needs to be go through some indirection (I will check with Steve what he recommends for this). Also I think we need two manners to disable assertions (one via a global ifdef, one per file). The global mechanism you removed; I am fine with the ifdef per assertion file, but then it needs to go arround the 'bind'. for the local mechanism I will again ask Steve to propose something.
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.
Also probably we want the assertions in a separate (new) directory.
Thanks for the quick review @Silabs-ArjanB. To your points:
You can still use the UVM messaging service (e.g.
I would recommend we reinstate the global control via a compile-time macro. Individual file control is messy and best left to the simulator to deal with, so I would recommend we only support global control in the code. I'll add that back in to this PR.
That is my instinct as well. I will update this PR to reinstate the global control of the macros and also put the assertions in their own directory. |
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
Done. |
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.
Please put the ifdefs as high level as possible, e.g. around the bind, not in the assertion files
That was the first thing I tried. Alas, Verilator needs both. Another way to do this would be with manifest file control. Its my understanding you are investigating something like this so maybe we can kill two birds with that one stone. |
I am not investigating anything related to this. Maybe you are talking about the FuseSoc support; yes, that might solve it, but I am not working on it. |
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
I see. This creates a challenge for Verilator because it cannot compile Assertions (or the Tracer) and the way the manifest is currently set up, the tool must compile them all, even if they are not to be included. I've pushed in a alternative method which will work, but it means I needed to edit the manifest and include the Tracer, Assertions, etc from the wrapper itself. This puts all the compiler macros in one file (the Wrapper), but the need to be in two places. |
cv32e40p_manifest.flist
Outdated
//${DESIGN_RTL_DIR}/../bhv/cv32e40p_tracer.sv |
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.
Why are these 3 files commented out; you will need them in core-v-verif
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 was done while trying to "put the binds as high as possible" so that there would only be one set of compiler macros to control compilation and binding of the tracer and assertions. Verilator cannot handle the tracer, assertions, etc, so if these modules cannot have conditional compile macros, then they cannot be in the manifest.
The proposed solution is to place conditionally compiled tick-includes in the wrapper.
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.
My point is that you still need these files to be loaded/compiled in core-v-verif, so if you do not put them in the manifest your code in core-v-verif won't compile.
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.
That is correct for the UVM environment. The Makefles know this and set the appropriate macros that compile in the tracer. Take a look at the top of cv32e40p_wrapper.sv to see what I mean. Verilator cannot parse the tracer, so the Makefiles for the core testbench do not use these macros.
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.
I don't get it, but that's fine. I think you will simply be missing files in core-v-verif if you try to compile for UVM. (Anyway, you can leave them commented out).
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.
The inclusions are at the top of cv32e40p_wrapper.sv
not in the manifest:
`ifdef CV32E40P_SVASSERTIONS
`include "cv32e40p_prefetch_controller_sva.sv"
`endif
`include "cv32e40p_core_log.sv"
`ifdef CV32E40P_APU_TRACE
`include "cv32e40p_apu_tracer.sv"
`endif
`ifdef CV32E40P_TRACE_EXECUTION
`include "cv32e40p_tracer.sv"
`endif
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.
Okay, now I get it. That is quite 'non-conventional'
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.
I don't like it much myself. Once we get a proper manifest generator tool in place we can get rid of this. The single benefit is that the compiler macros (the tick-ifdefs) are all in one file.
Hi @MikeOpenHWGroup The Cadnce JasperGold formal tool will neither accept the uvm package import nor the use of `uvm_error, so the proposed syntax will simply not work for us. The main goal of these design assertions is usage during Formal verification. If you propose some ifdef based approach, then that will probably be acceptable (but ugly). |
Interesting. In one of my past lives we did get JG to compile the uvm package and its associated macros. Basically, the tool just ignored them. Let me reach out to some ex-colleagues to see how we did this.
What I would probably propose would be the use of a macro that would use uvm_error for simulation and exclude it for synthesis and formal. Before we go there, let's see what I can dig up. |
Hi @Silabs-ArjanB, I finally have a reply to a question you raised earlier:
An ex-colleague of mine, who is a full-time formal verification engineer and very experienced in JG, tells me that the action block of SVA asserts is ignored by formal tools, so we can put whatever we need in there for simulation. In our case, that is everything in the
We may need to have conditional compiler macros (tick ifdefs) around the import statement. |
Hi @MikeOpenHWGroup I tried with an ifedf around the import statement, but JG is not ignoring the else clause, but it is giving a "ERROR (VERI-1158)" instead about the "use of undefined macro 'uvm_error''". Anyway, you can still go ahead with using the following ifndef:
and then we will define our own dummy uvm_error implementation to get around the error when using Jasper Gold (and use the real uvm_error otherwise when not using Jasper Gold). |
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
Hi @Silabs-ArjanB and @davideschiavone. This PR has been hanging out for more than a month. As I understand things, it was blocked by PR #436. That one is merged in now (plus several others), so can we get to this one? BTW, both of you are Committers, so either can merge it. |
@@ -11,6 +11,20 @@ | |||
// Wrapper for a cv32e40p, containing cv32e40p, and tracer | |||
// Contributor: Davide Schiavone <davide@openhwgroup.org> | |||
|
|||
`ifdef CV32E40P_SVASSERTIONS |
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.
Please use `ifdef CV32E40P_ASSERT_ON instead. That is what we assume in our Makfiles, etc.
@@ -80,6 +94,14 @@ module cv32e40p_wrapper import cv32e40p_apu_core_pkg::*; | |||
output logic core_sleep_o | |||
); | |||
|
|||
`ifdef CV32E40P_SVASSERTIONS |
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.
Please use `ifdef CV32E40P_ASSERT_ON instead. That is what we assume in our Makfiles, etc.
@@ -0,0 +1,89 @@ | |||
// Copyright 2020 Silicon Labs, Inc. |
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 file is now fully out of date with https://github.com/openhwgroup/cv32e40p/blob/master/rtl/cv32e40p_prefetch_controller.sv. Please re-add the current set of assertions from https://github.com/openhwgroup/cv32e40p/blob/master/rtl/cv32e40p_prefetch_controller.sv
+incdir+${DESIGN_RTL_DIR}/../bhv/include | ||
+incdir+${DESIGN_RTL_DIR}/../sva |
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.
Please make sure that the assertions are included in the Makefile from example_tb/core as well and that 'hello world' runs there including the asserstions
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, here I will have to say "no". I am not the owner/maintainer of example_tb and in fact have asked several times for it to be removed.
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
Signed-off-by: Mike Thompson <mike@openhwgroup.org>
Hi @Silabs-ArjanB, @davideschiavone. I have made this pull-request up-to-date with the head of the master branch of the RTL and made edits as per @Silabs-ArjanB, recommendations. I have also wrapped the SV property in the cv32e40p_aligner with compiler directives to exclude it for Verilator compiles. Please try to get this merged in quickly as a significant amount of additional work cannot make progress until this is "in". Thanks. |
@MikeOpenHWGroup Most feedback given has not been taken into account; I will merge this anyway and then do another commit to make the required fixes (worst one was that assertions were removed all together) |
Hi @Silabs-ArjanB and @davideschiavone, this is a demonstration of how we can use the new cv32e40p_wrapper to bind in "designer assertions" into the RTL. This was discussed in the
OpenHW: Extracting assertions from the RTL
email thread.This demo moves the assertions in
cv32e40p_prefetch_controller
module up to the wrapper. Once we settle on an implementation it will be straightforward to move the remaining assertions.There are some minimal updates required to the verification environment to support this. If you clone the
regression_test
branch of https://github.com/MikeOpenHWGroup/core-v-verif, you can run "make sanity" and see it in action.