I’m trying to constrain the result of A & B to be unique.
Here A and B are array of rand bit [31:0] type.
rand bit [31:0] A[8];
rand bit [31:0] B[8];
rand bit [31:0] C[8];
constraint c_tmp {
foreach(C[i])
C[i] == (A[i] & B[i]);
}
constraint c_unique {
unique {C};
}
Above is my code. I found in my regression. C could not unique in some case.
Is there anything wrong ?
In reply to shanshan:
Can you give us a complete example and show results that you were not expecting. I find it hard to believe you would get a repeating value for C[Ii] given there are 232-1 possible values. Also, you probably meant to write the constraint with parenthesis
C[I] == (A[i] & B[i]);
In reply to dave_59:
In reply to shanshan:
Can you give us a complete example and show results that you were not expecting. I find it hard to believe you would get a repeating value for C[Ii] given there are 232-1 possible values. Also, you probably meant to write the constraint with parenthesis
C[I] == (A[i] & B[i]);
sorry, dave, correct my words.
I check my result again. C could be unique value. But the equation C = A & B does not meet.
My VCS version is 2017-12-01-sp2-1
In reply to dave_59:
And Dave, the relative code are all here as above. I’m also very strange with the result.
In reply to dave_59:
Oh, I find the issue. Thanks Dave, I forget my bracket. Pity…