标签:task pil tput tor ever 模块使用 compile ali glob
这里记录一下曾经用到的简单的测试模板,如下所示:
//timescale `timescale 1ns/1ns module tb_module(); //the Internal motivation variable(register) and output wire //the External motivation storage variable //Sub module signal,example: wire [1:0] xxx == xxx_inst.xxx_inst.xxx; // Global variable initialization ,such as ‘clk‘、‘rst_n‘ initial begin #0 rst_n = 0; clk = 0; #25 rst_n = 1 ; end //Internal motivation variable initialization //initial begin //end //cloclk signal generation always #10 clk = ~clk ; //Cases of sub module xxxx xxxx_inst(.(),.(), ... ,.()); // Internal motivation variable assignment using task or random /* example task data_assign(xx); | task rand_bit(); integer xx,xx,...; | integer i; begin | begin for( ; ; )begin | for(i=0; i<255; i=i+1)begin @(posedge clock) | @(posedge sclk); Internal motivation variable <= xxxxx; | Internal motivation variable <={$random} %2; end | end end | end endtask | endtask */ endmodule
整个测试模块(结构)很简单,并没有结果捕捉模块,因此如果有错的话,并不会打印出来,需要在波形中查看,仅限于简单模块使用。
另外一个简单的verilog测试模板结构如下所示:
module tb_module; //drive the input port with reg type //sample the output with the wire type //task1 create the instance //task2 clock and reset generator parameter CLK_PERIOD = ; reg clk ,rst_n; initial begin clk = 0; forever begin #(CLK_PERIOD/2) clk = ~clk ; end end initial begin rst_n = 0; # rst_n = 1; end //task3 drive the stimulus and capture the response //testcase //task4 check the result //task5 dump waveform with the compile option -debug_all,for the VCS initial begin $vcdpluson; end endmodule
这些结构都没有给出具体的内容。有空补上一个简单的例子。
标签:task pil tput tor ever 模块使用 compile ali glob
原文地址:https://www.cnblogs.com/IClearner/p/9998569.html