Allow different assertion "backends" in prim_assert.sv

Different tools support different assertions. This splits out the
definitions of the base macros from prim_assert.sv into separate
headers (prim_assert_standard_macros.svh, prim_assert_dummy_macros.svh
and prim_assert_yosys_macros.svh).

The last of the three is new: it's used for Yosys when not
synthesizing (so used when Yosys is being run as a formal tool).

At the moment, Yosys's (System)Verilog frontend doesn't support
concurrent assertions. It does, however, support the immediate form,
so prim_assert_yosys_macros.svh expresses them as such.

For example, ASSERT_I is normally

   name: assert (expr) else stmt

but here it becomes:

   begin : name
     assert (expr);
   end

(The name isn't reported by the error reporting machinery in the Yosys
flow, but at least it makes code a bit easier to figure out if you've
preprocessed your source with sv2v and the line numbers are all
bogus).

Similarly, ASSERT is normally something like:

   name: assert property (@(posedge clk_i) disable iff rst_ni expr)

Here it becomes:

   always_ff @(posedge clk_i) begin : name
     if (rst_ni) name: assert (prop);
   end

These transformations should not change the truth of an assertion, at
least with the Yosys tool (which isn't event based and samples signals
for assertions after everything has settled).

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
6 files changed
tree: b1172e437274b31c2d709191087c877ff0bd427f
  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 access it online at docs.opentitan.org.

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).