欢迎关注个人公众号摸鱼范式
本期将讲解UVM环境构成和启动方式。主要参考资料为
http://bbs.eetop.cn/thread-320165-1-1.html
http://rockeric.com/
环境构成
进行仿真验证的基本流程是
- 例化DUT
- 产生并发送激励
- 检测响应
- 检查响应是否正确
在验证环境中,产生并发送激励将会交给两个不同的类完成,即uvm_driver和uvm_sequence,检测响应通过uvm_monitor完成,而检查响应是否正确通过uvm_scoreboard。除了保证某项功能正确,我们还需要能够确保spec中的每一项功能都通过测试,而衡量验证完备性的指标之一就是功能覆盖率,在我们的验证环境中收集功能覆盖率的任务则交给了conv_coverage实现。
接下来将以数据从uvm_driver驱动到DUT,再从DUT到uvm_monitor,再到uvm_scoreboard的顺序讲解验证环境的构成。
接口定义
当我们需要进行仿真验证时,与DUT的交互是一个必要的内容,所我们首先分析DUT的接口,较为简单,一共有四组接口,一组寄存器配置接口,三组数据接口用于输入特征图、权重和偏置数据的读取,一组数据接口用于输出特征图的存储接口。
interface的定义在顶层的tb.sv中,三组输入数据几口可以使用同一类型的接口实现,下列代码中的具体内容省略了,详情请自行查看。最后一组接口用于检测寄存器的内容,当前版本没有使用寄存器模型,所以这个接口是必要的。
interface cfg_intf (input clk , input rst_n);
clocking drv_ck @(posedge clk);
default input #1ns output #1ns;
endclocking
clocking mon_ck @(posedge clk);
default input #1ns output #1ns;
endclocking
endinterface
interface mem_in_intf (input clk , input rst_n);
clocking drv_ck @(posedge clk);
default input #1ns output #1ns;
endclocking
clocking mon_ck @(posedge clk);
default input #1ns output #1ns;
endclocking
endinterface
interface mem_out_intf (input clk , input rst_n);
clocking mon_ck @(posedge clk);
default input #1ns output #1ns;
endclocking
endinterface
interface conv_intf (input clk , input rst_n);
clocking mon_ck @(posedge clk);
default input #1ns output #1ns;
endclocking
endinterface
注意在interface定义中,分别定义了两个时钟块,一组驱动用的时钟块,一组检测用的时钟块,目的就是为了模拟真实的建立保持时间,时钟块的具体用法可以参考绿皮书的第四章内容。
环境组件
有了接口定义以后,通过接口定义,我们便能够与DUT交互,那么进行交互我们需要做什么呢?
首先看整体结构,如果看不清,后台回复UVM结构图获取VISIO文件。按照接口进行分类&#