欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 财经 > 金融 > SystemC学习(4)— 在VCS中运行SystemC

SystemC学习(4)— 在VCS中运行SystemC

2025/5/23 23:06:27 来源:https://blog.csdn.net/qq_38113006/article/details/143652969  浏览:    关键词:SystemC学习(4)— 在VCS中运行SystemC

SystemC学习(4)— 在VCS中运行SystemC

一、前言

参考:VCS编译verilog&SystemC

二、仅包含SystemC的仿真

源文件使用上一篇:SystemC学习(3)— APB_SRAM的建模与测试

编写makefile如下所示:

all: comp simcomp:vcs -full64 -debug_acc+pp+dmptf -debug_region+cell+encrypt -sysc=show_sc_main \-sysc sc_main apb_sram/main.cpp -l comp.logsim:./simv -ucli -do ./vcs.tcl -l sim.logclean:rm -rf csrc/ simv simv.daidircleanall: cleanrm -rf 64 AN.DB/ ucli.key novas.* *Log *log

编写vcs.tcl 如下所示:

fsdbDumpvars sc_main.dut 0run
finish

编译运行后可以打开novas.fsdb波形文件如下所示:
在这里插入图片描述

三、Verilog和SystemC混合仿真

我们将apb_sram修为如下apb_sram.v文件:

 
parameter ADDR_SIZE = 32;
parameter DATA_SIZE = 32;module apb_sram(input   apb_pclk,input   apb_presetn,input   apb_psel,input   apb_penable,input   apb_pwrite,input   [ADDR_SIZE-1:0] apb_paddr,input   [DATA_SIZE-1:0] apb_pwdata,output  reg [DATA_SIZE-1:0] apb_prdata,output  reg apb_pready,output  reg apb_pslverr);bit [DATA_SIZE-1:0] mem[4096];always @(posedge apb_pclk or negedge apb_presetn) beginif(!apb_presetn) beginapb_prdata  <= 0;apb_pready  <= 0;apb_pslverr <= 0;endelse if((apb_psel==1) && (apb_penable==0) && (apb_pwrite==0)) beginapb_prdata <= mem[apb_paddr[ADDR_SIZE-1:2]];endelse if((apb_psel==1) && (apb_penable==1) && (apb_pwrite==0)) beginapb_pready <= 1;endelse if((apb_psel==1) && (apb_penable==1) && (apb_pwrite==1)) beginmem[apb_paddr[ADDR_SIZE-1:2]] <= apb_pwdata;apb_pready <= 1;endelse beginapb_prdata <= apb_prdata;apb_pready <= 0;endend
endmodule

makefile修改为如下所示:

all: comp simcomp:vlogan -full64 -sverilog -sysc -sc_model apb_sram -sc_portmap the.map apb_sram/apb_sram.vvcs -full64 -debug_acc+pp+dmptf -debug_region+cell+encrypt \-sysc apb_sram/main.cpp -sysc=show_sc_main -l comp.log -timescale=1ns/1pssim:./simv -ucli -do ./vcs.tcl -l sim.logclean:rm -rf csrc/ simv simv.daidircleanall: cleanrm -rf 64 AN.DB/ ucli.key novas.* *Log *log

the.map文件如下所示:

#port           width             Verilog         SystemC
ina             32                bitvector       int
inb             32                bitvector       int
outx            32                bitvector       int

编译运行后可以打开novas.fsdb波形文件看到如下所示:
在这里插入图片描述

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词