[topgen] Generate PLIC Enums and Peripheral Mapping

Until now, the PLIC DIF has used a handwritten set of enums to produce
human readable names for interrupt ids, and handwritten arrays to map
these back to peripherals.

This commit now auto-generates this information, based on the interrupt
information in `top_earlgrey.hjson`, and adds it to `top_earlgrey.h`.

The following enums are generated:
- `top_earlgrey_plic_irq_id_t`: interrupt ID enum, from
  `top['interrupt']`;
- `top_earlgrey_plic_peripheral_t`: interrupt peripheral (source) enum,
  `from top['interrupt_module']`,
- `top_earlgrey_plic_target_t`: interrupt target enum, from
  `top['num_cores']`

This also generates a mapping from an interrupt ID to the peripheral
that it came from, called `top_earlgrey_plic_interrupt_for_peripheral`
and implemented using a const array. This maps from
`top_earlgrey_plic_irq_id_t` to `top_earlgrey_plic_peripheral_t`. This
is generated into a .c file (as its definition cannot be put into a
header), and a library is created called `top_earlgrey_ot` to contain
it.

Signed-off-by: Sam Elliott <selliott@lowrisc.org>
6 files changed
tree: fdca82e93c8f257d872de208ac141e7fb2d48a98
  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).