溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Linux系統(tǒng)下SystemC環(huán)境如何配置

發(fā)布時(shí)間:2021-12-02 11:45:07 來源:億速云 閱讀:252 作者:小新 欄目:開發(fā)技術(shù)

這篇文章將為大家詳細(xì)講解有關(guān)Linux系統(tǒng)下SystemC環(huán)境如何配置,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

以下為centos7下配置方法

Linux系統(tǒng)下SystemC環(huán)境如何配置

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

tar -zxvf systemc-2.3.3.tar.gz

進(jìn)入到systemc-2.3.3文件夾

cd systemc-2.3.3

新建臨時(shí)文件夾tmp,并進(jìn)入其中

mkdir tmpcd tmp

運(yùn)行如下命令

../configure
make
make install

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

設(shè)置環(huán)境變量

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

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

source .bashrc

運(yùn)行一個(gè)systemc程序進(jìn)行測試。

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;
}

編譯并運(yùn)行

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

屏幕上將會顯示

Linux系統(tǒng)下SystemC環(huán)境如何配置

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

關(guān)于“Linux系統(tǒng)下SystemC環(huán)境如何配置”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI