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


Tutorials



VMM ENV





Verification environment is developed by extending vmm_env class. The TestBench simulation needs some systematic flow like reset, initialize etc. vmm_env base class has methods formalize the simulation steps. All methods are declared as virtual methods. All the Verification components and instantiated, connected and component activities starting is done in this class. As it contains all verification components instances, the environment class affects the entire test environment.

The vmm_env class divides a simulation into the following steps, with corresponding methods:
gen_cfg() :
Randomize test configuration parameters.

build() :
Creates the instances of channels and transactors. Transactors are connected using channels. DUT is also connected to TestBench using the interfaces.

reset_dut() :
Reset the DUT using the interface signals.

cfg_dut() :
Configures the DUT configuration parameters.

start() :
Starts all the components of the verification environment to start component activity. All the transactors (atomic_gen, senario_gen, vmm_xactor....) have start method, which starts their activities. All the components start() methods are called in this method.

wait_for_end() :
This method waits till the test is done.

stop() :
Stops all the components of the verification environment to terminate the simulation cleanly. Stop data generators.

cleanup() :
Performs clean-up operations to let the simulation terminate gracefully. It waits for DUT to drain all the data it has.

report() :
The report method in vmm_env collects error and warning metrics from all the log objects and reports a summary of the results.

To create a user environment, define a new class extended from vmm_env and extend the above methods. To retain the core functionality of the base class methods, each extended method must call super. as the first line of code.

In The following example, we are defining a new class Custom_env from vmm_env and extending all the vmm_env class methods. All the methods are extended and `vmm_note() message is included to understand the simulation flow.




class Custom_env extends vmm_env;

function new();
super.new("Custom_env");
endfunction

virtual function void gen_cfg();
super.gen_cfg();
`vmm_note(this.log,"Start of gen_cfg() method ");
`vmm_note(this.log,"End of gen_cfg() method ");
endfunction

virtual function void build();
super.build();
`vmm_note(this.log,"Start of build() method ");
`vmm_note(this.log,"End of build() method ");
endfunction

virtual task reset_dut();
super.reset_dut();
`vmm_note(this.log,"Start of reset_dut() method ");
`vmm_note(this.log,"End of reset_dut() method ");
endtask

virtual task cfg_dut();
super.cfg_dut();
`vmm_note(this.log,"Start of cfg_dut() method ");
`vmm_note(this.log,"End of cfg_dut() method ");
endtask

virtual task start();
super.start();
`vmm_note(this.log,"Start of start() method ");
`vmm_note(this.log,"End of start() method ");
endtask

virtual task wait_for_end();
super.wait_for_end();
`vmm_note(this.log,"Start of wait_for_end() method ");
`vmm_note(this.log,"End of wait_for_end() method ");
endtask

virtual task stop();
super.stop();
`vmm_note(this.log,"Start of stop() method ");
`vmm_note(this.log,"End of stop() method ");
endtask

virtual task cleanup();
super.cleanup();
`vmm_note(this.log,"Start of cleanup() method ");
`vmm_note(this.log,"End of cleanup() method ");
endtask

virtual task report();
super.report();
`vmm_note(this.log,"Start of report() method \n\n\n");
`vmm_note(this.log,"End of report() method");
endtask

endclass




In addition to the methods that have already been discussed earlier, vmm_env also contains a run() method which does not require any user extension. This method is called from the testcase. When this method is called, individual steps in vmm_env are called in a sequence in the following order:

gen_cfg => build => cfg_dut_t => start_t => wait_for_end_t => stop_t => cleanup_t => report


Now we will see the testcase implementation. VMM recommends the TestBench to be implemented in program block. In a program block, create an object of the Custom_env class and call the run() method.



program test();

Custom_env env = new();

initial
env.run();

endprogram


(S) Download the files


vmm_env_1.tar
Browse the code in vmm_env_1.tar


(S) Simulation commands
vcs -sverilog -f filelist -R -ntb_opts rvm -ntb_opts dtm

(S) Log file report:

Normal[NOTE] on Custom_env() at 0:
Start of gen_cfg() method
Normal[NOTE] on Custom_env() at 0:
End of gen_cfg() method
Normal[NOTE] on Custom_env() at 0:
Start of build() method
Normal[NOTE] on Custom_env() at 0:
End of build() method
Normal[NOTE] on Custom_env() at 0:
Start of reset_dut() method
Normal[NOTE] on Custom_env() at 0:
End of reset_dut() method
Normal[NOTE] on Custom_env() at 0:
Start of cfg_dut() method
Normal[NOTE] on Custom_env() at 0:
End of cfg_dut() method
Normal[NOTE] on Custom_env() at 0:
Start of start() method
Normal[NOTE] on Custom_env() at 0:
End of start() method
Normal[NOTE] on Custom_env() at 0:
Start of wait_for_end() method
Normal[NOTE] on Custom_env() at 0:
End of wait_for_end() method
Normal[NOTE] on Custom_env() at 0:
Start of stop() method
Normal[NOTE] on Custom_env() at 0:
End of stop() method
Normal[NOTE] on Custom_env() at 0:
Start of cleanup() method
Normal[NOTE] on Custom_env() at 0:
End of cleanup() method
Simulation PASSED on /./ (/./) at 0 (0 warnings, 0 demoted errors & 0 demoted warnings)
Normal[NOTE] on Custom_env() at 0:
Start of report() method



Normal[NOTE] on Custom_env() at 0:
End of report() method
$finish at simulation time 0




Log file report shows that individual methods in vmm_env are called in a ordered sequence upon calling run() method.





When you call build() and if gen_cfg() is not called before that, gen_cfg() will be called first then build will execute.

Same way, if you call gen_cfg() followed by cfg_dut() followed by run(), then cfg_dut() will make sure to call build() followed by reset_dut() first before executing its user defined logic, run() will make sure to call start(), wait_for_end(), stop(), clean(), report()in the order given.




program test();

vmm_env env = new();

initial
begin
$display("*************** Before Calling env.gen_cfg() ***************");
env.gen_cfg();
$display("*************** Before Calling env.cfg_dut() ***************");
env.cfg_dut();
$display("*************** Before Calling env.run() ***************");
env.run();
end

endprogram


(S) Download the files


vmm_env_2.tar
Browse the code in vmm_env_2.tar


(S) Simulation commands
vcs -sverilog -f filelist -R -ntb_opts rvm -ntb_opts dtm +vmm_log_default=VERBOSE

(S) Log file report:


*************** Before Calling env.gen_cfg() ***************
Trace[INTERNAL] on Verif Env() at 0:
Generating test configuration...
*************** Before Calling env.cfg_dut() ***************
Trace[INTERNAL] on Verif Env() at 0:
Building verification environment...
Trace[INTERNAL] on Verif Env() at 0:
Reseting DUT...
Trace[INTERNAL] on Verif Env() at 0:
Configuring...
*************** Before Calling env.run() ***************
Trace[INTERNAL] on Verif Env() at 0:
Starting verification environment...
Trace[INTERNAL] on Verif Env() at 0:
Saving RNG state information...
Trace[INTERNAL] on Verif Env() at 0:
Waiting for end of test...
Trace[INTERNAL] on Verif Env() at 0:
Stopping verification environment...
Trace[INTERNAL] on Verif Env() at 0:
Cleaning up...
Simulation PASSED on /./ (/./) at 0 (0 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