systemc学习m(一)


SystemC是一个支持系统建模的开源的C++ library;主要用于芯片设计,SystemC可以让软硬件并行开发,加快产品面市时间。

下载

下载地址:SystemC (accellera.org)
github地址:GitHub - accellera-official/systemc: SystemC Reference Implementation
systemc官网:systemc.org

我这里下载的是3.0.0版本

wget https://github.com/accellera-official/systemc/archive/refs/tags/3.0.0.tar.gz

编译

# 进入主目录
cd systemc
mkdir build
cd build
cmake ..
make -j4
make install
# 默认会安装到/opt/systemc

Hello World

  • hello.h
#ifndef _HELLO_H 
#define _HELLO_H
 
#include "systemc.h" 
SC_MODULE(hello){
  SC_CTOR(hello){
	cout<<"Hello,SystemC!"<<endl; 
	cout<<"c_version():"<<endl;  
        cout<<sc_version()<<endl;
	cout<<"sc_copyright()   "<<endl; 
        cout<<sc_copyright()<<endl;
	cout<<"sc_time_stamp()    "<<sc_time_stamp()<<endl;
	cout<<"sc_get_time_resolution()   "<<sc_get_time_resolution()<<endl;
	cout<<"sc_get_default_time_unit()   "<<sc_get_default_time_unit()<<endl;
  }
};
#endif   
  • hello.cpp
#include "hello.h"
int sc_main (int argc, char* argv[]) {
   
  cout <<"Hello World "<< endl;
  return 0;// Terminate simulation
}

​- Makefile

LIB_DIR=-L /opt/systemc/lib
INC_DIR=-I /opt/systemc/include
LIB=-lsystemc -Wl,-rpath,/opt/systemc/lib
App=hello
all:
	g++ -o $(App) $(App).cpp $(LIB_DIR) $(INC_DIR) $(LIB)                                                
clean:                                                                                                           
	RM -RF $(App)   
  • 编译/运行
make
export LD_LIBRARY_PATH=/opt/systemc/lib:$LD_LIBRARY_PATH
./hello
  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值