Skip to main content

pysystemc - SystemC python binding using cppyy

pysystemc — Python and SystemC with logic gates in a simulation chip

Category Status
CI/CD 01. PR title 02. CI 03. Release Please 04. Publish
Project GitHub PyPI GitHub tag
Docs Read the Docs
Meta License Stars Forks Contributors
Standards Python SemVer Keep a Changelog Release Please v4

Python bindings for SystemC using cppyy. Write Python testbenches and modules while using the native C++ simulation kernel and on-demand template instantiation. The PyPI distribution is pysystemc; the Python import namespace is amal.eda.systemc.

Project origins

The original idea and initial implementation were hand coded. Development later also began using vibe coding with AI assistance to extend the implementation, tests, and documentation.

Why Python and cppyy?

SystemC provides a C++ simulation kernel, typed channels, and a rich modeling library. Python adds a convenient way to assemble models and experiment with them. You can change stimulus, testbench logic, logging, waveform selection, and model connections in Python, then rerun the simulation without rebuilding the existing C++ model libraries.

cppyy was chosen for its support for C++ templates and runtime features. It makes native C++ classes and templates accessible from Python and allows C++ bridge code to be compiled within the running Python environment. For example, sc_uint[17], sc_biguint[137], and sc_signal[sc_uint[17]] can be requested when a script runs, rather than requiring a binding library with a predefined list of types and widths. Its Cling interpreter compiles the necessary template specializations and bridge code on demand. This still involves compilation, but it happens within the running Python environment instead of a separate C++ build-and-link cycle.

Python modules can register methods and threads with the native SystemC kernel, while existing C++ models continue to execute as C++. This lets a testbench load configuration files, generate parameterized stimulus, inspect results, and use Python analysis tools around the same simulation. SystemC still controls time, delta cycles, and process scheduling; Python callbacks add overhead when the simulation crosses the language boundary.

This flexibility is especially useful during exploration and verification: change a test scenario or a traced signal in a script and rerun it. Changes to the implementation of a compiled C++ model still require rebuilding that model. SystemC's elaboration rules also still apply: most structural connections are made before simulation starts. Dynamic processes can be spawned during a run, but arbitrary structural changes remain constrained by native elaboration rules. Python thread reset and kill preserve scheduler unwind through the guarded wait adapter; see the supported behavior documentation for lifecycle constraints.

Quickstart

Load Python 3.14 and install uv, then run:

make setup
make example-hello-py
make example-counter-py
make test

Setup installs dependencies and builds SystemC 2.3.4 with pthreads. Existing UV_* environment settings are honored. To run the C++ hello example, use make example-hello-cpp.

Use make test-parallel or make coverage-parallel to run tests in two isolated pytest workers. Override the worker count with TEST_WORKERS=4, and select tests with ARGS="tests/test_cli.py tests/test_repl.py". Each simulation still runs in a fresh subprocess; coverage combines data from workers and their child processes.

Detailed setup, validation, and logging instructions are in the documentation.

Examples

Use uv run systemc-py --version for the installed version and uv run systemc-py --help for command help. Start an interactive Python playground with uv run systemc-py repl; it preloads sc_core, sc_dt, TLM, cppyy and the public kernel names. The prompt supports syntax highlighting, tab completion, multiline definitions, line editing and persistent history. Use systemc-py help repl for history options. The Makefile provides make cli, make cli ARGS=version and make repl; both targets forward ARGS for additional command options.

uv run systemc-py run model.py -- --cycles 20 runs a Python model with script arguments.

uv run systemc-cpp run model.cpp -- --cycles 20 compiles native C++ sources and forwards arguments after -- to sc_main. The compatibility script examples/run_sysc_cpp.py uses the same packaged runner.

There are a few C++ and Python examples in examples/ directory.

Some examples adapted from:

For build options, header repair, logging controls, and validation, see the development guide.

References

The CLI also runs as python -m amal.eda.cli; help and version commands do not load the native kernel.

Metadata

Release files for pysystemc 1.1.0

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

Source distribution (sdist)

Source distribution for pysystemc 1.1.0
File Size Uploaded Provenance Actions
pysystemc-1.1.0.tar.gz 179.5 kB With provenance Details for pysystemc-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pysystemc 1.1.0
File Interpreter ABI Platform Actions
pysystemc-1.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details for pysystemc-1.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Total release size: 2.4 MB

Release files / pysystemc-1.1.0.tar.gz

Download URL pysystemc-1.1.0.tar.gz
Size 179.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0ea4e04f02548c053ab19d869cf4ec5e25851b98aa31564d6aff003519508cc1
BLAKE2b-256 checksum
How to use checksums
2f18f0c1314455d2b2df2860bb34f303e018be3869b70c2e3fac2c96555f902d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / pysystemc-1.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL pysystemc-1.1.0-py3-none-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
a83ad5e98de046771220b40ba1cf5b092488c57d9be914ac26deda8d8e71e1f1
BLAKE2b-256 checksum
How to use checksums
1ff40325139f26224a49fd21d53e4f0456494a994e1f3c677cfbd18f4fff8d90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for pysystemc 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pysystemc-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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