日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

Linux系統下SystemC環境配置方法_Linux

更新時間: 2021-11-23 編程語言

以下為centos7下配置方法

下載systemc源碼包:SystemC (accellera.org)

在這里插入圖片描述

將壓縮包放置到用戶目錄下,并解壓

tar -zxvf systemc-2.3.3.tar.gz

進入到systemc-2.3.3文件夾

cd systemc-2.3.3

新建臨時文件夾tmp,并進入其中

mkdir tmpcd tmp

運行如下命令

../configure
make
make install

至此,文件夾中生成include與lib-linux64兩個文件夾

設置環境變量

export LD_LIBRARY_PATH=home/centos7/systemc-2.3.3/lib-linux64 
//其中/home/cnetos7/為文件解壓路徑,根據自身情況確定

執行該命令只在當前可用,重啟后即失效,若需要長期可用,建議在用戶目錄下的.bashrc下添加該條命令,并需要執行以下命令,重啟終端生效。

source .bashrc

運行一個systemc程序進行測試。

test.cpp

//all systemc modules should include systemc.h header file
#inlcude"systemc.h"
//hello_world is module name
SC_MODULE(hello_world){
	SC_CTOR(hello_world){
		//nothing in constructor
	}
	void say_hello(){
		//Print "Hello world!!!" to the console.
		cout<<"Hello World!!!"<<endl;
	}
}; //此處分號不要忘了
//sc_main in top level function like in C++ main
int sc_main(int argc, char* argv[]){
	hello_world hello("HELLO");
	return 0;
}

編譯并運行

g++ test.cpp  -I/home/cp/Simulator/systemc/include -L/home/cp/Simulator/systemc/lib-linux64 -o test -lsystemc
./test

屏幕上將會顯示

在這里插入圖片描述

makefile

LIBDIR=-L/home/cp/Simulator/systemc/lib-linux64
INCDIR=-I/home/cp/Simulator/systemc/include
LIB=-lsystemc
all:
	g++ -o test test.cpp $(LIBDIR) $(INCDIR) $(LIB)
clean:
	rm -rf *.o

原文鏈接:https://blog.csdn.net/weixin_44381276/article/details/121641494

欄目分類
最近更新