|HOME |ABOUT |ARTICLES |ACK |FEEDBACK |TOC |LINKS |BLOG |JOBS |


Tutorials



VMM OPTS




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 name,int dflt = 0, string doc = "");

Static function string get_string(string name, string dflt = "", string doc = "");


The first argument is the name of the parameter and the argument "doc" is description of the runtime argument that will be displayed by the vmm_opts::get_help() method. as these methods are static, user dont need to construct the object of vmm_opts.

Argument "dflt" is the default value.


(S) How to give options


To supply a Boolean runtime option "foo" , use "+vmm_opts+...+foo+..." command-line option, or "+vmm_foo" command-line option, or the line "+foo" in the option file.

To supply a integer value "5" for runtime option "foo", use the "+vmm_opts+...+foo=5+..." command-line option, or "+vmm_foo=5" command-line option, or the line "+foo=5" in the option file.

To supply a string value "bar" for runtime option "foo" , use the "+vmm_opts+...+foo=bar+..." command-line option, or "+vmm_foo=bar" command-line option, or the line "+foo=bar" in the option file.

To supply a textfile which contains the runtime options, use "+vmm_opts_file=finename.txt"

+vmm_help command line option will print the run time options help. This option will call the vmm_opts::get_help() method.

The following is a basic example of how these parameters could be received using vmm_opts



(S)EXAMPLE

`include "vmm.sv"

class my_env extends vmm_env;

virtual function void gen_cfg();
integer foo1;
string foo2;
bit foo3;

super.gen_cfg();
`vmm_note(log,"START OF GEN_CFG ");
foo1 = vmm_opts::get_int("foo1" , 10 , "Help for the option foo1: pass any integer between 0 to 100");
foo2 = vmm_opts::get_string("foo2" , "default_string" , "Help for the option foo2: pass any string");
foo3 = vmm_opts::get_int("foo3" , "Help for the option foo3: just use foo3 to enable ");
`vmm_note(log,$psprintf("\n Run time Options \n foo1 : %0d \n foo2 : %s \n foo3 : %b \n",foo1,foo2,foo3));
`vmm_note(log,"END OF GEN_CFG ");
endfunction

endclass


program main();


initial
begin
my_env env;
env = new();
env.run();
end

endprogram

(S)Download the example


vmm_opts.tar
Browse the code in vmm_opts.tar



(S)Commands to complie


This works with vmm 1.1 and above.
vcs -sverilog -ntb_opts dtm +incdir+$VMM_HOME/sv main_testcase.sv


(S)Commands to complie


./simv
./simv +vmm_foo1=101
./simv +vmm_opts+foo1=101+foo2=Testbench.in

Following is log file generated using runtime option +vmm_foo1=101 +vmm_foo2=Testbench.in


(S)Log

Normal[NOTE] on Verif Env() at 0:
START OF GEN_CFG
WARNING[FAILURE] on vmm_opts(class) at 0:
No documentation specified for option "foo3".
Normal[NOTE] on Verif Env() at 0:

Run time Options
foo1 : 101
foo2 : Testbench.in
foo3 : 0

Normal[NOTE] on Verif Env() at 0:
END OF GEN_CFG
Simulation PASSED on /./ (/./) at 0 (1 warnings, 0 demoted errors & 0 demoted warnings)


































Index
Introduction
Vmm Log
Vmm Env
Vmm Data
Vmm Channel
Vmm Atomic Generator
Vmm Xactor
Vmm Callback
Vmm Test
Vmm Channel Record And Playback
Vmm Scenario Generator
Vmm Opts

Report a Bug or Comment on This section - Your input is what keeps Testbench.in improving with time!





<< PREVIOUS PAGE

TOP

NEXT PAGE >>

copyright 2007-2017 :: all rights reserved www.testbench.in::Disclaimer