Skip to main content

hdl-vet

hdl-vet applies scripted, repeatable and verified edits to generated SystemVerilog.

What it does

A generator writes your SystemVerilog. You need a few changes in its output, for example a new port on the top module. If you edit the generated files by hand, the next run of the generator removes your edits.

hdl-vet keeps the edits in a script. A script is a short Python file. When the generator runs again, you run the same script on the new files and you get the same edits.

hdl-vet never changes the input tree. The input tree is the folder that holds the design as the generator wrote it. hdl-vet writes the output tree, which is a copy of the input tree with your edits. Text that no operation edits stays byte-identical in the output tree. hdl-vet adds one comment line to each file that it changes.

Three protections stop a wrong edit:

  • An operation refuses a design that it cannot edit safely. The exit status is 2 and hdl-vet writes nothing.
  • The argument was of an operation says what the design shows now. If the design shows something else, hdl-vet stops the run and writes nothing. The exit status is 2.
  • After the last script, hdl-vet checks the result. This check is the sign-off. It loads the edited design with the slang compiler and compares it with the design that you started from. If the sign-off fails, the exit status is 1 and hdl-vet writes no output tree.

The sign-off fails in these cases:

  • The design shows a change that no operation declared.
  • The compiler reports a new error or warning.
  • A signal has no driver now, and something reads it.
  • The edited design reads a file that the original design did not read.
  • A change that an operation must cause is not in the design.
  • A later edit undid the result of an operation.

Status

This is an early version. These parts work today:

  • operations on ports, parameters, wires, assign statements and connections
  • operations that act through the hierarchy, such as a new port on every module along a path
  • the replacement of the module of an instance, and the removal of instances, ports, parameters, wires and assign statements
  • a project file, hdl-vet.toml, that names the design, the scripts and the output folder
  • saved sessions that you can resume later
  • scopes that limit an operation to one part of the design

No operation changes logic, for example an assign statement. There is no equivalence check.

The sign-off does not see these changes:

  • a change of logic that you make with a raw edit of the text, which is Vet.splice
  • a change of the delay or the strength of a gate primitive
  • a signal that loses the driver of only some of its bits

The operations refuse these things:

  • instances in generate blocks, in instance arrays, or from a macro
  • positional connections and .* connections
  • a module with a port list that is not in the ANSI style
  • a port list or a parameter list that holds a conditional compilation directive

The chapter "Limits and known problems" of the manual lists the rest.

Install

hdl-vet needs Python 3.11 or newer. It has one dependency, pyslang, and the installer fetches it. You install hdl-vet from a clone of this repository. Use a virtual environment.

git clone https://github.com/hdl-tools/hdl-vet.git
cd hdl-vet
python -m venv .venv
. .venv/bin/activate
pip install .
python -m hdl_vet --version

These commands are for a POSIX shell. On Windows, run .venv\Scripts\activate in place of the fourth line. If you use uv, run uv venv. Activate the environment as above. Then run uv pip install ..

A first run

The example design of the manual has four source files. Copy it to a scratch folder. Work in that folder, so that the clone stays clean.

cp -r docs/manual/examples /tmp/vet-examples
cd /tmp/vet-examples

These commands are for a POSIX shell. In PowerShell, use another folder in place of /tmp. Chapter 3 of the manual shows the PowerShell commands.

This script adds the input port test_en_i to soc_top. It connects the port to the instance u_rst_sync, in place of the constant 1'b0. The argument was says what hdl-vet must find there now. If the design shows something else, hdl-vet stops the run and writes nothing. The exit status is 2.

def apply(vet):
    top = vet.module("soc_top")
    top.add_port("test_en_i", "input")
    top.instance("u_rst_sync").connect("test_i", "test_en_i", was="1'b0")

Make a project. Then put the script in it. The starter script of the project changes nothing, and the second command replaces it.

$ vet init myproj -f design/design.f --top soc_top
created myproj
wrote hdl-vet.toml
wrote scripts/01_example.py
wrote cells/README.md
wrote README.md
wrote .gitignore
$ cp scripts/first.py myproj/scripts/01_example.py

Enter the project. Then run the script with --dry-run. The command writes no output tree. Look at the diff and at the last line, which counts the operations.

$ cd myproj
$ vet apply --dry-run
project: <examples>/myproj/hdl-vet.toml
--- a/rtl/soc_top.sv
+++ b/rtl/soc_top.sv
@@ -1,4 +1,5 @@
 // Generated by a generator. Do not edit.
+// Modified by hdl-vet; scripts: 01_example.py sha256:1ed8008abb9a

 module soc_top (
   input  logic       clk_i,
@@ -6,7 +7,8 @@
   input  logic [1:0] en_i,
   output logic [7:0] count0_o,
   output logic [7:0] count1_o,
-  output logic       irq_o
+  output logic       irq_o,
+  input  logic test_en_i
 );
   logic       rst_sync_n;
   logic [1:0] irq;
@@ -14,7 +16,7 @@
   rst_sync #(.STAGES(2)) u_rst_sync (
     .clk_i  (clk_i),
     .rst_ni (rst_ni),
-    .test_i (1'b0),
+    .test_i (test_en_i),
     .rst_no (rst_sync_n)
   );

2 applied, 0 skipped

Run the same command without --dry-run. Look at the line changed rtl/soc_top.sv. It is the only file that changed. The other files of the input tree are copies in the output tree.

$ vet apply
project: <examples>/myproj/hdl-vet.toml
wrote <examples>/myproj/out
2 applied, 0 skipped
changed rtl/soc_top.sv

Documentation

The user manual is in docs/manual. It is written in LaTeX. The chapters are in docs/manual/chapters. A test runs every example of the manual.

To get the PDF, download the artifact hdl-vet-manual from a run of the manual workflow. To build it on your machine, run latexmk -pdf hdl-vet.tex in the folder docs/manual.

Contributing

Contributions are welcome. Read CONTRIBUTING.md first. It tells you how to set up, what a pull request must satisfy and how to write.

Licence

hdl-vet is free software under the Apache-2.0 licence. The text is in LICENSE.

Metadata

Release files for hdl-vet 0.1.0

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

Source distribution (sdist)

Source distribution for hdl-vet 0.1.0
File Size Uploaded Provenance Actions
hdl_vet-0.1.0.tar.gz 307.5 kB With provenance Details for hdl_vet-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hdl-vet 0.1.0
File Interpreter ABI Platform Actions
hdl_vet-0.1.0-py3-none-any.whl Python 3 none any Details for hdl_vet-0.1.0-py3-none-any.whl

Total release size: 404.4 kB

Release files / hdl_vet-0.1.0.tar.gz

Download URL hdl_vet-0.1.0.tar.gz
Size 307.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aab61995e671476b72a06f5eb8aaa951c739d48bc11644d2ae04ac03978cd0a1
BLAKE2b-256 checksum
How to use checksums
fcf16c2adc50dd582d2e55bb555dbd6c2f849f945afd478cdbc957c1e05be80f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / hdl_vet-0.1.0-py3-none-any.whl

Download URL hdl_vet-0.1.0-py3-none-any.whl
Size 96.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c182c2e6cb5f6b91b4e900f3a60885947f9f9121aa4c76d9eabf66f41e76bfb
BLAKE2b-256 checksum
How to use checksums
40ddc531776ae66710e02db81c69fc08d3929178af32640ba237757356d48b6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for hdl-vet 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hdl_vet-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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