Skip to main content

Corsair

corsair_logo

Documentation Status PyTest Status PyPI version

Corsair is a tool that makes it easy to create and maintain control and status register (CSR) map for any HDL project. It allows you to describe your register map in a single file and then generate HDL code, headers, documentation and other things. This effectively eliminates any mismatches between hardware, software and documentation of your IP-core.

corsair_flow

Features

  • Various human-readable input formats: JSON, YAML or plain text table
  • HDL code generation: Verilog or VHDL module with register map, Verilog header or SystemVerilog package with parameters and definitions
  • Multi-protocol support: APB, AXI-Lite, Avalon-MM
  • Documentation generation: Markdown, AsciiDoc
  • Generation of software-related files: C header, Python module
  • Extensibility: support of external file generators
  • API: creation of custom workflow with corsair API

Corsair documentation is on the ReadTheDocs.io.

Install

Depending on your system, Python 3 executable might be python or python3. If there any permissions issues, add --user key to the installation scripts.

To install the latest stable release:

python3 -m pip install -U corsair

Quick start

The best way to start is to create templates. You can create one for a register map in a format you like (choose onе from json, yaml, txt) :

corsair -t yaml

This generates two files: one for register map in the format specified regs.yaml, and other for configuration - csrconfig.

Register map consists of a collection of memory mapped registers (also referred as CSRs), and registers are made up of bit fields. For example, register map of one register looks like this in YAML:

regmap:
-   name: CTRL
    description: Control register
    address: 8
    bitfields:
    -   name: BAUD
        description: Baudrate value
        reset: 0
        width: 2
        lsb: 0
        access: rw
        hardware: o
        enums:
        -   name: B9600
            description: 9600 baud
            value: 0
        -   name: B38400
            description: 38400 baud
            value: 1
        -   name: B115200
            description: 115200 baud
            value: 2

To know more about registers, bit fields and their attributes please check the Register map documentation page.

Corsair is configuration-file-oriented tool. By default, it uses INI configuration file csrconfig. It specifies all the things needed for generation - input register map file, global parameters and output files (also called targets). It may looks like this:

[globcfg]
data_width = 32
address_width = 16
register_reset = sync_pos

[v_module]
path = regs.v
interface = axil
generator = Verilog

[c_header]
path = regs.h
generator = CHeader

Check the Configuration file page to get more details about csrconfig and the Introduction page to get general information about workflow.

csrconfig also acts like a build script for corsair, so just run in the directory with csrconfig file:

corsair

And then all the magic happens.

There are some additional options for overriding working directory, register map or configuration file - to get help simply run

corsair -h

If you looking for some more examples please check examples folder.

Development

Please follow the Developer's Guide.

License

Corsair is licensed under MIT License.

Metadata

Release files for corsair 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for corsair 1.0.4
File Size Uploaded Provenance Actions
corsair-1.0.4.tar.gz 32.2 kB Without provenance Details for corsair-1.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for corsair 1.0.4
File Interpreter ABI Platform Actions
corsair-1.0.4-py3-none-any.whl Python 3 none any Details for corsair-1.0.4-py3-none-any.whl

Total release size: 73.8 kB

Release files / corsair-1.0.4.tar.gz

Download URL corsair-1.0.4.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2ea71bfe8e1c7ba9ff7ffa49b174de712451fe51b4424386f27e5bb2b17ae89b
BLAKE2b-256 checksum
How to use checksums
da5a8db4775c7977a8dc7e0eecbd78146826140a229867aae4ea23c77aa36dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / corsair-1.0.4-py3-none-any.whl

Download URL corsair-1.0.4-py3-none-any.whl
Size 41.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7049a3a03893a05153cc136bca8f4aba370e77e33f7ba415592153387b54357d
BLAKE2b-256 checksum
How to use checksums
360826f92fb4d739ea33f2f10ee5a8bc8ee10ebeb6fba812986a29a075213309
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for corsair 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page