Home Articles SystemVerilog VMM Hackers Guide - Creating Smart Scenarios With Atomic Generators

Search

VMM Hackers Guide - Creating Smart Scenarios With Atomic Generators PDF Print E-mail
User Rating: / 13
PoorBest 
Thursday, 24 December 2009 16:59

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 generation of sequences. A sequence (a.k.a scenario) is a set of items that have some sort of correlation between them. For example - a set of 10 transactions with incremental addresses, or a set of 3 packets where the first one is always short and the last one is always long.


VMM addresses the need for smart scenarios with the "VMM Scenario Generator" - a separate generator  - but integrating this component will require some work to get it up and running smoothly with the rest of your environment. Man, if we could just use atomic generators to define and create scenario as well... Guess what? here's a quick way to do this in your test program, with no special preparations and no learning curve.

 

The idea here is to leverage the atomic generation architecture that we already have to drive our own sequences, and we do this by first shutting down the atomic generator (see here how to do this in a more stylish way). We then take an array of items that we prepared in advanced (i.e. the sequence) and inject these items one by one into the output channel of the atomic generator. As a matter of fact, atomic generators implicitly encourage this kind of hack by supplying the inject() function in their API. With this approach the entire environment stays intact, while we get what we want with no extra effort and no extra maintenance of unnecessary generators.

In this little example here we create a sequence of 10 transactions with incremental addresses. If you get the hang of it, you can easily create smarter sequences using the same technique.

 program test;
 ...
 
 // preparing the sequence
 // 10 transactions, address incrementing by 1 
 trans seq1[];
 
 task gen_seq1();
   seq1 = new[10];
   foreach (seq1[i]) begin
     seq1[i] = new();
     seq1[i].randomize with  {
         address == 1000 + i;
     }; 
   end
 endtask
 
 ...
 
 initial begin
   bit dropped;
   ...
   // need to stop automatic generation 
   env.start();
   env.trans_gen.stop_xactor();
   ...
   // creating the sequence
   gen_seq1();
 
   // launching a non blocking thread that will
   // inject our sequence 
   fork
     foreach(seq1[i]) begin 
       env.trans_gen.inject(seq1[i]), dropped);
     end
   join_none
   ...
 
   env.run();
 
 end
 
 endprogram
 

 


We'd love to hear your comments! email us at mail@thinkverification.com, or simply fill in your comment below.

 

 
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...

» The Easy Way To Start Using OVM-e Sequences

Industry-standard methodologies are great, really. It would be so nice if our entire verification environment (VE) were OVM-e (eRM) compliant, wouldn’t it? But what if there are legacy components in our env that don’t follow any specific...

» 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...

» 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...

» Cool Things You Can Do with Verdi

Wow it's been a while, but I'm back with a new series of YouTube videos. Hurray !!This time it's all about Verdi and all the cool things it can do for you.Since most of you guys already know it is the best debugger out there, my goal is to show you...

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.