• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Blogs
  2. Verification
  3. Tech Tip: Weighting Generation of "Extreme" Values
teamspecman
teamspecman

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
IntelliGen
Specman
Verification methodology
Functional Verification
Incisive
e
team specman
Aspect Oriented Programming
Incisive Enterprise Simulator (IES)
IES
AOP
IES-XL

Tech Tip: Weighting Generation of "Extreme" Values

21 May 2009 • 1 minute read

[Team Specman welcomes guest blogger Vitaly Lagoon, an Architect in the Generation Technology R&D group]

Consider the case where you have a generatable variable "x" taking random values from [0..99], i.e. all values are declared equal from the generation point of view.  However, imagine that from a verification perspective you are most interested in checking the extreme cases x==0 and x==99, as well as a few random values in between 0 and 99 for safety's sake.

One approach would be to capture this in a coverage definition by defining three buckets [0][1..98][99].  However, running this code would actually give you really bad coverage of the extreme ends of the range because the generator would hit the middle bucket 98 times out of 100.

Fortunately, there is an easy and effective alternative.  First, define a generatable variable – let’s call it 'range_x' in this example:

range_x :[min,max,others

then constrain it using:

keep (range_x==min) == (x==0);

   keep (range_x==max) == (x==99);

   // The third case is implied so, you don't need the constraint

Now, running with coverage on 'range_x' you will see things converge a lot faster -- in only five generation cycles we would have an 87% chance of filling all three ‘range_x’ buckets.  And in 10 cycles, the chance of filling all three buckets is 98%!  Clearly, making 'range_x' generatable has the effect of uniformly directing the solver towards one of the areas of interest.

Of course this example can be extended and specialized by using 'select' on 'range_x', e.g. you can easily put more weight on some buckets.

The general point: when taking coverage on generatable parameters it makes sense move the bucket (and also cross) definition out of coverage specification and into constraints.  The buckets defined in coverage only help to observe things, whereas the equivalent definition in constraints actually targets the generator towards the interesting stuff.

One final note: this example / capability is only available with IntelliGen.  With the legacy PGEN generator, the ordering of the fields would affect the order of generation.  Thus, if you did not define "range_x" before "x" (or use a specific gen(range_x) before (x) statement) then you would not see a uniform generation on "range_x".

Happy generating!

Vitaly Lagoon
Architect
Generation Technology R&D

 

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information