Skip to main content

Generate Header files from a SystemRDL register model

Project description

PeakRDL Raw Header

Generates a very basic header with addresses, sizes, and offsets from a SystemRDL file as a plugin to PeakRDL.

Currently supported formats:

Format Function
c Simple C header file
svh Simple SystemVerilog header file
svpkg Simple SystemVerilog package

Custom templates are also supported.

Installation

You can install the package via pip:

pip install peakrdl-rawheader

Or add it as a dependency in your pyproject.toml or requirements.txt e.g. with uv:

uv add peakrdl-rawheader

Usage

Example

Given the following SystemRDL input:

addrmap top {
    enum state {
        IDLE = 0;
        BUSY = 1;
    };

    reg status_reg {
        field {
            encode = state;
        } fld;
    };

    status_reg status[2];
};

The generated output will look like this:

C Header (c)

#define TOP_STATUS_BASE_ADDR(status_idx) (0x00000000 + (status_idx * 0x00000004))
#define TOP_STATUS_NUM 0x00000002
// ...
#define state__IDLE 0
#define state__BUSY 1

SystemVerilog Header (svh)

`define TOP_STATUS_BASE_ADDR(status_idx) (64'h0 + (status_idx * 64'h4))
`define TOP_STATUS_NUM 64'h2
// ...
`define STATE__IDLE 0
`define STATE__BUSY 1

SystemVerilog Package (svpkg)

function automatic longint unsigned TOP_STATUS_BASE_ADDR(input int unsigned status_idx);
    return 64'h0 + (status_idx * 64'h4);
endfunction
// ...
typedef enum logic [0:0] {
    IDLE = 1'd0,
    BUSY = 1'd1
} state_e;

Publishing to PyPI

To create a new release on PyPI, follow the following steps:

  1. Bump the version number in pyproject.toml. If you are using uv, you can do this with:
uv version --bump major|minor|patch

You can also do this manually by editing pyproject.toml, but make sure you run uv lock afterwards to update the lock file as well.

  1. Edit the the CHANGELOG.md to reflect the changes in this new version.

  2. Commit the changes:

git add pyproject.toml uv.lock CHANGELOG.md
git commit -m "Release vX.Y.Z"
git push origin main
  1. Optional: You can try out publishing the package to TestPypi first by running the publish-test-pypi CI job that has a manual workflow_dispatch trigger.

  2. Create a new release on Github with the same version tag (e.g. vX.Y.Z).

This will automatially trigger a Github workflow to build and publish the package to PyPI using Trusted Publishing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

peakrdl_rawheader-0.2.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

peakrdl_rawheader-0.2.2-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file peakrdl_rawheader-0.2.2.tar.gz.

File metadata

  • Download URL: peakrdl_rawheader-0.2.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for peakrdl_rawheader-0.2.2.tar.gz
Algorithm Hash digest
SHA256 bfbca17fec790a96f10362cf24a20ee4fb48abd146a1750b3d9580b00542de55
MD5 dd0565feac5ae1c31c54b3b6ca0653ca
BLAKE2b-256 973636ade0ca25d5d4cfe1e4235aa1e38c8df7e20209fe4f30babc7a8b9ddcba

See more details on using hashes here.

File details

Details for the file peakrdl_rawheader-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: peakrdl_rawheader-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for peakrdl_rawheader-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c299845d87bdc8353cec2279a9c42000e01b026de0c7deb87635f1ecfe11ff5
MD5 f41d84c6eaf2966b42808677435b2ca9
BLAKE2b-256 363cdadd8c81adc80e3adcd8279ab110be82ef82394e07a535500e30999fab65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page