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)

相关推荐
学网安的肆伍10 分钟前
认证机制攻防学习|PortSwigger Authentication 靶场复现总结(二):用户名枚举进阶
学习·web安全·网络安全·burpsuite·portswigger·认证安全·靶场复现
海绵宝宝转agent32 分钟前
Leetcode二叉树算法个人理解
笔记·学习·算法·leetcode·深度优先
小oo呆35 分钟前
【学习心得】MCP工具开发学习笔记
笔记·学习
kyrie_sakura1 小时前
大模型学习19 大模型学习 - LangChain2_Retrieval(RAG-文档处理-向量处理检索-Milvus)
学习·langchain·milvus
女神下凡2 小时前
芯参谋(79):嵌入式学习进阶_(硬件与软件)深入实践指南
arm开发·单片机·嵌入式硬件·学习·fpga开发·设计规范
星恒随风2 小时前
Linux Socket TCP编程(二):逐文件重构多进程、多线程与线程池服务器,深入fork、pthread_create、popen和std::bind
linux·服务器·笔记·学习·tcp/ip
wq8973872 小时前
[AI问答] VFIO操作的相关函数学习
学习
Century_Dragon3 小时前
把一辆智能汽车“搬“进教室—智能网联汽车自动驾驶虚拟教学实训
学习
兔头?3 小时前
JVM学习文档
jvm·学习
无心水3 小时前
15、云原生架构设计理论与实践 核心考点与学习笔记
笔记·学习·云原生·架构师·软考·系统架构设计师·软考系统架构设计师