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 :

» VMM Hackers Guide - Default Behavior For Your BFM

Here's a short tutorial on how to implement a default behavior for your BFM using VMM. Some protocols require constant activity on their interface even when you don't have any data to transmit. This means you must have a mechanism that drives idle...

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

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

» Another Step Forward For VMM

While the move from 1.0 to 1.1 and its later flavors did not involve a major paradigm shift, VMM1.2 (beta) introduces several fundamentally new concepts that you should be aware of. Some of the new concepts are the natural result of an evolving...

» UVM Users: Here Are Some Great Tips [Video]

A couple of years ago I wrote here about how the UVM was becoming the next big thing in the verification world.And guess what? I was right. Not that it was too hard to predict... but anyway, the industry has finally standardized on language (SV) and...

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.