Skip to main content

A library for netlist modification and analysis

Project description

Netlist Carpentry

Netlist Carpentry is a Python library that allows you to access and modify a digital circuit in an accessible way. It covers the following use cases:

  • Navigate through your circuit and introduce custom checks
  • Create a new algorithm that does some new optimization with your circuit
  • ...

It uses Yosys (https://github.com/YosysHQ/yosys) to get the circuit from a behavioral code and converts it into a pythonic structure along with a networkx graph (https://networkx.org). This allows for using standard graph algorithms on the circuit as well as pretty-printing facilities.

Once in Python, the structure can be examined and modified. Netlist carpentry internally tracks all the changes and lets you write out your modified circuit to Verilog. Back in verilog, the most simulation or synthesis tools can be used.

Example:

import netlist_carpentry

# Load your Circuit
circuit = netlist_carpentry.read("simpleAdder.v")
# Define your top module
circuit.set_top('simpleAdder')

print(f"The top module '{top_module.name}' has the following items:")
for instance_name, instance_object in top_module.instances.items():
    print(f"\tInstance '{instance_name}'.")

for port_name, port_object in top_module.ports.items():
    print(f"\tPort '{port_name}', which is an {port_object.direction} port and {port_object.width} bit wide!")

for wire_name, wire_object in top_module.wires.items():
    print(f"\tWire '{wire_name}', which is {wire_object.width} bit wide!")

Netlist carpentry is designed for making the access to the circuit as easy as possible. The runtime-performance was not always in focus -- so don't expect it to work as fast as a custom-knitted C++ software. If you want to propose changes, please submit an issue or even a pull request.

Installation

Install the package via...

pip install netlist-carpentry

... and have fun!

The package requires at least Python 3.9.

Alternatively, you can clone this repository and install the package in editable mode.

Examples

The examples are located in docs/src/user_guide along with the documentation.

Acknowledgement

The DI-Meta-X project where this software has been developed is funded by the German Federal Ministry of Research, Technology and Space under the reference 16ME0976. Responsibility for the content of this publication lies with the author.

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

netlist_carpentry-0.1.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

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

netlist_carpentry-0.1.0-py3-none-any.whl (150.6 kB view details)

Uploaded Python 3

File details

Details for the file netlist_carpentry-0.1.0.tar.gz.

File metadata

  • Download URL: netlist_carpentry-0.1.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.8

File hashes

Hashes for netlist_carpentry-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2534adfc29c98a8cc4cace8573299ca2615c48c3e6bf7ac2302b43880d9aeee8
MD5 200f667f9cc95ac143981d4c902972aa
BLAKE2b-256 7fa9efc3be33699c15219a8dd1473d7ba26ccd13459bf2ebd1d3e383c3c8521a

See more details on using hashes here.

File details

Details for the file netlist_carpentry-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for netlist_carpentry-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b95e3b90b832392ceeab6d2053d7d71ce4c90afae6f849631c21f48648847629
MD5 588c0007056d650c8d93c34a7a3fb117
BLAKE2b-256 98181c02484610dc1d126c1ed5aa7630bba795d1f0d201e7d8a702c28b177550

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