Home Tips AutoDup: Create Test Variants Quickly (Free Utility)

Search

AutoDup: Create Test Variants Quickly (Free Utility) PDF Print E-mail
User Rating: / 24
PoorBest 
Thursday, 01 April 2010 15:12

Coverage driven verification has a big advantage – you can write a single test, and let run it several times with random seeds. Each run will generate a slightly different scenario – depending on the nature of the constraints you provided. I’ve talked about the pros and cons of excessive use of coverage driven methods here and here. Anyway, sometimes you just want to take an existing test and quickly create a number of variants off of it to make a small regression suite (that you might even throw away later on). For example – you could have a basic test that does some CPU writes and then drives random frames. During configuration you write to a register that sets the FIFO level and you want to have 10 different tests, each writes a different value to this register.

Autodup is a neat utility can help you do that. What it does is stupidly simple, but it can still save you a bit of copy/paste headache.

 

Let’s see how it works. Here’s an excerpt from the test you want to duplicate (fifo_lvl.sv):

 

…
cpu_xactor.write_register(FIFO_LEVEL,30);
...

 

Now you want to have 10 different tests, each writes a different value to that register. No problem! Use the magic pattern:

…
cpu_xactor.write_register(FIFO_LEVEL,__AUTODUP{10,20,30,40,50,60,70,80,90,100});

...

 

Now run the utility:

% ./autodup fifo_level.sv

 

And voila! You get 10 different tests:

In fifo_level_10.sv you’ll have: cpu_xactor.write_register(FIFO_LEVEL,10);

In fifo_level_20.sv you’ll have: cpu_xactor.write_register(FIFO_LEVEL,20);

And so on…

 

Here’s another example:

 

Add the following magic pattern in fifo_level.sv:

…
if (something) __AUTODUP{func1(),func2(),x=y,$finish};

...

 

Use the –i option now to get friendly file names:

% ./autodup fifo_level.sv -i

 

And Voila:

fifo_level_1.sv: if (something) func1();

fifo_level_2.sv: if (something) func2();

fifo_level_3.sv: if (something) x=y;

fifo_level_4.sv: if (something) $finish;

 

To download Autodup simply click on the attachment below. After you download, please run %./autodup -help to get started, it's very easy.
If you encounter any problems or bugs, please let us know so we can get it fixed for you.

Attachments:
FileDescriptionFile size
Download this file (autodup.txt)AutoDupCreate test variants automatically3 Kb
 
More articles :

» Ignorance Is A Bliss

There is a rather confusing feature in Specman’s coverage engine that I would like to share with you today. I’ve met several people (including myself) who had been struggling to understand what was going on there and gave up Recently I was...

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

» How To Validate Type-Casting In OVM-e

Before type-casting an e variable ("as_a"), we often want to check the validity of the operation (this is quite similar in concept to $cast in SystenVerilog). The reason is simple, in case the casting operation failed we would end up with a fatal...

» Get On The Buss

Wow, it’s been a while since we last had a good old techie talk about Specman so why not now? Today I’d like to focus on applying reuse to Specman external ports. Very much like little caterpillars, DUTs often have tens or even hundreds of pins...

» Get Hooked

Changing an existing eVC for new project requirements is a grueling task. It’s really painful for any eVC developer to witness his creation being torn apart by an end user, but a little prudence from the developer can result into longevity of eVC....

Comments  

 
0 #1 2010-04-07 17:46
Why the obfuscated variable names in the Perl source?
Quote
 
 
0 #2 2010-04-08 04:54
Hi Paddy, thanks for you question. I hope you tried out the script and found it useful. At this point we'd like to encourage people to try out the script and report bugs to us. If you'd like to get the source code drop me a line.
Yaron
Quote
 
 
0 #3 2010-06-19 10:08
Hi Yaron, I have looked at the tool and I actually wonder why someone might need a script to generate a series of values? I would have thought that SystemVerilog already comes with such built in feature. AFAIK you could easily set up conditional constraints to achieve exactly what has been described in the article. Then if you want it to be more deterministic, why not use seed values to get the tests more directed?
Daniel
Quote
 
 
0 #4 2010-06-19 16:32
Hi Daniel, thanks for your questions. Indeed, random generation + constraints + coverage is a wonderful way to generate a series of values (check out the special randc modifier). However, like I said in the beginning of the article - if you're using a directed testing approach (suitable for some system level scenarios) or if you want to create a "quick regression" suite - you normally have to duplicate code.
This utility saves you the overhead of copy-pasting, renaming the files and potentially introducing typos or other errors.

I hope this clarifies things a bit
Yaron
Quote
 
 
0 #5 2010-06-20 15:36
Yaron,
In some situation, this script can give a quick sweep as you want, if use constraint , it needs more code to transfer variable. The script can sweep not only variable but also "function" (any code), however it generate many testcases as possible. I have a question here, how many __AUTODUP does it support in a file? If I define 2 __AUTODUP, and each have 3 sweep points, will it generate 3X3 testcases finally?
Quote
 
 
0 #6 2010-06-20 18:12
Good question.
Unfortunately at the moment you can use only one AUTODUP per source file. I will take this into consideration for next releases.
Thanks for trying it out and thanks for your input! You may want to check out the other free utility to add nice endfunction and endtask labels automatically.

Cheers,
Yaron
Quote
 

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.