Automated AXI4-Lite Register Interface Generator for VHDL modules
Project description
Axion-HDL
Axion-HDL is an automated AXI4-Lite register interface generator for VHDL. Parse VHDL files with @axion annotations or XML register definitions to generate complete, protocol-compliant register interfaces, C headers, and documentation.
โจ Key Features
| Feature | Description |
|---|---|
| Dual Input Formats | VHDL with @axion annotations or standalone XML register definitions |
| AXI4-Lite Compliant | Fully protocol-compliant slave interfaces with proper handshaking |
| Subregisters | Pack multiple bit-fields into single 32-bit registers |
| Default Values | Define reset values with DEFAULT attribute |
| Wide Signals | Automatic multi-register allocation for signals >32 bits |
| Multiple Outputs | VHDL, C headers, XML (IP-XACT), Markdown documentation |
| CDC Support | Built-in clock domain crossing synchronizers |
| Pure Python | No external dependencies, Python 3.8+ |
๐ฆ Installation
pip install axion-hdl
๐ Quick Start
Option 1: VHDL Annotations
Add @axion annotations directly in your VHDL:
-- @axion_def BASE_ADDR=0x0000 CDC_EN CDC_STAGE=2
entity sensor_controller is
port (clk : in std_logic; rst_n : in std_logic);
end entity;
architecture rtl of sensor_controller is
signal status_reg : std_logic_vector(31 downto 0); -- @axion RO ADDR=0x00 DESC="Status"
signal control_reg : std_logic_vector(31 downto 0); -- @axion WO ADDR=0x04 W_STROBE
signal config_reg : std_logic_vector(31 downto 0); -- @axion RW ADDR=0x08 DEFAULT=0xCAFE
begin
end architecture;
axion-hdl -s sensor_controller.vhd -o ./output
Option 2: XML Register Definition
Define registers in standalone XML files:
<register_map module="sensor_controller" base_addr="0x0000">
<config cdc_en="true" cdc_stage="2"/>
<register name="status_reg" addr="0x00" access="RO" width="32" description="Status"/>
<register name="control_reg" addr="0x04" access="WO" width="32" w_strobe="true"/>
<register name="config_reg" addr="0x08" access="RW" width="32" default="0xCAFE"/>
</register_map>
axion-hdl -s registers.xml -o ./output
Generated Outputs
| Output | File | Description |
|---|---|---|
| VHDL | *_axion_reg.vhd |
AXI4-Lite slave register interface |
| C Header | *_regs.h |
Module-prefixed register definitions |
| XML | *_regs.xml |
IP-XACT compatible register map |
| Docs | register_map.md |
Markdown documentation |
๐ Annotation Reference
Module-Level (@axion_def)
-- @axion_def BASE_ADDR=0x1000 CDC_EN CDC_STAGE=3
| Attribute | Description | Default |
|---|---|---|
BASE_ADDR |
Module base address | 0x0000 |
CDC_EN |
Enable clock domain crossing | Disabled |
CDC_STAGE |
Synchronizer stages (2-4) | 2 |
Signal-Level (@axion)
signal my_reg : std_logic_vector(31 downto 0); -- @axion <MODE> [options]
| Parameter | Values | Description |
|---|---|---|
| Mode | RO, WO, RW |
Access mode (required) |
ADDR |
0x00-0xFFFF |
Address offset (auto-assigned if omitted) |
DEFAULT |
0x... or decimal |
Reset value (default: 0) |
R_STROBE |
flag | Generate read strobe signal |
W_STROBE |
flag | Generate write strobe signal |
DESC |
"text" |
Register description |
Examples
signal status : std_logic_vector(31 downto 0); -- @axion RO DESC="System status"
signal control : std_logic_vector(31 downto 0); -- @axion WO W_STROBE DEFAULT=0x01
signal config : std_logic_vector(31 downto 0); -- @axion RW ADDR=0x10 R_STROBE W_STROBE
๐งฉ Advanced Features
Subregisters (Packed Bit-Fields)
Pack multiple fields into a single 32-bit register:
-- Enable field at bit 0 (1 bit)
signal enable : std_logic; -- @axion RW REG_NAME=control_reg BIT_OFFSET=0 DEFAULT=1
-- Mode field at bits 2:1 (2 bits)
signal mode : std_logic_vector(1 downto 0); -- @axion RW REG_NAME=control_reg BIT_OFFSET=1
-- IRQ mask at bits 7:4 (4 bits)
signal irq_mask : std_logic_vector(3 downto 0); -- @axion RW REG_NAME=control_reg BIT_OFFSET=4
Or in XML:
<register name="enable" reg_name="control_reg" addr="0x00" width="1" access="RW" bit_offset="0" default="1"/>
<register name="mode" reg_name="control_reg" addr="0x00" width="2" access="RW" bit_offset="1"/>
<register name="irq_mask" reg_name="control_reg" addr="0x00" width="4" access="RW" bit_offset="4"/>
Wide Signals (>32 bits)
Signals wider than 32 bits automatically span multiple registers:
signal counter_64bit : std_logic_vector(63 downto 0); -- @axion RO ADDR=0x00
-- Accessible at: 0x00 (bits 31:0), 0x04 (bits 63:32)
signal data_256bit : std_logic_vector(255 downto 0); -- @axion RW ADDR=0x10
-- Accessible at: 0x10, 0x14, 0x18, 0x1C, 0x20, 0x24, 0x28, 0x2C
Clock Domain Crossing (CDC)
Enable automatic synchronization between AXI and module clock domains:
-- @axion_def CDC_EN CDC_STAGE=3
-- RO registers: synced from module_clk โ axi_aclk
signal sensor_data : std_logic_vector(31 downto 0); -- @axion RO
-- RW/WO registers: synced from axi_aclk โ module_clk
signal control : std_logic_vector(31 downto 0); -- @axion RW
๐ป CLI Reference
# Basic usage
axion-hdl -s ./src -o ./output
# Single file (auto-detects VHDL or XML by extension)
axion-hdl -s module.vhd -o ./output
axion-hdl -s registers.xml -o ./output
# Multiple sources (files and directories)
axion-hdl -s ./rtl -s ./extra/module.vhd -s definitions.xml -o ./output
# Selective outputs
axion-hdl -s ./src -o ./output --vhdl --c-header
# Exclude patterns
axion-hdl -s ./src -o ./output -e "*_tb.vhd" -e "testbenches"
# Documentation format
axion-hdl -s ./src -o ./output --doc --doc-format html
Options
| Option | Description |
|---|---|
-s, --source PATH |
Source file (.vhd, .vhdl, .xml) or directory |
-o, --output DIR |
Output directory (default: ./axion_output) |
-e, --exclude PATTERN |
Exclude pattern (can repeat) |
--all |
Generate all outputs (default) |
--vhdl |
Generate VHDL only |
--c-header |
Generate C header only |
--xml |
Generate XML only |
--doc |
Generate documentation only |
--doc-format FORMAT |
Doc format: md, html, pdf |
๐ Python API
from axion_hdl import AxionHDL
axion = AxionHDL(output_dir="./output")
# Add sources (auto-detects type by extension)
axion.add_source("./rtl") # Directory
axion.add_source("module.vhd") # VHDL file
axion.add_source("registers.xml") # XML file
# Or use type-specific methods
axion.add_src("./vhdl_files") # VHDL sources
axion.add_xml_src("./xml_files") # XML sources
# Exclude patterns
axion.exclude("*_tb.vhd", "testbenches")
# Analyze and generate
axion.analyze()
axion.generate_all()
# Or generate specific outputs
axion.generate_vhdl()
axion.generate_c_header()
axion.generate_xml()
axion.generate_documentation()
๐งช Testing
The project includes 201 automated tests covering all requirements:
make test # Run all tests
make test-python # Python tests only
make test-vhdl # VHDL simulation tests only
Test categories: AXION (37), AXI-LITE (16), PARSER (20), GEN (30), CLI (14), CDC (8), ADDR (9), ERR (9), STRESS (6), SUB (9), DEF (10)
๐ Project Structure
axion-hdl/
โโโ axion_hdl/ # Main Python package
โ โโโ axion.py # AxionHDL main class
โ โโโ cli.py # Command-line interface
โ โโโ parser.py # VHDL parser
โ โโโ xml_input_parser.py # XML parser
โ โโโ generator.py # VHDL generator
โ โโโ doc_generators.py # C/XML/MD generators
โโโ tests/
โ โโโ vhdl/ # VHDL examples & testbenches
โ โโโ xml/ # XML examples
โ โโโ python/ # Python unit tests
โโโ requirements.md # Full requirements specification
โโโ CHANGELOG.md # Version history
๐ Naming Convention
| Context | Name | Example |
|---|---|---|
| PyPI Package | axion-hdl |
pip install axion-hdl |
| Python Import | axion_hdl |
from axion_hdl import AxionHDL |
| CLI Command | axion-hdl |
axion-hdl --help |
๐ค Contributing
- Fork the repository
- Create a feature branch from
develop - Make your changes
- Run tests:
make test - Submit a pull request to
develop
๐ License
MIT License - see LICENSE
๐ค Author
Bugra Tufan
๐ง bugratufan97@gmail.com
๐ github.com/bugratufan/axion-hdl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file axion_hdl-0.4.3.tar.gz.
File metadata
- Download URL: axion_hdl-0.4.3.tar.gz
- Upload date:
- Size: 100.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cf81b1bb125e5c2c37829974926450ebf348c887f7ee826718f42342cb564d9
|
|
| MD5 |
47654a086c0b9ef67796121bdc6d9992
|
|
| BLAKE2b-256 |
f3e7a04b420eea768788e16cda4baa349443a88b05eb356f1095f3913f7b75ca
|
Provenance
The following attestation bundles were made for axion_hdl-0.4.3.tar.gz:
Publisher:
publish.yml on bugratufan/axion-hdl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axion_hdl-0.4.3.tar.gz -
Subject digest:
9cf81b1bb125e5c2c37829974926450ebf348c887f7ee826718f42342cb564d9 - Sigstore transparency entry: 755069680
- Sigstore integration time:
-
Permalink:
bugratufan/axion-hdl@a2ddbf1ee2664a56699765c97272b9bffec45011 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bugratufan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a2ddbf1ee2664a56699765c97272b9bffec45011 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file axion_hdl-0.4.3-py3-none-any.whl.
File metadata
- Download URL: axion_hdl-0.4.3-py3-none-any.whl
- Upload date:
- Size: 51.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
814f1e3357bb50b4b336bf572b862b6669f01a02237d1eebb2166ba92a31ba9d
|
|
| MD5 |
c87fdc09b1d15d4a7a2663a7692d4ceb
|
|
| BLAKE2b-256 |
a948e7218a8b16f4018be2dd2d374ddbb7782956e31760ac55bf5d19b45051d3
|
Provenance
The following attestation bundles were made for axion_hdl-0.4.3-py3-none-any.whl:
Publisher:
publish.yml on bugratufan/axion-hdl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axion_hdl-0.4.3-py3-none-any.whl -
Subject digest:
814f1e3357bb50b4b336bf572b862b6669f01a02237d1eebb2166ba92a31ba9d - Sigstore transparency entry: 755069698
- Sigstore integration time:
-
Permalink:
bugratufan/axion-hdl@a2ddbf1ee2664a56699765c97272b9bffec45011 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bugratufan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a2ddbf1ee2664a56699765c97272b9bffec45011 -
Trigger Event:
pull_request
-
Statement type: