vmm_opts是vmm的系统类,包含了3个函数,get_int(),get_string(),get_bit();
利用opts函数,可以大大提高代码的重复利用率。
simv +vmm_opts+FOO=HELLO
simv +vmm_opts+FOO=100
参考文献 : http://www.testbench.in/VM_12_VMM_OPTS.html
Some of the test parameters in functional verification are passed from the command line. Passing Parameters from the command line allows simulating the same testcase file with different scenario. For example, let say you are verifying Ethernet protocol. Insert_crc_error.sv is a testcase file which verifies the DUT by sending CRC error packets. Now you can use the same testcase file to verify the DUT in 3 different modes , 10G 1000M and 100M modes by passing these parameters from the command prompt, this increases the testcase reusability.
As parameters became one of the most important techniques in reusing the testcases, vmm has added vmm_opts class to manage parameters efficiently.
vmm_opts captures parameter from run time options.
There are 2 ways to specify the parameters during runtime.
1) Command line
vmm_opts internally uses $plusargs to recognize the options specified on command line.
2) text file
If you have lot of parameters to mentions, then you can also mention all the parameters in a text file and pass it as command line options.
vmm_opts can recognize 3 types of parameters. They are
String type parameters
Integer type parameters
Bit type parameters
Following are the 3 static methods which are defined in vmm_opts to get the parameter values.
Static function bit get_bit ( string name , string doc = "" );
Static function int get_int ( string