[dv] Allow dv_lib-based sequences to have different RSP/REQ types

Most UVM sequences just send items and don't receive any response:

    start_item(req);
    `DV_CHECK_RANDOMIZE_FATAL(req)
    finish_item(req);

However, sometimes a driver needs to report what happened. For
example, there might have been some sort of error on the bus which
will affect the next sequence item to send. In this case, the driver
calls

    seq_item_port.item_done(rsp);

and the sequencer's code looks like

    start_item(req);
    `DV_CHECK_RANDOMIZE_FATAL(req)
    finish_item(req);
    get_response(rsp);
    // Do something based on rsp...

But what type is rsp? Sometimes, it's enough to send the request item
back. This works nicely when the sequence items are actually
pipelined (so that the sequence can figure out what item finished).
Sometimes, however, you might want to use a different type from the
request type - it's a bit of a bodge just to add another field to the
request for a "back channel".

To support this, many UVM classes are parameterised by "REQ" and
"RSP": the type of request and response item, respectively. Some of
the dv_lib code supported this already (dv_base_seq), but the
sequencer and driver base classes didn't.

This patch adds that support, defaulting to RSP = REQ. The ordering of
parameters looks a little odd, but it seems that lots of OpenTitan
code sets parameters by position, rather than name, so we have to add
any new optional parameter at the end of the list.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
2 files changed
tree: 0de7f3932f23e8011f33a9b076da2b22d3f0d03e
  1. .github/
  2. ci/
  3. doc/
  4. hw/
  5. site/
  6. sw/
  7. test/
  8. util/
  9. .clang-format
  10. .dockerignore
  11. .flake8
  12. .gitignore
  13. .style.yapf
  14. _index.md
  15. apt-requirements.txt
  16. azure-pipelines.yml
  17. check_tool_requirements.core
  18. CLA
  19. COMMITTERS
  20. CONTRIBUTING.md
  21. LICENSE
  22. meson.build
  23. meson_init.sh
  24. meson_options.txt
  25. python-requirements.txt
  26. README.md
  27. tool_requirements.py
  28. toolchain.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 either access it online or build it locally by following the steps below.

  1. Ensure that you have the required Python modules installed (to be executed in the repository root):
$ sudo apt install curl python3 python3-pip
$ pip3 install --user -r python-requirements.txt
  1. Execute the build script:
$ ./util/build_docs.py --preview

This compiles the documentation into ./build/docs and starts a local server, which allows you to access the documentation at http://127.0.0.1:1313.

How to contribute

Have a look at CONTRIBUTING 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).