rdlfmt
A formatter for SystemRDL 2.0, following the PeakRDL style guide.
Before:
addrmap top{
reg {
field{sw=rw;
hw=r;} data[31:0]; // payload
}ctrl @0x0;
reg{field{sw=r;hw=w;}status[7:0];}stat@0x4;
};
After:
addrmap top {
reg {
field {
sw = rw;
hw = r;
} data[31:0]; // payload
} ctrl @ 0x0;
reg {
field {
sw = r; hw = w;
} status[7:0];
} stat @ 0x4;
};
Install
TODO: not yet published to crates.io — this will not work until it is.
cargo install rdlfmt
Until then, build from source (Rust 1.88+):
cargo build --release
Usage
Format a file, rewriting it in place — this is the default, and what you want most of the time:
rdlfmt regs.rdl
Format every .rdl file in a directory tree:
rdlfmt .
Check without writing anything. Exits 1 if any file is not formatted, which is the one for CI:
rdlfmt --check .
Same, but show what would change:
rdlfmt --diff regs.rdl
Write to stdout and leave the file alone:
rdlfmt --stdout regs.rdl
With no path at all, it reads stdin and writes stdout:
cat regs.rdl | rdlfmt
What it does
The style guide's rules, applied mechanically: four spaces per level and never
tabs, opening brace on the same line as the statement it belongs to, closing
brace on its own line followed by the instance name, spaces around assignment
and expression operators, no space before the ; that follows a }.
Line breaks between statements are yours. rdlfmt neither forces one
statement per line nor joins them, so grouping you put there on purpose
survives — which is also how the style guide's sw/hw exception is
accommodated without a special case. Note the two registers in the example
above: the first one's properties stay split, the second's stay joined. Runs of
blank lines collapse to one.
There is nothing to configure, deliberately. A formatter earns its value by ending arguments, not by relocating them into a config file.
Comments and preprocessor directives survive. The parser builds a lossless
concrete syntax tree, so every byte of the input is present in the tree —
a `ifdef or a trailing // comment is data to be placed, not noise to be
dropped.
What it will not do
Format a file it did not fully understand. If the input has syntax errors,
rdlfmt reports them and refuses, rather than reformatting a structure it had
to guess at.
Change your code. Every result is verified before it is returned: the output is re-lexed and compared token by token against the input, and if anything but whitespace moved, the output is withheld and you get a bug report instead of a damaged file. That check is what makes rewriting files in place the default.
Library
The formatter is also a library:
let formatted = rdlfmt::format(source)?;
rdlfmt::syntax exposes the lexer and the CST underneath, if you want the tree
rather than the text. Turn off default features to drop the CLI dependencies.
License
Dual-licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 rdlfmt-0.1.0.tar.gz.
File metadata
- Download URL: rdlfmt-0.1.0.tar.gz
- Upload date:
- Size: 75.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
619f82ca63efc25836e846d9071af739994dbe08583e4fa2d24b8d3bf0876ca8
|
|
| MD5 |
ec54764498fd70431d2c90287c490496
|
|
| BLAKE2b-256 |
ad24f851ce95855f851fa3d666eeee4d54fd71c4626ccf129821646bb16417bc
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0.tar.gz -
Subject digest:
619f82ca63efc25836e846d9071af739994dbe08583e4fa2d24b8d3bf0876ca8 - Sigstore transparency entry: 2492185390
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rdlfmt-0.1.0-py3-none-win_amd64.whl.
File metadata
- Download URL: rdlfmt-0.1.0-py3-none-win_amd64.whl
- Upload date:
- Size: 403.8 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72dcf33363da6f5e66b60f4c63a1ad8579e9bff5257d2463aa2786441d09e7f5
|
|
| MD5 |
c09e7e980a92cb72ad289f906a5d9e93
|
|
| BLAKE2b-256 |
28e404a0b3904921a56206c264f22fb0e031d11cf4de91fd5163ed9878a73c07
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0-py3-none-win_amd64.whl:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0-py3-none-win_amd64.whl -
Subject digest:
72dcf33363da6f5e66b60f4c63a1ad8579e9bff5257d2463aa2786441d09e7f5 - Sigstore transparency entry: 2492186738
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rdlfmt-0.1.0-py3-none-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: rdlfmt-0.1.0-py3-none-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 678.5 kB
- Tags: Python 3, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1620442ae0ec2a4731aaa9643841e1bb4265a67021f0d9107c42080abf3e09b8
|
|
| MD5 |
7f1c80760f21c880bea9329b7f238c09
|
|
| BLAKE2b-256 |
6b6bcc9ed770da8558538b5352c7c8f5f52e184ef1a2f77fea25f471aa2dcbf2
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0-py3-none-musllinux_1_2_x86_64.whl:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0-py3-none-musllinux_1_2_x86_64.whl -
Subject digest:
1620442ae0ec2a4731aaa9643841e1bb4265a67021f0d9107c42080abf3e09b8 - Sigstore transparency entry: 2492185939
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rdlfmt-0.1.0-py3-none-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: rdlfmt-0.1.0-py3-none-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 659.2 kB
- Tags: Python 3, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daef16256b902cdc10c2b4da90d15953c468e235535020f03346d20829d9bcfb
|
|
| MD5 |
5a2a33520169a1136a35c2764a543ce1
|
|
| BLAKE2b-256 |
fc0ee572fc41a682514bc363d500210e8096a92238928b42c9d83397e63fd792
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0-py3-none-musllinux_1_2_aarch64.whl:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0-py3-none-musllinux_1_2_aarch64.whl -
Subject digest:
daef16256b902cdc10c2b4da90d15953c468e235535020f03346d20829d9bcfb - Sigstore transparency entry: 2492186994
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rdlfmt-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rdlfmt-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 627.2 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
147fd91587e7082f4f5914294cdca8dae89434f53d4b9a39a8d2880b4bc588da
|
|
| MD5 |
f01bff6b48605416ea48c363c571099e
|
|
| BLAKE2b-256 |
6db7dde64e97976dec9829625faad2b29351c208669e1075c7fd3263e5b71cea
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
147fd91587e7082f4f5914294cdca8dae89434f53d4b9a39a8d2880b4bc588da - Sigstore transparency entry: 2492186464
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rdlfmt-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: rdlfmt-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 607.3 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f69ced2914fa24b1a7c7818faf5b4206291b4272795dd73050a567413aa8ca3d
|
|
| MD5 |
f6745674a812a2e99a8c9acdc6e668f3
|
|
| BLAKE2b-256 |
5fe640e5789487831c5c35a85fedfff21a8fd7ed162bd31c4c7ec35a7c6250fa
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
f69ced2914fa24b1a7c7818faf5b4206291b4272795dd73050a567413aa8ca3d - Sigstore transparency entry: 2492186252
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rdlfmt-0.1.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: rdlfmt-0.1.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 567.7 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ec8ad090a38af9bc6e237aaa1ca60b203e1b9af79b27db25b785267674c91e3
|
|
| MD5 |
352bf65e245b167c984a058b249f76c4
|
|
| BLAKE2b-256 |
ee009056646ca4641b60f16957163930a7775fa910577ae915f8ad0824e3f6a1
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
6ec8ad090a38af9bc6e237aaa1ca60b203e1b9af79b27db25b785267674c91e3 - Sigstore transparency entry: 2492187319
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rdlfmt-0.1.0-py3-none-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rdlfmt-0.1.0-py3-none-macosx_10_12_x86_64.whl
- Upload date:
- Size: 581.8 kB
- Tags: Python 3, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3876ff66f1c24440a085c274042bda062e6078e5752790018684959af55231aa
|
|
| MD5 |
6b2fd9c8aa7b1c988d08ec87607e31dc
|
|
| BLAKE2b-256 |
208951559318829997731aa34df8a57cee990b408e4a8cabcdf077360811af67
|
Provenance
The following attestation bundles were made for rdlfmt-0.1.0-py3-none-macosx_10_12_x86_64.whl:
Publisher:
publish-pypi.yml on fischeti/rdlfmt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rdlfmt-0.1.0-py3-none-macosx_10_12_x86_64.whl -
Subject digest:
3876ff66f1c24440a085c274042bda062e6078e5752790018684959af55231aa - Sigstore transparency entry: 2492187656
- Sigstore integration time:
-
Permalink:
fischeti/rdlfmt@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fischeti
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@ac2ccf77f3fcd03e863ffc88087e15f429312888 -
Trigger Event:
push
-
Statement type: