Introduction to SystemC and Installation Guide
Introduction
SystemC is a C++ library used for modeling and simulating hardware systems, particularly for digital and mixed-signal designs. It enables high-level architectural exploration, performance evaluasion, and software-hardware co-design without requiring specialized hardware description languages or EDA tools.
Developed by Accellera and released under the Apache 2.0 license, SystemC is open-source and suitable for both academic and commercial use. It supports modular design, cycle-accurate simulation, and transaction-level modeling (TLM), making it ideal for system-level design, aglorithm validation, and reference model generation.
By leveraging C++ libraries, SystemC allows integration with numerical, signal processing, and machine learning frameworks, streamlining algorithm development and system verification.
Installation
Download the SystemC source code from the official Accellera website. While the latest release is SystemC 2.3.4, version 2.3.3 is widely used and more stable for most use cases.
Extract the source archive and create a build directory:
mkdir build
cd build
Modify the CMakeLists.txt file in the source directory with the following changes:
- Set CMAKE_BUILD_TYPE to Debug (line 271)
- Update CMAKE_CXX_STANDARD to 14 (line 276)
- Change the install prefix to a preferred location, e.g., /usr/local/systemc (line 545)
Compile and install:
cmake ..
make
sudo make install
Sample Project
Create a main.cpp file:
#include <systemc.h>
SC_MODULE(greeter) {
SC_CTOR(greeter) {
SC_THREAD(print_message);
}
void print_message() {
std::cout << "Welcome to SystemC simulation" << std::endl;
}
};
int sc_main(int argc, char* argv[]) {
greeter g("GREETER");
sc_start();
return 0;
}
Create a CMakeLists.txt:
cmake_minimum_required(VERSION 3.0)
project(systemc_demo)
set(SystemC_ROOT /usr/local/systemc)
find_package(SystemCLanguage REQUIRED CONFIG)
add_executable(demo main.cpp)
target_link_libraries(demo SystemC::systemc)
SystemC-AMS Extension
SystemC-AMS extends SystemC for analog and mixed-signal modeling. Download and extract the source, then create a build directory. Update the CMakeLists.txt to include the SystemC headers and set the C++ standard to match the SystemC instlalation. Compile and install similarly to SystemC.
In your project, include the SystemC-AMS headers and update CMakeLists.txt to link against both SystemC and SystemC-AMS libraries.