Crates.io | yarig |
lib.rs | yarig |
version | |
source | src |
created_at | 2025-01-12 05:55:18.336018+00 |
updated_at | 2025-05-06 06:16:53.203582+00 |
description | A register interface generator |
homepage | |
repository | https://github.com/TheClams/yarig |
max_upload_size | |
id | 1512972 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
YARIG is code generation tools to describe register interface of an IP or ASIC/FPGA design.
This allows to have one common source to describes registers for all the different views:
More details on targets are available in hardware targets and other targets.
YARIG uses its own file format named .rif
to describe the registers.
The objectives when designing the language were:
Complete details are available in the syntax page
Here is a simple RIF definition:
rif: test_rif
addrWidth: 8
dataWidth: 16
- Main:
registers:
- ctrl: "Basic control register"
- en = 0 0:0 "Block enable"
- start = 0 0:0 pulse "Start block"
- version = 0x12 15:8 ro "Block version"
hw na
- interrupt: "Interrupt register"
interrupt rising en=0x13 mask=0x37 pending w1clr
enable.description "Enable interrupt"
mask.description "Mask interrupt"
pending.description "Pending interrupt"
- gen = 0 7:0 rw "Generic Events"
- busy = 0 8:8 "Busy"
- ready = 0 9:9 "Ready"
- status: "Status register"
- state 3:0 "Current state"
- success 4:4 "Last operation succeed"
- failed 5:5 "Last operation failed"
instances: auto
Highlighting for SublimeText is available on github.
A configuration file allows to specify many options of the generators like the rif file, a list of target, the output path for each targets, ...
Here is an example:
filename = "my_chip.rif"
gen_inc = ["*"]
targets = ["py", "sv", "html", "latex", "c"]
[suffixes.spi]
name = "full"
pkg = true
[outputs]
doc = "../yarig/doc"
c = "../yarig/c"
py = "../yarig/py"
rtl = "../yarig/rtl"
sim = "../yarig/sim"
vhdl = "../yarig/vhdl"
All settings from the configuration file can be overriden by command-line arguments. Run yarig -h
to list all available options.
To streamline the developement of new output targets, the library contains three base generator traits, which basically go through the different elements of the structure and apply the visibility checks (public/private). The exact behavior of each traits can be tweaked with some associated constant.