PySysC
Public repository for PySysC, (From SC Common Practices Subgroup)
Install / Use
/learn @accellera-official/PySysCREADME
PySysC
A Python package to make SystemC usable from Python. It supports composition of a SystemC/TLM model as well as running the simulation. As of version 0.2 it also allows to run Python functions as part of an SC_THREAD.
How to setup the environment
The installation for PySysC is as follows (using bash shell). The process has been tested under CentOS7 and Ubuntu 20.04. Make sure a newer version of gcc is in your path (tested with gcc-6.3.0). Also the SystemC installation has to be reference with the environment variable SYSTEMC_HOME.
If you get an error complaining about missing Python.h, you need to install Python development headers. See the articel under https://blog.ducthinh.net/gcc-no-such-file-python-h.
# create virtual environment
python3 -m venv pysysc-env
# and avtivate it
. pysysc-env/bin/activate
# update pip to mekae sure we have the newest version
python3 -m pip install --upgrade pip
# install wheel package
python3 -m pip install wheel
# install cppyy, C++ std version needs to match the version used when building the SystemC library
STDCXX=11 python3 -m pip install cppyy
# clone of PySysC
git clone https://git.minres.com/SystemC/PySysC.git
# install PySysC, for development PySysC use 'python3 -m pip install -e`
SYSTEMC_HOME=<path to SystemC> python3 -m pip install PySysC
Running the example
To run the example you need to clone and build the PySysC-SC repo. It contains the code and libraries being used in the example. This project uses Conan.io as package manager so it should be installed (see down below).
To deactivate conan and use a SystemC installation just comment out the line setup_conan() in CMakeLists.txt and set the environment variable SYSTEMC_HOME.
Run the router_eample.py
# get the PySysC-SC repo
git clone --recursive https://git.minres.com/SystemC/PySysC-SC.git
# build the project libraries as shared libs
cd PySysC-SC
mkdir -p build/Debug
cd build/Debug
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON ../..
make -j components
cd ../..
# now we are ready to run the example
python3 router_eample.py
Installing conan separately
To install conan being used during cmake and build the example project without PySysC you need to execute the following steps:
# install conan into our virtual environment pysysc-env
python3 -m pip install conan
# create the default profile
conan profile new default --detect
# add the repo for SystemC packages used in the project
conan remote add minres https://api.bintray.com/conan/minres/conan-repo
TODO
- pythonize
sc_modulewith iteration protocol (__next__andStopIterationexception) - add support for SC_METHOD
Related Skills
node-connect
336.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
82.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
82.8kCommit, push, and open a PR
