Python HDL that simulates and generates Verilog from the same source
Project description
VeriPy
Python HDL that simulates and generates Verilog from the same source.
Write your hardware modules once in Python. VeriPy lets you simulate them natively, emit synthesizable Verilog, and verify that both paths produce identical results — all from a single description.
Quick Example
@module (recommended)
from veripy import module, Input, Output, Register
from veripy.context import comb, posedge
@module
def counter(width=8):
clock = Input()
reset = Input()
enable = Input()
count = Output(width)
cnt = Register(width)
@comb
def drive_output():
count = cnt
@posedge(clock)
def increment():
if reset:
cnt = 0
elif enable:
cnt = cnt + 1
Class-based
from veripy import Module, Input, Output, Register
class Counter(Module):
def __init__(self, width=8):
self.clock = Input()
self.reset = Input()
self.enable = Input()
self.count = Output(width)
self.cnt = Register(width)
super().__init__()
@self.comb
def drive_output():
self.count = self.cnt
@self.posedge(self.clock)
def increment():
if self.reset:
self.cnt = 0
elif self.enable:
self.cnt = self.cnt + 1
Both APIs produce identical simulation results and Verilog output. Use whichever you prefer — @module is more concise, the class-based API gives full control over __init__.
c = counter(width=4) # or Counter(width=4)
c.enable.set(1)
c.reset.set(1)
c.tick()
c.reset.set(0)
for _ in range(5):
c.tick()
print(c.count) # 5
print(c.to_verilog()) # synthesizable Verilog
Installation
Requires Python 3.10+ and Icarus Verilog for build verification and dual-path testing.
pip install -e .
CLI
veripy build <file.py> # emit Verilog (compile-checked via iverilog)
veripy build <file.py> -o out/ # write .v files to a directory
veripy build <file.py> -p width=4 # pass parameters
veripy test [path] [-v] # dual-path test suite
veripy import <file.v> # convert Verilog → VeriPy Python
veripy import rtl/ -o src/ # convert entire project
veripy lint <file.py> # static checks
Features
- Dual-path testing — one test verifies both Python sim and generated Verilog (docs)
- Signal types —
Input,Output,Register,Signal,Mem, bit slicing, concatenation (docs) - Sub-modules — hierarchical composition with automatic port wiring (docs)
- FSM sugar — declarative state machines (docs)
- Formal properties —
assert_always,cover(docs) - Pipelines — explicit stage boundaries with automatic registers (docs)
- Timing constraints — SDC output co-located with logic (docs)
- Interface bundles — reusable signal groups (docs)
- Verilog import — convert existing RTL to VeriPy (docs)
- Lint — undriven outputs, multi-driven signals, missing reset, unused signals, CDC violations (docs)
- CDC primitives —
Synchronizer,AsyncFIFOwith gray-code pointers (docs) - Event-driven simulation —
SimEnginewith proper Verilog scheduling (docs)
Documentation
- Guide —
@moduletutorial: signals, logic blocks, parameters, sub-modules, FSM, pipelines, formal, timing, interfaces - Class-based API — the
Modulebase class for advanced use cases - Signals — signal types, operations, slicing, memory arrays
- Testing — dual-path testing, SimEngine, VCD waveforms
- Verilog — import, export, emission, lint
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 veripy_hdl-0.1.0.tar.gz.
File metadata
- Download URL: veripy_hdl-0.1.0.tar.gz
- Upload date:
- Size: 58.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caeda973eb03b4d4b4aecc7fc718d3646473abd934af2939cab1257be2fea4bb
|
|
| MD5 |
41ef50d9e2f9ebed1fe5994178345c47
|
|
| BLAKE2b-256 |
6e0b89c01ab8c632c4ecaacc69f056e955e0c0808434400338b6e02af457fb29
|
Provenance
The following attestation bundles were made for veripy_hdl-0.1.0.tar.gz:
Publisher:
publish.yml on dannygale/veripy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
veripy_hdl-0.1.0.tar.gz -
Subject digest:
caeda973eb03b4d4b4aecc7fc718d3646473abd934af2939cab1257be2fea4bb - Sigstore transparency entry: 1004461057
- Sigstore integration time:
-
Permalink:
dannygale/veripy@f75bfb69ba642739cb759ea8efc2d9581d87e2b2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dannygale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f75bfb69ba642739cb759ea8efc2d9581d87e2b2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file veripy_hdl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: veripy_hdl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 43.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 |
d9ee4fe40083631a18f954674f37ff39a913ad4ce13d1bd2fc5d460e256c5ef9
|
|
| MD5 |
8734dc273d310345617aa3bf93e62dc5
|
|
| BLAKE2b-256 |
5794c33cb59763c3fa138c8f22649d854aac47182ec8b5ea4a92ced168836252
|
Provenance
The following attestation bundles were made for veripy_hdl-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on dannygale/veripy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
veripy_hdl-0.1.0-py3-none-any.whl -
Subject digest:
d9ee4fe40083631a18f954674f37ff39a913ad4ce13d1bd2fc5d460e256c5ef9 - Sigstore transparency entry: 1004461069
- Sigstore integration time:
-
Permalink:
dannygale/veripy@f75bfb69ba642739cb759ea8efc2d9581d87e2b2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dannygale
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f75bfb69ba642739cb759ea8efc2d9581d87e2b2 -
Trigger Event:
push
-
Statement type: