Home SystemVerilog Ignorance Is A Bliss

Search

Ignorance Is A Bliss PDF Print E-mail
User Rating: / 0
PoorBest 
Thursday, 24 December 2009 15:29

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 called to the rescue again with the same problem so I guess it’s a good opportunity to tell you guys about it.

 

So imagine you have a struct called packet. And in the packet you have a length field which could be anything from 0 to 255. You’re doing a lot of things with this packet in your environment and you also want to add some coverage. Let’s see some code:

struct packet {
length: byte;
 event cover_me;
 cover cover_me is {
 item length;
 };
};

Very simple so far. Next we want to limit the coverage spectrum of this item because we’re not interested in values over 100. We will use the ignore command for that:

item length using ignore = length > 100;

For the less experienced guys out there - note that the coverage commands ignore and when may look as two alternatives for limiting the coverage collection, but in fact they are fundamentaly different from each other and should be used for different purposes. The ignore command is used to narrow down the coverage spectrum while the when command is used to narrow down the number of coverage collection occurrences.

Back to our business, after we’ve narrowed down the coverage spectrum to values below 100 only, we want to have an additional limitation, and ignore values under 90.  Let’s do this:

item length using ignore = length > 100, ignore = length < 90;

You think this is going to work? Not really. The code will compile and run successfully but the coverage engine will only take into consideration the last ignore command. Really disappointing. This problem typically arises with more complex items such as cross items.

 

Now for the good news: the workaround is to write all your ignores in one (long) line Not so comfortable with complex items, but it’s the only way it will work. Also, make sure to use or (and not and) as a separator between adjacent ignore conditions because we’re dealing with inverse logic here.

So let’s conclude with the full example again, and a few lines of code that demonstrate it (you’re gonna have to open the coverage window to see this).

 

Here we go:

 

struct packet {
 length: byte;
 event cover_me;
 cover cover_me is {
 item length using 
 // the 2 lines below will NOT do the job
 //ignore = length > 100, // this ignore will be ignored !!
 //ignore = length < 90;
 // the line below WILL do the job 
 ignore = length > 100 or length < 90;
 };
 };
extend sys {
 !packet: packet;
 run() is also {
 for i from 1 to 100 {
 gen packet; 
 emit packet.cover_me;
 };
 };
 };

 

 
More articles :

» To Randomize Or Not To Randomize

One of my former colleagues once revealed the fact that she had no less than 70 pairs of shoes. That’s right, seventy! She had been very good at her job and by no means had any plans to start her own shoe business so I asked myself why on earth...

» Eternal Sunshine of the Verifier's Mind

To be successful in verification you not only need to possess the right technical skills, but you also need to possess the right mindset. Possessing the right mindset will lead you to success rapidly. Here are 3 things that I’ve found very...

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

» Get Organized Even On Windows

Here’s a cool (and free) application that can make your life a bit more organized if you tend to have many open windows.

» VMM Hackers Guide - Shutting Down Atomic Generators

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

Comments  

 
0 #1 2010-01-02 05:09
Or you can use the "in" and range to make the code look nicer.

e.g. ignore = length not in [90..100];
Quote
 
 
0 #2 2010-01-03 15:53
from the post it can be understood that you must write the all ignores on an item in one place,
but this is not true since you can use "prev"
cover cover_me is {
05. item length using
10. ignore = length > 100;
11. };
12. };

cover cover_me is {
05. item length using
10. ignore = prev or length < 90;
11. };
12. };
Quote
 
 
0 #3 2010-01-03 17:05
Quoting Horace Chan:
Or you can use the "in" and range to make the code look nicer.

e.g. ignore = length not in [90..100];


Correct. Like I mentioned in the article, this problem typically arises with more complex items such as cross items.
Quote
 
 
0 #4 2010-01-03 17:10
Thanks for the insight, Ronen. But what if you don't want to extend the cover group, you just want to refine the original ignore statement with additional ignores separated by comma?
Quote
 

Add comment


Security code
Refresh

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