[bazel] add DV sim target to opentitan_functest

To support transitioning SW builds to bazel, additional rules needed to
be added to build sim_dv-specific device artifacts. These included a
sim_dv-specific bootstrap image (#11640) rule, and a sim_dv-specific SW
logging database extraction rule (#11755).

While both of these rules have already been added, they were not yet
invoked by the main test macro. Specifically, at a high level, the
`opentitan_functest` generates a `test_suite` of `sh_test` rules. The
SW artifacts (ELFs, BINs, VMEMs, etc.) are marked as data runfiles of
each `sh_test` rule, so they get built when either `bazel build
<opentitan_functest name>` or `bazel test <opentitan_functest name>` is
executed. Since there was no DV sim specific `sh_test` rule in the
`opentitan_functest` `test_suite`, the sim_dv-specific artifacts were not
yet built when the prior commands.

To force bazel to build SW artifacts for the DV sim environment, an
additional `dv` target was added to the `opentitan_functest` macro.
Additionally, an associated `sh_test` target was added that runs a simple
shell script that echos the proper `dvsim.py` command a user should
execute to run the associated test in the DV simulation environment.

The reason the DV `sh_test` does not invoke `dvsim.py` directly, is
three fold:

1) `dvsim.py` has two components, an open-source component (that is
   included in this repository) and a closed source component (that is
   not included in this repository). The open-source component has the
   ability to launch DV simulations locally, provided a supported RTL
   simulator is installed locally on your machine. The closed-source
   component has the ability to launch DV simulations on
   cloud-infrastructure, that is often organization-specific. Teaching
   bazel how to handle the dependencies between these components is a
   topic for future investigation, outside the scope of this commit.

2) As written, `dvsim.py` invokes the SW build system as part of the
   process of launching simulations. If those simulations are launched
   on remote cloud infrastructure this will result in `dvsim.py`
   building SW artifacts twice, once locally when `bazel test
   <opentitan_functest test>` is invoked, and once on the remote machine
   when `dvsim.py` itself invokes `bazel build <opentitan_functest
   test>`. Resolving this inefficieny is outside the scope of this
   commit.

3) `dvsim.py` accepts a wide array of command line arguments that enable
   adjusting various simulation configurations and parameters (e.g.,
   whether to generate waves or not, whether to collect coverage or not,
   which random seeds to use, etc.). Integrating those into a bazel test
   target will require additional design / thought outside the scope of
   this commit.

This fixes #11684.

Signed-off-by: Timothy Trippel <ttrippel@google.com>
2 files changed
tree: 321b1c0a2d300f5243a943d52ff7fccb9a631c4c
  1. .github/
  2. ci/
  3. doc/
  4. hw/
  5. rules/
  6. site/
  7. sw/
  8. test/
  9. third_party/
  10. util/
  11. .bazelignore
  12. .bazelrc
  13. .bazelversion
  14. .clang-format
  15. .dockerignore
  16. .flake8
  17. .gitignore
  18. .style.yapf
  19. .svlint.toml
  20. .svls.toml
  21. _index.md
  22. apt-requirements.txt
  23. azure-pipelines.yml
  24. bazelisk.sh
  25. BUILD.bazel
  26. check_tool_requirements.core
  27. CLA
  28. COMMITTERS
  29. CONTRIBUTING.md
  30. LICENSE
  31. meson-config.txt
  32. meson.build
  33. meson_init.sh
  34. meson_options.txt
  35. python-requirements.txt
  36. README.md
  37. tool_requirements.py
  38. toolchain.txt
  39. topgen-reg-only.core
  40. topgen.core
  41. WORKSPACE
  42. yum-requirements.txt
README.md

OpenTitan

OpenTitan logo

About the project

OpenTitan is an open source silicon Root of Trust (RoT) project. OpenTitan will make the silicon RoT design and implementation more transparent, trustworthy, and secure for enterprises, platform providers, and chip manufacturers. OpenTitan is administered by lowRISC CIC as a collaborative project to produce high quality, open IP for instantiation as a full-featured product. See the OpenTitan site and OpenTitan docs for more information about the project.

About this repository

This repository contains hardware, software and utilities written as part of the OpenTitan project. It is structured as monolithic repository, or “monorepo”, where all components live in one repository. It exists to enable collaboration across partners participating in the OpenTitan project.

Documentation

The project contains comprehensive documentation of all IPs and tools. You can access it online at docs.opentitan.org.

How to contribute

Have a look at [CONTRIBUTING]({{< relref “CONTRIBUTING.md” >}}) and our documentation on project organization and processes for guidelines on how to contribute code to this repository.

Licensing

Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).