'Is solve before needed with dist?
Section 18.5.10 in the IEEE Std 1800-2017 has the following example to illustrate why we need solve before:
rand bit s;
rand bit [31:0] d;
constraint c { s -> d == 0; }
Do the following 2 options still require solve before?
A.
rand bit s;
rand bit [31:0] d;
constraint c1 { d < 1000; }
constraint c2 { if ( s == 1 ) d == 0; }
B.
rand bit s;
rand bit [31:0] d;
constraint c1 { d < 1000;
if ( s == 1 ) d == 0;
}
constraint c2 { s dist { 0 :/ 95, 1 :/ 5 }; }
A naive reading of all the above would assume a 50% (5% for option B) chance of choosing s as 1, whereas the IEEE standard says you need a solve s before d constraint in the first example to get the 50% chance.
Do A and B need a solve before to get the expected 50%/5% chance of s being 1?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
