Skip to main content

py4hw is a library to model, and simulate digital logic circuits. It promotes the use of structural and behavioural design styles to build hardware.

Project description

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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py4hw-2026.1.tar.gz (154.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py4hw-2026.1-py3-none-any.whl (172.0 kB view details)

Uploaded Python 3

File details

Details for the file py4hw-2026.1.tar.gz.

File metadata

  • Download URL: py4hw-2026.1.tar.gz
  • Upload date:
  • Size: 154.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for py4hw-2026.1.tar.gz
Algorithm Hash digest
SHA256 bda9f985a2ec5534f420cc623cbf145d875897882156a687a6878070e5b070c9
MD5 be7b9700690efb01690051a93a61555d
BLAKE2b-256 9fc6281e22bd21b5d5bf04868e6c255b4ff7a1c1bddf94214459513ef67361a8

See more details on using hashes here.

File details

Details for the file py4hw-2026.1-py3-none-any.whl.

File metadata

  • Download URL: py4hw-2026.1-py3-none-any.whl
  • Upload date:
  • Size: 172.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for py4hw-2026.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a8b4df458995b9a3252adbdbb95382c69d5700c5889f44a5d966b45ba1e02a0
MD5 2129022f0e52eaf2c4aff077c66938b8
BLAKE2b-256 5313faa1b70d31b748f4c51addcd0d8c92416544140e6e591517efe6f8f88745

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page