RegisterLogin  
Update Profile
   
You are here: Forum  
Minimize 
SVUG Community Forum
Subject: SV Coverage Sequence: Bad Pointer Access Error
Prev Next
You are not authorized to post a reply.

Author Messages
ETHANUser is Offline

Posts:1

03/18/2009 6:24 PM  

Hi,

 

This question relates to SV coverage sequences. I’m encountering a bad pointer access error when I try to compare for coverage sequences that are long and could potentially have a recursive effect. For example, the following sequence causes a bad pointer access.

 

       bins usb_downstream_host_sof = (

                                                      DNS_HOST_SOF => PACKET_X [*0:1] =>

                                                      DNS_HOST_SOF => PACKET_X [*0:1] =>

                                                      DNS_HOST_SOF => PACKET_X [*0:1] =>

                                                      DNS_HOST_SOF => PACKET_X [*0:1] =>

                                                      DNS_HOST_SOF => PACKET_X [*0:1] =>

                                                      DNS_HOST_SOF => PACKET_X [*0:1] =>

                                                      DNS_HOST_SOF => PACKET_X [*0:1] =>

                                                      DNS_HOST_SOF => PACKET_X [*0:1]

                                                    );

 

The above sequence looks for SOF, followed by PACKET_X zero or one time (i.e. it’s optional), followed by SOF, etc. The entire sequence looks for 8 SOFs and 8 PACKET_Xs. The recursive aspect of this sequence is that after the first SOF, subsequent finding of another SOF will start another thread of sequence comparison while the first sequence is confirming a match for the second SOF. This process could create multiple parallel sequence comparisons for the same bin.

 

The simulation memory usage appears to be reaching 3.2G or higher just before the bad pointer access occurs. Is this an inherent limit of the SV coverage sequences scheme? Has anyone encountered a similar problem in the past and can suggest ways to resolve or work around this?

 

Thank you for your time and help!

 

Ethan

JASONUser is Offline

Posts:13

04/10/2009 3:52 AM  
Hi Ethan

(this reply just summarizes our off-forum thread about this)

As you've discovered, covergroups although quite expressive, don't handle sequences as well as SVA for this sort of thing.

If I understand the problem correctly, you probably want the equivalent of a first_match() on the sequence (DNS_HOST_SOF => PACKET_X [*0:1]) repeated 8 times (in this case). This is verbose to express in a covergroup in the first place, but also there is no way to bomb out of collection after the first match of the sequence. Presuming of course you don't care about the other threads that are part way through collection.

For a (hopefully) simulator independent solution, you can stop collection programatically when your coverage goal is reached. Normally collection continues, even although the goal has been met. You can do it by calling stop() on the coverpoint concerned, or putting some sort of control in an 'iff' condition in the coverpoint, to stop further evaluation. Both ways require you to call the get_inst_coverage() function on the coverpoint, to determine coverage has been met.

e.g. assuming the covergoup is in a class and there is some sort of coverme() function that can be called to trigger the functional coverage sample(s).

covergroup cg1;
   cp1 : coverpoint ... {
      bins usb_downstream_host_sof = (
         DNS_HOST_SOF => PACKET_X [*0:1] =>
         ... ) iff (first_match_usb_downstream_host_sof
);
   } // cp1
   ...

Then in the class coverme() function you want to test if the coverpoint goal has been met (100%), and if it has, turn off collection on that coverpoint.

function coverme(...);
   ...
   if ((first_match_usb_downstream_host_sof == 1) &&
       (cg1.cp1.get_inst_coverage == 100) begin
     
first_match_usb_downstream_host_sof = 0; // ensures cp1 doesn't fire anymore
   end
   ...
   cg1.sample();
endfunction

Or you could also do it without the 'iff' clause and '
first_match_usb_downstream_host_sof' doing something like this:

function coverme(...);
   ...
   if (cg1.cp1.get_inst_coverage == 100) begin
       cg1.cp1.stop(); // ensures cp1 doesn't fire anymore but still retains the results already collected.

   end
   ...
   cg1.sample();
endfunction


I wouldn't say this is something I'd do often, but when you want to control a greedy coverpoint, it'll certainly do the trick.

Jason

--
www.verilab.com



You are not authorized to post a reply.
Forums > General Discussion > Main Discussion Area > SV Coverage Sequence: Bad Pointer Access Error



ActiveForums 3.7
  

 Copyright 2008 by SystemVerilog User Group Contact Us    Privacy Statement