Home Tips VMM Hackers Guide - Shutting Down Atomic Generators

Search

VMM Hackers Guide - Shutting Down Atomic Generators PDF Print E-mail
User Rating: / 0
PoorBest 
Thursday, 24 December 2009 16:57

Everybody likes atomic generators. If you have a vmm_data class, all you have to do is add a quick macro line and you get a free VMM-compliant generator that you only need to instantiate in your environment. An atomic generator is a simple yet powerful means to create a continuous flow of random data items to your DUT (more accurately “ to your BFM). Once everything is hooked up, all you have to do in your test program is set the number of items you want to generate, or let it run endlessly.

 

For example, if you want to drive 100 items, do this:

program test;
 
 my_env.gen.stop_after_n_insts = 100;
 
 endprogram

And if you want the generator to work endlessly do this:

program test;
 ...
 my_env.gen.stop_after_n_insts = 0;
 ...
 endprogram

That’s right, it’s a zero up there, and it’s also the default. So if you don’t say anything, all of your atomic generators will work endlessly. So, one might ask, how do you turn it off? Well, seems like the only way to do this is to call the stop_xactor() method, but only if you call it immediately after vmm_env::start(). This means that if your test program looks like this, both generators will still work although stop_xactor() is called:

program test;
 
env = new();
env.build();
env.gen1.stop_after_n_insts = 100;
env.gen1.stop_xactor();
env.gen2.stop_after_n_insts = 0;
env.gen2.stop_xactor();
 
env.run();
 
endprogram

The generators will stop, however, if you place the stop_xactor() after explicitly calling the start() method:

program test;
 
env = new();
env.build();
env.gen1.stop_after_n_insts = 100;
env.gen2.stop_after_n_insts = 0;
 
env.start();
 
env.gen1.stop_xactor();
env.gen2.stop_xactor();
env.run();
 
endprogram

 

Now, although this is the recommended way by Synopsys we just couldn’t resist hacking the code to make stop_after_n_insts = 0 do NOTHING. Be careful though, this hack implies a minor paradigm shift - atomic generators are now off by default (rather than on and working endlessly).  With the hacked version, you can do this in your test, no need to stop_xactor():

program test;
 
// choose only one of the following:
my_env.gen1.stop_after_n_insts = 0; // shut down (default)
my_env.gen1.stop_after_n_insts = 100; // create 100 items and then stop
my_env.gen1.top_after_n_insts = -1; // work endlessly
 
endprogram

 


THE HACK


 

WARNING:

THIS IS FOR ADVANCED VMM USERS ONLY. USE AT YOUR OWN RISK!

KIDS, DON’T TRY THIS AT HOME.

  1. Locate the following line in the VMM source code:

    class `vmm_atomic_gen_(class_name)      extends `VMM_XACTOR; 



  2. About 100 lines down from there replace this line:

    while (this.stop_after_n_insts <= 0      ||


    with this one:


    while (this.stop_after_n_insts < 0      ||


  3. There’s a similar code line in the vmm_scenario class definition, make sure you haven’t ruined that one by mistake.
  4. Remember: This is only a small change, but it has a big impact.  Make sure you understand the paradigm shift.

 

 
More articles :

» About UVM And You

There’s been a lot of buzz about the lately and for a reason. The Universal Verification Methodology is about to change the rules of the game pretty soon, if not already. That is interesting because not too long ago verification engineers...

» Educate Yourself - SystemVerilog 101

SystemVerilog emerged a few years ago and has gained phenomenal popularity ever since. Today this language is virtually ubiquitous and all 3 big EDA vendors keep pushing it forward. So if you consider yourself a modern verifier, you'd better get...

» Method Manipulation In SV and e

If you're familiar with SystemVerilog and taking your first steps in e (or vice versa) you might find this useful. Here are some of the most common method manipulations that you''ll need to master and how you should go about implementing them in e...

» Using Constrained-Random Verification with Legacy Testbenches

One of SystemVerilog's noticeable features is that it is basically a "design language" that has been extended with verification capabilities. This might be an advantage or not, depending on who you're asking, but obviously, if you only want to use a...

» VMM Hackers Guide - Creating Smart Scenarios With Atomic Generators

VMM ships with some pretty useful built-in components and applications. VMM''s Atomic Generator is probably one of the most powerful ones, yet it's pretty basic. It can definitely help you generate a flow of random items but it was not intended for...

Add comment


Security code
Refresh

Copyright © 2017 Think Verification - Tips & Insights on ASIC Verification. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.