Hi All,
I am trying a constraint to ensure that probability of pattern 4’b1101 occurring exactly once within 16-bit random variable is 70%.
Remaining 30% of the time we don’t care
Here is my attempt.
To ensure that the constraints achieve the intention I purposely created a conflict via in-line constraint ( ptrn[6:0] == 7’b1101101 which has 2 occurrence of 4’b1101 )
However to my surprise there is no constraint failure !!
As noted in the multi-line comment in the edalink I observe::
(1) When local variable a in post_randomize is ‘d64 i.e bit 6 is set I observe that ptrn[9:6] is 4’b1101. Along with the in-line constraint, 4’b1101 occurs atleast 3 times in ‘ptrn’
(2) When local variable a in post_randomize is ‘d4096 i.e MSb bit 12 is set I observe that ptrn[15:12] is 4’b1101. Along with the in-line constraint, 4’b1101 occurs atleast 3 times in ‘ptrn’
(3) When local variable a in post_randomize is ‘d8 i.e bit 3 is set I observe that ptrn[6:3] is 4’b1101. Along with the in-line constraint, 4’b1101 occurs atleast 2 times in ‘ptrn’
As per intention I should have observed 4’b1101 exactly once when ptrn_present is set
Seeking suggestions for the same
Thanks