博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
简单的Verilog测试模板结构
阅读量:6975 次
发布时间:2019-06-27

本文共 2146 字,大约阅读时间需要 7 分钟。

这里记录一下曾经用到的简单的测试模板,如下所示:

//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 generationalways #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 generatorparameter 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 VCSinitial begin     $vcdpluson;end endmodule

 

这些结构都没有给出具体的内容。有空补上一个简单的例子。

 

转载于:https://www.cnblogs.com/IClearner/p/9998569.html

你可能感兴趣的文章
提高代码质量 CheckStyle FindBugs PMD
查看>>
shell技巧之以逆序形式打印行
查看>>
Java面试题集(六)
查看>>
读枯燥的技术书时怎么集中精神?
查看>>
iOS 依据文本内容为TextView动态定义高度
查看>>
CCF系列之ISBN号码(201312-2)
查看>>
SQL Server 内存使用量下降问题
查看>>
问题MySQL server has gone away
查看>>
iOS的Cookie存取看我绝对够!!
查看>>
azkaban 安装
查看>>
GIX4中懒加载
查看>>
Git分布式开发之生成ssh公钥
查看>>
2013年终回顾:水下的世界
查看>>
tomcat排错过程
查看>>
自己的linux系统
查看>>
virus.win32.parite.h病毒查杀
查看>>
VC 实现线程池
查看>>
vim简单用法
查看>>
记一个最简单的多线程实例
查看>>
【初級篇】华为NAT技术(静态NAT)
查看>>