SystemC学习(一)——环境安装

一、环境安装

bash 复制代码
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目录下。

bash 复制代码
cd ..
sudo apt-get install automake
aclocal
automake --add-missing
cd build

sudo make -j $(nproc)
make install
  • bashrc修改
bash 复制代码
sudo vi ~/.bashrc

#写入如下内容
export SYSTEMC_HOME=/home/systemc-2.3.4/
export LD_LIBRARY_PATH=/home/systemc-2.3.4/lib-linux64/:$LD_LIBRARY_PATH
 
source ~/.bashrc

二、Hello World运行

  • touch helloworld.cpp
bash 复制代码
#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
bash 复制代码
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

执行以下命令:

bash 复制代码
// 建立软链接
ln -s /home/systemc-2.3.4/lib-linux64/libsystemc-2.3.4.so /usr/lib/libsystemc-2.3.4.so

// 更新缓存
sudo ldconfig 
  • 执行
bash 复制代码
./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)

相关推荐
西岸行者11 天前
学习笔记:SKILLS 能帮助更好的vibe coding
笔记·学习
悠哉悠哉愿意11 天前
【单片机学习笔记】串口、超声波、NE555的同时使用
笔记·单片机·学习
别催小唐敲代码11 天前
嵌入式学习路线
学习
毛小茛11 天前
计算机系统概论——校验码
学习
babe小鑫11 天前
大专经济信息管理专业学习数据分析的必要性
学习·数据挖掘·数据分析
winfreedoms11 天前
ROS2知识大白话
笔记·学习·ros2
在这habit之下11 天前
Linux Virtual Server(LVS)学习总结
linux·学习·lvs
我想我不够好。11 天前
2026.2.25监控学习
学习
im_AMBER11 天前
Leetcode 127 删除有序数组中的重复项 | 删除有序数组中的重复项 II
数据结构·学习·算法·leetcode
CodeJourney_J11 天前
从“Hello World“ 开始 C++
c语言·c++·学习