netlist-carpentry 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netlist_carpentry-0.1.0/.gitattributes +3 -0
- netlist_carpentry-0.1.0/.github/workflows/deploy-pages.yml +37 -0
- netlist_carpentry-0.1.0/.github/workflows/publish.yml +34 -0
- netlist_carpentry-0.1.0/.github/workflows/test.yml +16 -0
- netlist_carpentry-0.1.0/.gitignore +35 -0
- netlist_carpentry-0.1.0/.python-version +1 -0
- netlist_carpentry-0.1.0/LICENSE +11 -0
- netlist_carpentry-0.1.0/PKG-INFO +86 -0
- netlist_carpentry-0.1.0/README.md +58 -0
- netlist_carpentry-0.1.0/docs/scripts/gen_ref_pages.py +70 -0
- netlist_carpentry-0.1.0/docs/src/assets/cascading_ors.png +0 -0
- netlist_carpentry-0.1.0/docs/src/assets/logo.svg +18 -0
- netlist_carpentry-0.1.0/docs/src/assets/or_example.png +0 -0
- netlist_carpentry-0.1.0/docs/src/assets/tool_workflow_nc.png +0 -0
- netlist_carpentry-0.1.0/docs/src/index.md +1 -0
- netlist_carpentry-0.1.0/docs/src/stylesheets/extra.css +11 -0
- netlist_carpentry-0.1.0/docs/src/stylesheets/mkdocstrings.css +91 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/01_getting_started.ipynb +320 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/02_access_circuit_data.ipynb +564 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/03_circuit_search.ipynb +404 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/04_circuit_modification.ipynb +501 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/05_module_graphs.ipynb +183 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/06_graph_visualization.ipynb +414 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/07_pattern_matching.ipynb +146 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/08_pattern_replacement.ipynb +172 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/09_equivalence_checking.ipynb +179 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/10_custom_search_and_replace.ipynb +347 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/11_custom_search_and_replace_advanced.ipynb +387 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/decentral_mux.v +55 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/eqy/example_script.eqy +18 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/eqy/generated_eqy_script.eqy +13 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/openMSP430/clock_gating/clock_gate.v +53 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/openMSP430/pmux2mux_techmap.v +22 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/or_pattern_find.v +28 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/or_pattern_replace.v +21 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/simpleAdder.v +31 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/files/simple_clock_gate.v +26 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/general_information.md +13 -0
- netlist_carpentry-0.1.0/docs/src/user_guide/installation.md +11 -0
- netlist_carpentry-0.1.0/docs/templates/python/material/module.html.jinja +15 -0
- netlist_carpentry-0.1.0/mkdocs.yml +193 -0
- netlist_carpentry-0.1.0/netlist_carpentry.png +0 -0
- netlist_carpentry-0.1.0/pyproject.toml +158 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/__init__.py +67 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/read/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/read/_abstract_reader.py +12 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/read/gen_nl.py +29 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/read/read_utils.py +81 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/read/yosys_netlist.py +452 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/read/yosys_netlist_types.py +51 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/write/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/write/py2v.py +482 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/api/write/write_utils.py +14 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/circuit.py +506 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/exceptions.py +80 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/graph/__init__.py +5 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/graph/constraint.py +31 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/graph/match.py +308 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/graph/pattern.py +834 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/graph/pattern_generator.py +207 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/graph/utils.py +26 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/graph/visualization.py +102 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/element_path.py +415 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/element_type.py +86 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/instance.py +573 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/mixins/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/mixins/evaluation.py +98 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/mixins/graph_building.py +81 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/mixins/metadata.py +163 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/mixins/module_base.py +49 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/mixins/module_bfs.py +141 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/mixins/module_dfs.py +98 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/module.py +1198 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/netlist_element.py +311 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/port.py +692 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/port_segment.py +450 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/segment_base.py +54 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/wire.py +584 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/netlist_elements/wire_segment.py +492 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/opt/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/opt/constant_folds.py +77 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/opt/driverless_instances.py +65 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/opt/loadless_wires.py +83 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/port_direction.py +68 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/protocols/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/protocols/base_types.py +37 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/protocols/netlist_elements.py +305 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/protocols/signals.py +88 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/core/signal.py +290 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/py.typed +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/__init__.py +3 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/cascading_or_replacement.py +47 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/eqy.sh +9 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/eqy_check.py +95 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/eqy_proc.sh +13 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/hdl/pmux2mux.v +22 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/script_builder.py +88 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/scripts/verilogToJsonSimple.sh +27 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/__init__.py +0 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/_gate_lib_base.py +658 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/cfg.py +44 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/custom_dict.py +91 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/custom_list.py +68 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/gate_lib.py +1628 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/gate_lib_factory.py +419 -0
- netlist_carpentry-0.1.0/src/netlist_carpentry/utils/log.py +319 -0
- netlist_carpentry-0.1.0/stubs/.gitkeep +0 -0
- netlist_carpentry-0.1.0/tests/api_tests/__init__.py +0 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_abstract_read.py +20 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_gen_nl.py +24 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_read_utils.py +57 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_read_yosys_netlist.py +626 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_read_yosys_netlist_examples.py +103 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_write_py2v.py +292 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_write_py2v_examples.py +86 -0
- netlist_carpentry-0.1.0/tests/api_tests/test_write_utils.py +31 -0
- netlist_carpentry-0.1.0/tests/conftest.py +10 -0
- netlist_carpentry-0.1.0/tests/files/adderWrapper.v +35 -0
- netlist_carpentry-0.1.0/tests/files/ctr_async.v +69 -0
- netlist_carpentry-0.1.0/tests/files/dec.v +85 -0
- netlist_carpentry-0.1.0/tests/files/decentral_mux.v +69 -0
- netlist_carpentry-0.1.0/tests/files/edge_detector.v +150 -0
- netlist_carpentry-0.1.0/tests/files/hierarchicalAdder.v +15 -0
- netlist_carpentry-0.1.0/tests/files/nl_gen.py +16 -0
- netlist_carpentry-0.1.0/tests/files/or_pattern_find.v +40 -0
- netlist_carpentry-0.1.0/tests/files/or_pattern_replace.v +33 -0
- netlist_carpentry-0.1.0/tests/files/pmux2mux.v +32 -0
- netlist_carpentry-0.1.0/tests/files/signed_example.v +10 -0
- netlist_carpentry-0.1.0/tests/files/simpleAdder.v +36 -0
- netlist_carpentry-0.1.0/tests/files/simple_or_structure.v +48 -0
- netlist_carpentry-0.1.0/tests/files/thermo_enc.v +38 -0
- netlist_carpentry-0.1.0/tests/mixins/__init__.py +0 -0
- netlist_carpentry-0.1.0/tests/mixins/test_dfs_bfs_mixin.py +25 -0
- netlist_carpentry-0.1.0/tests/mixins/test_evaluation.py +31 -0
- netlist_carpentry-0.1.0/tests/mixins/test_meta_data.py +113 -0
- netlist_carpentry-0.1.0/tests/mixins/test_module_base.py +25 -0
- netlist_carpentry-0.1.0/tests/mixins/test_module_graph_mixin.py +19 -0
- netlist_carpentry-0.1.0/tests/test_circuit.py +528 -0
- netlist_carpentry-0.1.0/tests/test_constraint.py +28 -0
- netlist_carpentry-0.1.0/tests/test_custom_dict.py +81 -0
- netlist_carpentry-0.1.0/tests/test_custom_list.py +71 -0
- netlist_carpentry-0.1.0/tests/test_element_path.py +245 -0
- netlist_carpentry-0.1.0/tests/test_element_type.py +65 -0
- netlist_carpentry-0.1.0/tests/test_eqy.py +129 -0
- netlist_carpentry-0.1.0/tests/test_gate_lib.py +2070 -0
- netlist_carpentry-0.1.0/tests/test_gate_lib_factory.py +579 -0
- netlist_carpentry-0.1.0/tests/test_instance.py +495 -0
- netlist_carpentry-0.1.0/tests/test_log.py +266 -0
- netlist_carpentry-0.1.0/tests/test_match.py +110 -0
- netlist_carpentry-0.1.0/tests/test_module.py +1605 -0
- netlist_carpentry-0.1.0/tests/test_netlist_element.py +213 -0
- netlist_carpentry-0.1.0/tests/test_opt_constant_folds.py +87 -0
- netlist_carpentry-0.1.0/tests/test_opt_driverless_instances.py +93 -0
- netlist_carpentry-0.1.0/tests/test_opt_loadless_wires.py +71 -0
- netlist_carpentry-0.1.0/tests/test_pattern.py +478 -0
- netlist_carpentry-0.1.0/tests/test_pattern_examples.py +123 -0
- netlist_carpentry-0.1.0/tests/test_port.py +636 -0
- netlist_carpentry-0.1.0/tests/test_port_direction.py +45 -0
- netlist_carpentry-0.1.0/tests/test_port_segment.py +356 -0
- netlist_carpentry-0.1.0/tests/test_script_builder.py +66 -0
- netlist_carpentry-0.1.0/tests/test_segment_base.py +35 -0
- netlist_carpentry-0.1.0/tests/test_signal.py +168 -0
- netlist_carpentry-0.1.0/tests/test_visualization.py +84 -0
- netlist_carpentry-0.1.0/tests/test_wire.py +575 -0
- netlist_carpentry-0.1.0/tests/test_wire_segment.py +397 -0
- netlist_carpentry-0.1.0/tests/utils.py +292 -0
- netlist_carpentry-0.1.0/tox.ini +42 -0
- netlist_carpentry-0.1.0/uv.lock +3787 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Build and deploy pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build-and-deploy:
|
|
13
|
+
name: Build and deploy pages
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
permissions:
|
|
17
|
+
pages: write
|
|
18
|
+
id-token: write
|
|
19
|
+
|
|
20
|
+
environment:
|
|
21
|
+
name: github-pages
|
|
22
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- run: sudo apt-get -y update
|
|
27
|
+
- run: sudo apt-get -y install curl git build-essential yosys yosys-dev
|
|
28
|
+
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
29
|
+
- run: echo PATH=${GITHUB_WORKSPACE}/.local/bin:$PATH >> $GITHUB_ENV
|
|
30
|
+
- run: uv run mkdocs build --site-dir site
|
|
31
|
+
- name: Upload to GitHub Pages
|
|
32
|
+
uses: actions/upload-pages-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
path: site
|
|
35
|
+
|
|
36
|
+
- name: Deploy to GitHub Pages
|
|
37
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Refer to https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi for setup
|
|
2
|
+
|
|
3
|
+
name: Publish
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
workflow_run:
|
|
7
|
+
workflows:
|
|
8
|
+
- "Run Tests"
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
types:
|
|
12
|
+
- completed
|
|
13
|
+
tags:
|
|
14
|
+
- v*
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
Publish:
|
|
18
|
+
name: Publish on Pypi
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
environment:
|
|
21
|
+
name: pypi
|
|
22
|
+
permissions:
|
|
23
|
+
id-token: write
|
|
24
|
+
contents: read
|
|
25
|
+
|
|
26
|
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
- uses: astral-sh/setup-uv@v6
|
|
31
|
+
- name: Build Project
|
|
32
|
+
run: uv build
|
|
33
|
+
- name: Publish on Pypi
|
|
34
|
+
run: uv publish
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Run Tests
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test:
|
|
7
|
+
name: Run Tests
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- run: sudo apt-get -y update
|
|
13
|
+
- run: sudo apt-get -y install curl git build-essential yosys yosys-dev
|
|
14
|
+
- run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
15
|
+
- run: echo PATH=${GITHUB_WORKSPACE}/.local/bin:$PATH >> $GITHUB_ENV
|
|
16
|
+
- run: uv run tox
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.cache
|
|
2
|
+
.mypy_cache
|
|
3
|
+
.pytest_cache
|
|
4
|
+
.ruff_cache
|
|
5
|
+
.tox
|
|
6
|
+
.venv
|
|
7
|
+
__pycache__
|
|
8
|
+
build
|
|
9
|
+
dist
|
|
10
|
+
reports
|
|
11
|
+
wheels
|
|
12
|
+
docs/site
|
|
13
|
+
.coverage*
|
|
14
|
+
*.py[ocd]
|
|
15
|
+
*.egg-info
|
|
16
|
+
|
|
17
|
+
*.log
|
|
18
|
+
tests/files/gen*
|
|
19
|
+
.VSCodeCounter
|
|
20
|
+
*txt
|
|
21
|
+
xrun
|
|
22
|
+
*.il
|
|
23
|
+
*.ys
|
|
24
|
+
*.ids
|
|
25
|
+
cov_dir
|
|
26
|
+
xcelium.d
|
|
27
|
+
xrun.history
|
|
28
|
+
*.json
|
|
29
|
+
output
|
|
30
|
+
public
|
|
31
|
+
local_files
|
|
32
|
+
*.zip
|
|
33
|
+
|
|
34
|
+
# ignore all files/dirs under any "eqy/out" chain
|
|
35
|
+
**/eqy/out/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2025 Institut für Mikroelektronik- und Mechatronik-Systeme gemeinnützige GmbH (IMMS GmbH)
|
|
2
|
+
|
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
4
|
+
|
|
5
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
6
|
+
|
|
7
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
8
|
+
|
|
9
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
10
|
+
|
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netlist-carpentry
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A library for netlist modification and analysis
|
|
5
|
+
Project-URL: Homepage, https://github.com/IMMS-Ilmenau/netlist-carpentry
|
|
6
|
+
Project-URL: Documentation, https://IMMS-Ilmenau.github.io/netlist-carpentry
|
|
7
|
+
Author: Manuel Jirsak
|
|
8
|
+
Maintainer-email: Georg Gläser <georg.glaeser@imms.de>
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Requires-Dist: click>=8.1.8
|
|
12
|
+
Requires-Dist: ipykernel>=6.29.5
|
|
13
|
+
Requires-Dist: mako>=1.3.10
|
|
14
|
+
Requires-Dist: matplotlib>=3.9.4
|
|
15
|
+
Requires-Dist: mkdocs-jupyter>=0.25.1
|
|
16
|
+
Requires-Dist: networkx>=3.2.1
|
|
17
|
+
Requires-Dist: pydantic>=2.10.6
|
|
18
|
+
Requires-Dist: rich>=13.9.4
|
|
19
|
+
Requires-Dist: scipy>=1.13.1
|
|
20
|
+
Requires-Dist: tqdm>=4.67.1
|
|
21
|
+
Requires-Dist: types-tqdm>=4.67.0.20250516
|
|
22
|
+
Requires-Dist: z3-solver>=4.15.0.0
|
|
23
|
+
Requires-Dist: z3>=0.2.0
|
|
24
|
+
Provides-Extra: type-stubs
|
|
25
|
+
Requires-Dist: pytest-stub; extra == 'type-stubs'
|
|
26
|
+
Requires-Dist: types-networkx; extra == 'type-stubs'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Netlist Carpentry
|
|
30
|
+
|
|
31
|
+
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:
|
|
32
|
+
|
|
33
|
+
* Navigate through your circuit and introduce custom checks
|
|
34
|
+
* Create a new algorithm that does some new optimization with your circuit
|
|
35
|
+
* ...
|
|
36
|
+
|
|
37
|
+
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.
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
Back in verilog, the most simulation or synthesis tools can be used.
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
```python
|
|
44
|
+
import netlist_carpentry
|
|
45
|
+
|
|
46
|
+
# Load your Circuit
|
|
47
|
+
circuit = netlist_carpentry.read("simpleAdder.v")
|
|
48
|
+
# Define your top module
|
|
49
|
+
circuit.set_top('simpleAdder')
|
|
50
|
+
|
|
51
|
+
print(f"The top module '{top_module.name}' has the following items:")
|
|
52
|
+
for instance_name, instance_object in top_module.instances.items():
|
|
53
|
+
print(f"\tInstance '{instance_name}'.")
|
|
54
|
+
|
|
55
|
+
for port_name, port_object in top_module.ports.items():
|
|
56
|
+
print(f"\tPort '{port_name}', which is an {port_object.direction} port and {port_object.width} bit wide!")
|
|
57
|
+
|
|
58
|
+
for wire_name, wire_object in top_module.wires.items():
|
|
59
|
+
print(f"\tWire '{wire_name}', which is {wire_object.width} bit wide!")
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
Install the package via...
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install netlist-carpentry
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
... and have fun!
|
|
74
|
+
|
|
75
|
+
The package requires at least Python 3.9.
|
|
76
|
+
|
|
77
|
+
Alternatively, you can clone this repository and install the package in editable mode.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Examples
|
|
81
|
+
The examples are located in `docs/src/user_guide` along with the documentation.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
## Acknowledgement
|
|
85
|
+
|
|
86
|
+
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.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Netlist Carpentry
|
|
2
|
+
|
|
3
|
+
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:
|
|
4
|
+
|
|
5
|
+
* Navigate through your circuit and introduce custom checks
|
|
6
|
+
* Create a new algorithm that does some new optimization with your circuit
|
|
7
|
+
* ...
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
Back in verilog, the most simulation or synthesis tools can be used.
|
|
13
|
+
|
|
14
|
+
Example:
|
|
15
|
+
```python
|
|
16
|
+
import netlist_carpentry
|
|
17
|
+
|
|
18
|
+
# Load your Circuit
|
|
19
|
+
circuit = netlist_carpentry.read("simpleAdder.v")
|
|
20
|
+
# Define your top module
|
|
21
|
+
circuit.set_top('simpleAdder')
|
|
22
|
+
|
|
23
|
+
print(f"The top module '{top_module.name}' has the following items:")
|
|
24
|
+
for instance_name, instance_object in top_module.instances.items():
|
|
25
|
+
print(f"\tInstance '{instance_name}'.")
|
|
26
|
+
|
|
27
|
+
for port_name, port_object in top_module.ports.items():
|
|
28
|
+
print(f"\tPort '{port_name}', which is an {port_object.direction} port and {port_object.width} bit wide!")
|
|
29
|
+
|
|
30
|
+
for wire_name, wire_object in top_module.wires.items():
|
|
31
|
+
print(f"\tWire '{wire_name}', which is {wire_object.width} bit wide!")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
Install the package via...
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install netlist-carpentry
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
... and have fun!
|
|
46
|
+
|
|
47
|
+
The package requires at least Python 3.9.
|
|
48
|
+
|
|
49
|
+
Alternatively, you can clone this repository and install the package in editable mode.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Examples
|
|
53
|
+
The examples are located in `docs/src/user_guide` along with the documentation.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Acknowledgement
|
|
57
|
+
|
|
58
|
+
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.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Generate the code reference pages."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Sequence
|
|
5
|
+
|
|
6
|
+
import mkdocs_gen_files
|
|
7
|
+
|
|
8
|
+
INIT_TEMPLATE = """
|
|
9
|
+
::: {identifier}
|
|
10
|
+
options:
|
|
11
|
+
members: [{members}]
|
|
12
|
+
members_order: alphabetical
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def find_submodules(dir: Path) -> Sequence[str]:
|
|
17
|
+
"""Find submodules within a directory."""
|
|
18
|
+
submodules = []
|
|
19
|
+
for path in dir.iterdir():
|
|
20
|
+
if path.is_dir():
|
|
21
|
+
if (path / '__init__.py').exists():
|
|
22
|
+
submodules.append(path.name)
|
|
23
|
+
elif path.suffix == '.py' and path.stem != '__init__':
|
|
24
|
+
submodules.append(path.stem)
|
|
25
|
+
return sorted(submodules)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def gen_ref_pages():
|
|
29
|
+
nav = mkdocs_gen_files.Nav()
|
|
30
|
+
mod_symbol = '<code class="doc-symbol doc-symbol-nav doc-symbol-module"></code>'
|
|
31
|
+
|
|
32
|
+
root = Path(__file__).parent.parent.parent
|
|
33
|
+
src = root / 'src'
|
|
34
|
+
|
|
35
|
+
for path in sorted(src.rglob('*.py')):
|
|
36
|
+
# Skip Python files that are not in a module
|
|
37
|
+
if not (path.parent / '__init__.py').exists():
|
|
38
|
+
continue
|
|
39
|
+
|
|
40
|
+
module_path = path.relative_to(src).with_suffix('')
|
|
41
|
+
doc_path = path.relative_to(src).with_suffix('.md')
|
|
42
|
+
full_doc_path = Path('reference', doc_path)
|
|
43
|
+
|
|
44
|
+
parts = tuple(module_path.parts)
|
|
45
|
+
|
|
46
|
+
if isInit := parts[-1] == '__init__':
|
|
47
|
+
parts = parts[:-1]
|
|
48
|
+
doc_path = doc_path.with_name('index.md')
|
|
49
|
+
full_doc_path = full_doc_path.with_name('index.md')
|
|
50
|
+
elif parts[-1] == '__main__':
|
|
51
|
+
continue
|
|
52
|
+
|
|
53
|
+
nav_parts = [f'{mod_symbol} {part}' for part in parts]
|
|
54
|
+
nav[tuple(nav_parts)] = doc_path.as_posix()
|
|
55
|
+
|
|
56
|
+
with mkdocs_gen_files.open(full_doc_path, 'w') as fd:
|
|
57
|
+
identifier = '.'.join(parts)
|
|
58
|
+
if isInit:
|
|
59
|
+
text = INIT_TEMPLATE.format(identifier=identifier, members=','.join(find_submodules(path.parent)))
|
|
60
|
+
else:
|
|
61
|
+
text = f'::: {identifier}\n'
|
|
62
|
+
print(text, file=fd)
|
|
63
|
+
|
|
64
|
+
mkdocs_gen_files.set_edit_path(full_doc_path, Path('../../') / path.relative_to(root))
|
|
65
|
+
|
|
66
|
+
with mkdocs_gen_files.open('reference/summary.nav', 'w') as nav_file:
|
|
67
|
+
nav_file.writelines(nav.build_literate_nav())
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
gen_ref_pages()
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
|
|
2
|
+
<g fill="#FFF">
|
|
3
|
+
<path
|
|
4
|
+
d="M190.53736355 137.3035038c-29.49302134.07918817-52.97070987 24.2345129-53.03816607 53.04727519-.02346302 11.03061878 0 290.5237982 0 290.5237982h20.46855569s-.0146644-274.85333924-.0146644-291.45059308c.07918771-16.78789203 14.40629683-31.68406667 32.0475581-31.67820088 8.93061357.02932895 296.91283897.00586579 296.91283897.00586579V137.3005709h-296.3761223z" />
|
|
5
|
+
<path
|
|
6
|
+
d="M363.45691858 365.2862451c-.0791877-29.49612686-24.23730394-52.9739528-53.0469647-53.0384765-11.03055423-.02639605-290.52503065 0-290.52503065 0v20.46867549s274.8546634-.01759737 291.4518201-.01759737c16.78779377.07918817 31.68094835 14.40638114 31.67801547 32.04774567-.03226166 8.93359873-.00879864 114.52662402-.00879864 114.52662402h20.45095842v-113.9869713z" />
|
|
7
|
+
<path
|
|
8
|
+
d="M144.97217067 78.93888965c-36.30023122 0-65.77272242 29.49026107-65.81084983 65.61766394-.01173151 11.03941747-.00879864 330.61354246-.00879864 330.61354246l20.46855569 5.848193s.01466439-319.92607242.01466439-336.52919205c.04985892-24.38702345 21.1196546-44.92608842 44.89063093-44.90849105 8.94234508.03226185 341.0438545-.15837634 341.0438545-.15837634V78.97115149l-340.59805704-.03226184z" />
|
|
9
|
+
<path
|
|
10
|
+
d="M235.46905478 195.91448115s-15.49439457-.73908959-27.80075073 11.5673386c-12.31222192 12.30936109-11.55260651 27.59267789-11.55260651 27.59267789v242.99916464h20.46855568s-.27569053-226.41070948-.27569053-242.99916464c.0410603-10.35312 8.390964-18.76466339 18.82027824-18.82625418 8.9511437.02932895 246.06553278.13198028 246.06553278.13198028v-20.46867549H235.46905478z" />
|
|
11
|
+
<path
|
|
12
|
+
d="M421.81825825 319.72078553c0-36.30337658-29.49302135-65.77604028-65.61727989-65.81123502-11.03935285-.01173158-330.60867451-.00879869-330.60867451-.00879869l-5.85109165 20.46867549s319.92713278.01759737 336.53015524.01759737c24.38981359.04692632 44.92582547 21.11684532 44.9082282 44.89089368-.03226166 8.94239741.15544253 160.0891507.15544253 160.0891507h20.45095842l.03226166-159.64628353z" />
|
|
13
|
+
<path
|
|
14
|
+
d="M304.5911239 410.32671644s.74201813-15.49155236-11.56727091-27.80091345c-12.30928904-12.31229398-27.58958351-11.55560702-27.58958351-11.55560702H22.43359422v20.46867549s226.40645144-.27569215 242.99774238-.27569215c10.35012653.04106053 18.76162068 8.39101312 18.82321112 18.8203884-.02932878 8.9482632-.13197951 68.95236576-.13197951 68.95236576h20.4656228v-68.60921703z" />
|
|
15
|
+
<path
|
|
16
|
+
d="M98.55057741.00001578C43.79081195-.02638028-.01172124 44.31312911.00001027 98.5188979c.00293288 14.8609799 0 401.48108879 0 401.48108879h499.99997729V.00001578H98.5505774zm360.73519751 459.29431864H41.16295324s.01173152-347.31051474 0-359.6374732C41.1306916 66.8494957 66.98987707 41.2218576 99.64160804 41.17786416h359.64416688v418.11647026z" />
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Netlist Carpentry
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* Custom Symbols */
|
|
2
|
+
code.doc-symbol-parameter::after {
|
|
3
|
+
content: "param";
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
code.doc-symbol-attribute::after {
|
|
7
|
+
content: "attr";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
code.doc-symbol-function::after {
|
|
11
|
+
content: "def";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
code.doc-symbol-method::after {
|
|
15
|
+
content: "def";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
code.doc-symbol-class::after {
|
|
19
|
+
content: "class";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
code.doc-symbol-module::after {
|
|
23
|
+
content: "module";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Additional symbols for YAML models */
|
|
27
|
+
code.doc-symbol-model {
|
|
28
|
+
color: var(--doc-symbol-class-fg-color);
|
|
29
|
+
background-color: var(--doc-symbol-class-bg-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
code.doc-symbol-model::after {
|
|
33
|
+
content: "model";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
code.doc-symbol-abstract-model {
|
|
37
|
+
color: var(--doc-symbol-method-fg-color);
|
|
38
|
+
background-color: var(--doc-symbol-method-bg-color);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
code.doc-symbol-abstract-model::after {
|
|
42
|
+
content: "*model";
|
|
43
|
+
}
|
|
44
|
+
code.doc-symbol-field {
|
|
45
|
+
color: var(--doc-symbol-attribute-fg-color);
|
|
46
|
+
background-color: var(--doc-symbol-attribute-bg-color);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
code.doc-symbol-field::after {
|
|
50
|
+
content: "field";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Abbreviate module symbol on full-width navigation */
|
|
54
|
+
@media screen and (min-width: 76.25em) {
|
|
55
|
+
.md-nav code.doc-symbol-nav.doc-symbol-module::after {
|
|
56
|
+
content: "M";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Indentation. */
|
|
61
|
+
div.doc-contents:not(.first) {
|
|
62
|
+
padding-left: 25px;
|
|
63
|
+
border-left: .05rem solid var(--md-typeset-table-color);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Allow module name to wrap */
|
|
67
|
+
doc-module-name {
|
|
68
|
+
overflow-wrap: break-word;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Mark external links as such. */
|
|
72
|
+
a.external::after,
|
|
73
|
+
a.autorefs-external::after {
|
|
74
|
+
/* https://primer.style/octicons/arrow-up-right-24 */
|
|
75
|
+
mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
|
|
76
|
+
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
|
|
77
|
+
content: ' ';
|
|
78
|
+
|
|
79
|
+
display: inline-block;
|
|
80
|
+
vertical-align: middle;
|
|
81
|
+
position: relative;
|
|
82
|
+
|
|
83
|
+
height: 1em;
|
|
84
|
+
width: 1em;
|
|
85
|
+
background-color: currentColor;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
a.external:hover::after,
|
|
89
|
+
a.autorefs-external:hover::after {
|
|
90
|
+
background-color: var(--md-accent-fg-color);
|
|
91
|
+
}
|