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
ldh Linker script header (MEMORY + PROVIDE symbols)

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;

Linker Header (ldh)

/* Memories */
MEMORY {
  top_array_0 (rw) : ORIGIN = 0x70000000, LENGTH = 0x00100000
  top_imem (rx) : ORIGIN = 0x00000000, LENGTH = 0x00001000
}

/* Registers */
PROVIDE(__top_status_0_base_addr__ = 0x00000000);
PROVIDE(__top_status_1_base_addr__ = 0x00000004);
PROVIDE(__top_status_num__ = 0x00000002);
PROVIDE(__top_status_stride__ = 0x00000004);

ldh supports selectively disabling either section:

  • --ldh-no-memory: skip MEMORY { ... } region emission
  • --ldh-no-symbols: skip PROVIDE(...) symbol emission

MEMORY attributes are derived from memory properties:

  • sw controls r/w
  • user-defined boolean executable controls x

Example UDP declaration in SystemRDL:

property executable {
  component = mem;
  type = boolean;
};

Releasing

Release instructions are documented in RELEASE.md.

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.5.tar.gz (11.4 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.5-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: peakrdl_rawheader-0.2.5.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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.5.tar.gz
Algorithm Hash digest
SHA256 acb3bfa156bace5606bd562ef7d99ca2dd47ed7521b3cbb1cc8a7fa91f28aed0
MD5 ab9dc31b4bfffce1de956ac0ef8f6405
BLAKE2b-256 19ab62dd4b4dc50e9d311f2e8bddafedad3dab4492de5042b5bd6c1f06cb3333

See more details on using hashes here.

File details

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

File metadata

  • Download URL: peakrdl_rawheader-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 461c4ba9fc8fb8b4116a09a7ce83d64eb3da9093d2b020e2258e4ab9e91753d7
MD5 dfc153862321a08d7f1520299c6b372b
BLAKE2b-256 d0fbf32dc05418f55b4c1aa6e32ad91586cc865811f8bc8425034196f7d92bd4

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