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)

相关推荐
aloha_7891 小时前
软考信息系统项目管理师错误归纳总结
java·学习
呉師傅2 小时前
UPS滴滴告警!如何测量UPS电池内阻【UPS学习】
运维·服务器·网络·学习·电脑
lizhihai_992 小时前
股市学习心得-与英伟达核心 PCB 相关的八家关联企业
大数据·人工智能·学习
阳光宅男@李光熠3 小时前
【电子通识】贴片电阻上的丝印332、5R6、1502、01C怎么读出阻值?
笔记·学习
sakiko_5 小时前
Swift学习笔记31-网络请求
网络·笔记·学习·swift
星夜夏空995 小时前
STM32单片机学习(20) —— 利用中断实现串口通信(填前面的坑)
stm32·单片机·学习
神谕的祝福5 小时前
comfyui从0到1开始学习-第一讲安装ComfyUI
学习
名字不相符5 小时前
ctfshow之MISC入门(个人记录与学习)
学习·ctf·misc
创业之路&下一个五年5 小时前
自聚合树形业务:泛型基类+继承 设计思想完整总结(含核心原理与落地案例)
学习·总结
wuxinyan1236 小时前
工业级大模型学习之路023:LangChain零基础入门教程(第六篇):重排序与高级检索策略
人工智能·python·学习·langchain