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)

相关推荐
蜡笔小新星1 小时前
MySQL添加时间戳字段并且判断插入或更新时间
数据库·经验分享·学习·mysql
CrazyZ1261 小时前
c++primer第十三章 类继承
开发语言·c++·笔记·学习
我命由我123452 小时前
8.使用 VSCode 过程中的英语积累 - Help 菜单(每一次重点积累 5 个单词)
ide·经验分享·笔记·vscode·学习·编辑器·学习方法
IM_DALLA2 小时前
【Verilog学习日常】—牛客网刷题—Verilog企业真题—VL65
学习·fpga开发·verilog学习
驱动起爆大师x_x2 小时前
《Ubuntu20.04环境下的ROS进阶学习7》
linux·笔记·学习·机器人·自动驾驶
fzyz1232 小时前
手搓一个Eval#Datawhale组队学习大模型任务Task4
人工智能·深度学习·学习·机器学习
狐573 小时前
横排文字、图层蒙版-1(2024年09月30日)
笔记·学习
wusam3 小时前
螺狮壳里做道场:老破机搭建的私人数据中心---Centos下docker学习02(yum源切换及docker安装配置)
学习·docker·centos
limengshi1383924 小时前
通信工程学习:什么是DQDB分布式队列双总线
网络·学习·信息与通信