`vmm_test_begin(testcase_name,vmm_env,"Test Case Name String") ;
env.build() ;
env.reset_dut() ;
env.start() ;
env.wait_for_end() ;
env.report() ;
`vmm_test_end(testcase_name);
参考文献:http://www.testbench.in/VM_09_VMM_TEST.html
vmm_test is introduced in vmm 1.1.
To know the vmm version which you are using, use this command
vcs -R -sverilog -ntb_opts dtm
+incdir+$VMM_HOME/sv $VMM_HOME/sv/vmm_versions.sv
vmm_test is used for compiling all the testcases in one compilation. The simulation of each testcase is done individually. Traditionally for each testcase, compile and simulation are done per testcase file. With this new approach, which dose compilation only once, will save lot of cup.
Generally each testcase can be divided into two parts.
(S)Procedural code part.
The procedural code part (like passing the above new constrained transaction definition to some atomic generator, calling the env methods etc) has to be defined between these macros. vmm provides 2 macros to define testcase procedural part.
`vmm_test_begin(testcase_name,vmm_env,"Test Case Name String")
`vmm_test_env(testcase_name)
(S)Declarative code part.
The declarative part( like new constrained transacting definition) is defined outside these macros.
Writing A Testcase
Let us see an example of writing a testcase.
Inside the testcase, we will define a new transaction and pass this transaction to the atomic generator.
(S) Declarative part:
1) Define all the declarative code.
class constrained_tran extends pcie_transaction;
// Add some constraints
// Change some method definitions
end class
2) Define a handle to the above object.
constrained_tran c_tran_obj;
(S) Procedural part:
Use a `vmm_test_begin . There are 3 arguments to macro.
The first argument is the name of the testcase class and will also be used as the name of the testcase in the global testcase registry.