Skip to main content

py4hw

PyPI version

py4hw is an HDL library based on python to create digital circuits (mainly) following a structural design methodology. It is highly influenced by some principles used in JHDL but using the power of Python.

When people see Python and HDL in the same sentence they automatically associate it with two ideas:

  1. This is an attempt to generate Verilog from Python code with an HLS approach
  2. This will generate terribly inefficient Verilog

The answer to both questions is NO. py4hw is NOT [yet] intended to be a python HLS tool. It actually starts from a bottom-up approach modelling basic logic gates. In fact, you can generate Verilog code at a very fine-grain.

Features

  • Cycle-based Simulation
  • Clear separation of design styles
    • Structural
    • Behavioural
      • Combinational
      • Sequential (RTL)
      • Algorithmic
  • Schematic Rendering
  • Interactive Simulation
  • Verilog Generation (for Structural, Combinational and Sequential design styles)
  • WaveDrom generation
  • Library of predefined circuits
  • Pypi based distribution
  • Jupyter Notebook integration
  • Integration with edalize
  • Support for existing Hardware platforms (Terasic DE0, and DE1SoC so far)

Follow the jump start tutorial in a jypyter notebook! or access the static html version here

Contributing

Contributors are more than welcome :-)

I've identifyied a number of low-effort aspects that should be done

  • change the use of nbwavedrom by wavedrom
  • correct synchronization of wire names and waveforms in WaveformWindow and support for scrolling, zooming and paning.
  • avoid complete redrawing in interactive workbench

..and other high effort tasks

  • improve the place & route algorithm in the schematic viewer
  • collapse interfaces in the schematic viewer
  • support additional hardware platforms
  • transpile algorithmic into RTL

Publications

Cite as

@conference{castells2023streamlining,
  author       = {David Castells-Rufas and Gemma Rotger and David Novo},
  title        = {Streamlining FPGA Circuit Design and Verification with Python and py4hw},
  booktitle    = {XI Southern Programmable Logic Conference},
  year         = 2023,
  month        = mar,
  address      = {San Luis, Argentina},
  doi          = {10.5281/zenodo.8325670}
}

Metadata

Release files for py4hw 2026.4

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

Source distribution (sdist)

Source distribution for py4hw 2026.4
File Size Uploaded
py4hw-2026.4.tar.gz 160.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py4hw 2026.4
File Interpreter ABI Platform
py4hw-2026.4-py3-none-any.whl Python 3 none any Details

Total release size: 332.6 kB

Release files / py4hw-2026.4.tar.gz

Download URL py4hw-2026.4.tar.gz
Size 160.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d044a9dd0c2c49fb928715534a8f5ba99b247a5dde4f5bafdd3ee8dac461c0df
BLAKE2b-256 checksum
How to use checksums
643fda1dd6e459948ec9100ed188944b5ed4768d426e99531c1f53c1380dd5ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / py4hw-2026.4-py3-none-any.whl

Download URL py4hw-2026.4-py3-none-any.whl
Size 172.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a8370923a039c5683d0eb89f5a9c3ede499542e8c2931249e498f5d92fa4928
BLAKE2b-256 checksum
How to use checksums
e7987ecb2f193f4a54eb48998b4abcc2d213300ca53c8c8c246cb65f1f854595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

2026.8

2 release files

2026.7

2 release files

2026.6

2 release files

2026.5

2 release files

This release

2026.4 This release

2 release files

2026.2

2 release files

2025.5

2 release files

2024.3

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

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