Subject: [sv-ec] Randomize of 4-state variables
From: Ryan, Ray (Ray_Ryan@mentorg.com)
Date: Fri Jun 20 2003 - 11:43:48 PDT
What is the result of randomization for 4-state variables?
In section 12 there are several examples of specifying the
'rand' property qualifier on a 4-state variable. For example
section 12.3 Random Variables contains the example code:
rand bit [7:0] len;
rand integer data[];
constraint db { data.size == len; }
However, there is no mention of whether X or Z values are
generated by the randomize() method.
By default, I'd expect that for each bit 0,1,X,Z have equal
probability. So the likelyhood of generating a value for a
32-bit integer with no X or Z bits would be very low.
If this is the case, is there a way to specify that a random
value generated for an 'integer' only contain 0,1,X because
a Z value would be invalid. I.E. you want to allow X but
not Z in the generated values. Other than:
rand reg [31:0] intg_val;
rand integer x;
constraint x01 { intg[0] inside {0,1,bX};
intg[1] inside {0,1,bX};
...
intg[31] inside {0,1,bX};
}
constraint c2 { x == intg_val; };
Or how would you constrain the generated values for the array
'data' above to not include X or Z (want valid/defined data).
- Ray
This archive was generated by hypermail 2b28 : Fri Jun 20 2003 - 11:45:40 PDT