Home Articles Specman-e 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 :

» Packing In OVM-e

This example shows how to pack a struct into a list of Double Words (32 bit) keeping the original order. This time we got less talking, and more code:

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

» How To Choose Your Verification Service Provider

If you’re looking for an outsourcing solution for your verification problem then a quick look around will tell you that there are many alternatives out there. The number of verification contractors has grown rapidly over the recent years and today...

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

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

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 © 2017 Think Verification - Tips & Insights on ASIC Verification. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.