Skip to content

amal-khailtash/pysystemc

Repository files navigation

pysystemc - SystemC python binding using cppyy

First attempt at taking the advantage of Python dymanic feature to bind and use SystemC library in an equivalent Pythonic way.

A few other implementations try to mix and match the C++ features and implement them in Python with various difficulties and success. cppyy provides a clean interface to expose C++ classes, functions, templates.

Development

To get examples working, run the following commands to install uv, create virtual environment, fetch and compile SystemC 2.3.4 (compiled with C++17 for now).

$ make uv
$ make .venv
$ make uv-sync
$ make setup-systemc

Run a few examples:

# hello cpp version
$ make example-hello-cpp

# hello python version
$ make example-hello-py

# counter cpp version
$ make example-counter-cpp

# counter py version
$ make example-counter-py

Examples

A convient script examples/run_sysc_cpp.py is provided that can run any SystemC C++ code. It reads the source code provided on the command line and calls sc_main(), basically running the SystemC simulation.

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

Some examples adapted from:

References

About

pysystemc - SystemC python binding using cppyy

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published