一、环境安装
- SystemC (eda.org) 下载SystemC 2.3.4
- 编译与安装
cd systemc-2.3.4/
mkdir build && cd build
../configure --prefix=/home/systemc-2.3.4
如果最后的configure指令出现报错config.status: error: cannot find input file: `src/Makefile.in’,返回systemc-2.3.4/目录下,执行如下命令再返回build目录下。
cd ..
sudo apt-get install automake
aclocal
automake --add-missing
cd buildsudo make -j $(nproc)
make install
- bashrc修改
sudo vi ~/.bashrc#写入如下内容
export SYSTEMC_HOME=/home/systemc-2.3.4/
export LD_LIBRARY_PATH=/home/systemc-2.3.4/lib-linux64/:$LD_LIBRARY_PATHsource ~/.bashrc
二、Hello World运行
- touch helloworld.cpp
#ifndef _HELLO_H
#define _HELLO_H
#include "systemc.h"
SC_MODULE(hello)
{SC_CTOR(hello){cout<<"Hello, SystemC!"<<endl;}
};
#endif//main.cpp
int sc_main(int i, char* a[])
{hello h("hello");return 0;
}
- compile
g++ helloworld.cpp -I/home/systemc/include/ -L/home/systemc/lib-linux64 -o hello -lsystemc
报错:
error while loading shared libraries: libsystemc-2.3.4.so: cannot open shared object file: No such file or directory
执行以下命令:
// 建立软链接
ln -s /home/systemc-2.3.4/lib-linux64/libsystemc-2.3.4.so /usr/lib/libsystemc-2.3.4.so// 更新缓存
sudo ldconfig
- 执行
./hello
三、参考文献
- Linux安装:
SystemC入门学习Demo用例的工程化配置_一个systemcdemo-CSDN博客
ubuntu系统安装systemc-2.3.4流程_systemc requires a c++ compiler version of at leas-CSDN博客
SystemC (accellera.org)
- Windows安装
Windows VS2022 下配置SystemC环境 - 知乎 (zhihu.com)