test.sv
来自「This is OVM 2.0 source code .Very useful」· SV 代码 · 共 64 行
SV
64 行
/*About: do_testthis test will test running two run phases in parallel.Walk through the test:create a thread *A* with a run task which has a delay of 55 ns.create an env class *myenv* with a run task which has a dealy of 10 ns.when the top module call do_test, the test will terminate after the first 10 ns , because the run() in the env myenv is element that controls the test when using do_test. When myenv::run terminates then the entire test shuts down.*/package user_pkg;import ovm_pkg::*;//----------------------------------------------------------------------// A//----------------------------------------------------------------------class A extends ovm_component; function new(string name, ovm_component parent); super.new(name, parent); endfunction task run; $display("%0t: Hi from %s top %0s", $time, get_full_name(), m_parent.get_full_name()); #55; $display("%0t: Done from %s", $time, get_full_name()); endtaskendclass//----------------------------------------------------------------------// myenv//----------------------------------------------------------------------class myenv extends ovm_env; A aa; function new(string name, ovm_component parent=null); super.new(name, parent); aa = new("a", this); endfunction task run; $display("%0t: Hi from %s", $time, get_full_name()); #10; $display("%0t: Done from %s", $time, get_full_name()); endtaskendclassendpackage:user_pkg//----------------------------------------------------------------------// top//----------------------------------------------------------------------module top; import user_pkg::*; myenv env = new("env"); initial env.do_test();endmodule
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?