lowRISC / opentitan

OpenTitan: Open source silicon root of trust
https://www.opentitan.org
Apache License 2.0
2.53k stars 754 forks source link

[rv_core_ibex,dv] Integrate the Ibex "core_ibex" tests with dvsim #11794

Open rswarbrick opened 2 years ago

rswarbrick commented 2 years ago

This is needed as part of the V2 milestone.

The lamest possible approach would basically have "run all the Ibex tests" as a one-shot dvsim tool. We can do somewhat better by wrapping calls to the Ibex Makefile for build and "run a test". That way, we'll still essentially be running the Ibex flow, but will expose parallelism to the dvsim scheduler.

estimate 32 remaining 2022-08-04 30 remaining 2022-08-05 26 remaining 2022-08-08 24 remaining 2022-08-17 20 remaining 2022-08-18 16 remaining 2022-08-31 13

GregAC commented 2 years ago

@johngt I think we'll need to mirror this issue in the Ibex repository to enable tracking with Yoda. I don't think we can just move it as it's under two projects and the OpenTitan M2 milestone.

marnovandermaas commented 2 years ago

Additional notes from Rupert on which steps to take:

  1. The dv/uvm/core_ibex/Makefile in the Ibex repository is cut down to "bare bones" and all the application logic is done in scripts that it calls.

  2. In dvsim, we define a subclass of FlowCfg called something like IbexSimCfg. This is morally equivalent to our existing SimCfg but works somewhat differently under the hood, calling out to the scripts from (1) that now do all the work.

    For example a "build" step will build the testbench and also the (SystemVerilog) random instruction generator.

    A "run" step will run the random instruction generator, assemble the results, run the testbench over the instructions and (until the cosim work is finished) run an ISS over the instructions and check everything matches. These steps will all be serial, but that doesn't really matter because the ISS is quick and the dependency graph for everything else is linear anyway.

  3. On the OT side, we write an "ibex_sim_cfg.hjson" that uses IbexSimCfg and runs the Ibex tests.

  4. This gets wired into the chip-level primary config

marnovandermaas commented 2 years ago

Step 1 has already mostly been done and will be improved with this PR: https://github.com/lowRISC/ibex/pull/1705

marnovandermaas commented 2 years ago

Step 2, 3 and 4, I've made some progress on. Specifically I have made an initial version of CosimCfg.py to describe a new flow and an initial version of ibex_sim_cfg.hjson. All of these are still on a local branch, and I hope to create a draft PR on this soon.

marnovandermaas commented 2 years ago

Today, I got a base version of the cosimulation flow working by adding a cosim.mk flow makefile.

It's not currently ready to be a PR, but you can have a look at my branch here: https://github.com/marnovandermaas/opentitan/tree/ibex_dvsim

spent 2 remaining 2022-08-04 30

marnovandermaas commented 2 years ago

Today, I got OT dvsim to call the Ibex DV makefile. I pointed the Ibex DV to the OpenTitan IP, which is vendored in in the main Ibex repo, but ran into a divergence. I created a PR on Ibex to fix this divergence: https://github.com/lowRISC/ibex/pull/1749

spent 4 remaining 2022-08-05 26

marnovandermaas commented 2 years ago

Vendor in the new Ibex fixes and added a patch for the DV Makefile. Make a change to util/vendor.py to warn when patch directories don't exist. https://github.com/marnovandermaas/opentitan/tree/dbd608c2cbaf6920d59882d6212ef9e705829abe

spent 2 remaining 2022-08-08 24

marnovandermaas commented 2 years ago

The next step for this task is to execute the individual tests through dvsim instead of running the whole test suite. This also allows us to report the individual passes and failures in the dvsim format.

I had a discussion with @hcallahan-lowrisc and we decided to base this change off of a build system refactor of Ibex DV that is currently tracked in this PR: https://github.com/lowRISC/ibex/pull/1705

spent 2 remaining 2022-08-11 22

marnovandermaas commented 2 years ago

Vendor in the new Ibex DV build system.

spent 2 remaining 2022-08-17 20

marnovandermaas commented 2 years ago

Made some changes necessary to the new Ibex DV build system to be used inside the OpenTitan repository.

spent 4 remaining 202208018 16

marnovandermaas commented 2 years ago

I pulled in the new changes by the PRs that I mention above. This required updates to the patches I made earlier. I also found a way to change the output directory to use the dvsim scratch directory instead of the out directory in ibex.

spent 3 remaining 20220831 13

marnovandermaas commented 2 years ago

The current plan is to stop calling the Ibex DV makefile, but use the scripts located in: https://github.com/lowRISC/opentitan/tree/master/hw/vendor/lowrisc_ibex/dv/uvm/core_ibex/scripts These steps need to be done in: https://github.com/marnovandermaas/opentitan/blob/ibex_dvsim/util/dvsim/CosimCfg.py This basically means replicating the steps that are done in the Makefile: https://github.com/lowRISC/opentitan/blob/master/hw/vendor/lowrisc_ibex/dv/uvm/core_ibex/Makefile And deploying multiple builds in the same way as: https://github.com/lowRISC/opentitan/blob/master/util/dvsim/SimCfg.py

msfschaffner commented 1 year ago

@GregAC can we add this to the Ibex V2 review discussion.

msfschaffner commented 1 year ago

We discussed this in the Ibex V2 meeting. Since the regressions are run nightly and can be audited, we're deferring this to V3 / M3 so that we can focus on more important tasks for M2.

CC: @tjaychen @moidx @sriyerg

tjaychen commented 1 year ago

We discussed this in the Ibex V2 meeting. Since the regressions are run nightly and can be audited, we're deferring this to V3 / M3 so that we can focus on more important tasks for M2.

CC: @tjaychen @moidx @sriyerg

agreed

moidx commented 1 year ago

agreed

GregAC commented 1 year ago

Assigning this to M2.5 but my feeling is it is very low priority. Ibex regression results will be available in the new dashboards coming with the documentation Ibex and an HTML report of the Ibex nightly regression will be published.

GregAC commented 3 months ago

Removing this from the M5 milestone. It's definitely in the future release/infrastructure improvement category