Home Tips 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 :

» We Hear Ya!

 During the last months we conducted a poll about what you guys would you like to read more about on ThinkVerification and here are the results: Verification Methodology - 41%SystemVerilog Tutorials - 31%e Tutorials - 13%Interviews - 12%...

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

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

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

» Smart Constraints In SystemVerilog

Constraints are our best friends when it comes to random generation. They allow us to limit the range of possible scenarios/values as much as we like, from the level of "everything is allowed" down to the level of such heavy constraints that really...

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.