RTL ready & TEST_BENCH ready

在tb中需要dump_wave

例:
// dump_wave
`ifndef NC_VERILOG
initial begin
  $fsdbDumpfile("wave.fsdb");
  $fsdbDumpMDA();
  $fsdbDumpvars;
end
`else
initial begin
  $shm_open("wave.shm");
  $shm_probe(test_tb,"ACM");
end
`endif

在tb中若需要读取文件,则调用$fopen、$fgets()、$fclose等系统函数

例:

integer file_descriptor;

string line;

initial begin

        //open the file

        file_descriptor = $fopen("test.txt", "r");

        // check the file open successfully

        if(file_descriptor == 0) begin

                $display("Error:Could not open file.");

                $finish;

        end

        else begin

                $display("Successfully open the file.");

                // read the file until ending

                while(!feof(file_descriptor)) begin

                        $fgets(line, file_descriptor);

                        // print the read line

                        $display("%s", line);

                end

                // close the file

                $fclose(file_descriptor);

        end

end

注:网上很多资料$fgets()系统函数是先file_descriptor后line的,ai搜索的很多资料也是,这里留个疑问!

当写好RTL和TEST_BENCH后,写flist.f文件让仿真软件吃进去

例:

RTL:test.v

TESTBENCH:test_tb.sv

需要在flist.f文件中将其包起来(所有需要编译的文件)

./../rtl/test.v
./../tb/test_tb.sv

在rtl、tb中无需声明`timescale,在命令行统一写入+nctimescale+1ns/1ps

敲命令行:

ncverilog -sv +define+NC_VERILOG +define+ARMUD_MODEL +access+wrc +nctimescale+1ns/1ps -f flist.f

使用了一系列的编译选项和文件:-sv(使用SystemVerilog语法),+define+NC_VERILOG+define+ARMUD_MODEL(定义宏),+access+wrc(设置访问权限),-f flist.f(指定编译文件列表),以及两个文件./../rtl/test.v./../tb/test_tb.sv

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值