-
Notifications
You must be signed in to change notification settings - Fork 815
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
[dv,dvsim,tooling] Questa Support #24341
Comments
reserved for updates |
@lmg260a
I'd like to try and keep things centralized to this issue to start with. If there are common design patterns in the codebase causing problems, we can always spin discussions about them out into individual issues/tickets if it becomes too noisy within this thread. If we do open new issues, probably tagging with I think the best way to submit/suggest code changes would be to post a link to a branch on your github, or to paste the diff into this issue as a comment. I want to integrate all the changes into the working PR #24331 so I can regress it against all the tools I do have access to in one go before merging, so raising individual pull requests for changes is probably going to be quite a lot of noise at this point.
Thanks for bringing this up. In the OpenTitan codebase, it's a common pattern to redefine a constraint in a child class intentionally to overwrite the parent class constraint. As you say, that is what the LRM specifies the behaviour should be. Based on your comment (1), is your previous experience that this should always be documented at every instance? Or is a comment about this something that should be incorporated into a project level style-guide?
Can you checkout the working PR #24331, and share the dvsim command you are using to generate the test? Also could you share the variable/error, plus which assignment / randomization you suspect is incorrectly generating 0? I can run it locally and share some logs / values, or suggest where things might be going wrong. Thanks! |
@lmg260a The example dvsim command from your comment (
Printed with newlines, the invocation was:
This CLI invocation looks okay to me at a pass. Do you see the same failure mode as you described in the other issue when invoking this way, or something else? |
Some best practices that would help:
I'd be happy to do any sort of online class or talk that might help your team on this - I think you've got an amazing thing here, and I'm just trying to do what I can to help. The problem with greatness is you can't ever stop improving, or else you just eventually wind up back at "good". |
Hi Harry, to: This path has "sim-vcs" instead of "sim-questa" (happens multiple places) Questa is stricter to the LRM than VCS, so a series of switches are required to tell Questa to relax rules to be VCS-compatible. This is one of them: This shouldn't be required; in any case, +acc is going obsolete in 2025 to be replaced by other switches. Please add General questions:
Could you please include what you get for running the sim in Those will need changes as well. |
Description
This is a bucket-issue for improving Questa support in OpenTitan.
Motive
I would like to get Questa support into a better place across the project.
Questa is a simulator that many people have access to, and a part of maximizing value of the OpenTitan project is to keep the barrier to entry as low as possible for anyone who is interested.
As lowRISC currently does not have access to questa licenses, nor is anyone regularly developing on OpenTitan with it or regressing the DV suite using it, the support there has always been limited and liable to break without notice.
I hope one day we can test our codebase against more simulators and catch breaking changes before they are merged, but up to now it has been a best-effort approach.
Ctx
Questa support was added initially to our DV test tool 'dvsim' in #10574 - [hw/dv] Feature/questa dv, though I am not sure to what extent it was functional at the time. (i.e. which testbenches could be compiled/simulated, and which were incompatible).
Our signoff simulator for blocks/tops is primarily VCS (for example. see the earlgrey top-level testbench config file chip_sim_cfg.hjson#L15), although some blocks now use Xcelium for signoff as well.
'dvsim' is extensible, and the support added above allows for invoking simulations using the questa CLI when you use
--tool=questa
.Fundamentally, dvsim should be able to assemble a valid CLI invocation for any tool it supports, with any number of arguments that are specific to the quirks of any program.
Some parts of this process are quite generic between tools. For example, we use fusesoc .core files to package blocks and components, and dvsim will invoke fusesoc to generate output collateral such as a specific filelist for the simulation/testbench of interest.
The tool-specific file /hw/dv/tools/dvsim/questa.hjson is then responsible for tying-up the generic parts of the flow with the implementation details of a tool.
Existing Questa Tickets
I did a little search of previous issues and pull requests related to questa support. I've pulled out the ones I think might be useful as a reference here...
Issues
https://github.com/lowRISC/opentitan/issues?q=is%3Aissue+questa+
PRs
https://github.com/lowRISC/opentitan/pulls?q=is%3Apr+questa+
Fixing outstanding issues
To get our DV flows working with Questa more broadly, the bulk of the work will be in SV / LRM differences in how tools interpret our codebase. A familiar hurdle for sure!
This process will probably raise a number of issues in dv base classes to begin with, and then follow onto testbench code specific to each block.
Probably the best approach will be to work block-by-block through the individual testbenches, first fixing any build issues, followed by any runtime differences.
The following table is a good starting list of some block level testbenches for non-parameterized blocks, and suggested invocations to test them.
(I've just worked down the list of IP in
hw/ip
to make a start. This list can become a more comprehensive checklist of tested-blocks in the future.)./util/dvsim/dvsim.py hw/ip/adc_ctrl/dv/adc_ctrl_sim_cfg.hjson -i adc_ctrl_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/aes/dv/aes_masked_sim_cfg.hjson -i aes_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/aon_timer/dv/aon_timer_sim_cfg.hjson -i aon_timer_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/csrng/dv/csrng_sim_cfg.hjson -i csrng_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/edn/dv/edn_sim_cfg.hjson -i edn_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/entropy_src/dv/entropy_src_sim_cfg.hjson -i entropy_src_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/gpio/dv/gpio_sim_cfg.hjson -i gpio_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/hmac/dv/hmac_sim_cfg.hjson -i hmac_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/i2c/dv/i2c_sim_cfg.hjson -i i2c_host_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/keymgr/dv/keymgr_sim_cfg.hjson -i keymgr_smoke --tool questa
./util/dvsim/dvsim.py hw/ip/kmac/dv/kmac_masked_sim_cfg.hjson -i kmac_smoke --tool questa
The top-level testbench would eventually be desirable to fix, though I suspect it will be the most work to get there.
./util/dvsim/dvsim.py hw/top_earlgrey/dv/chip_sim_cfg.hjson -i chip_sw_rv_timer_irq --tool questa
After running smoketests for each block, probably the next thing would be to run 'all_once' regressions in each block.
E.g.
./util/dvsim/dvsim.py hw/<ip>/dv/<ip>_sim_cfg.hjson -i all_once --tool questa
This should exercise all of the stimulus vseq's listed in the
sim_cfg.hjson
configuration file.Stimulus sequences are located in the following directory for each block-level testbench :
hw/<ip>/dv/env/seq_lib/
.Our existing convention has been to avoid
#ifdef
s unless absolutely necessary, so work in this area will need to prioritize finding common language constructs the tools agree on.There are a very small number of
#ifdef XCELIUM
or#ifdef VCS
switches in the codebase, and adding more of these should be considered a last-resort.However, I think absorbing changes that use
#ifdef
s in the short-term, tracked in issues with pending vendor support feedback, may be workable.For the working branch described below, short-term solutions using
#ifdef
s will be acceptable.How you can help
To start with, I've created a draft PR to accumulate a working set of changes to fix bugs as they are found.
As bugs and suggested fixes come in, we can discuss them in this issue, and then propagate them over to that PR.
Steps:
bazel test --test_output=streamed //sw/device/tests:uart_smoketest_sim_verilator
This will probably take a bit of time to get sorted out, as the feedback loop is inherently manual, and I don't have too many free cycles to put into this.
However, I hope that centralizing the discussions here will keep the process moving forwards, and eventually we can get up to a good parity with the other tools.
Thanks!
The text was updated successfully, but these errors were encountered: