I am trying variation of array reduction method sum in a constraint to understand it’s equivalent expression in each scenario. Here is my attempt
Assume that out of C1 to C7 there is only one constraint active
My queries are as follows
(Q1) For C3 I observe there is No overflow. What is size and sign type for item.index ?
(Q2) For C4 due to RHS (10) being 32-bit, there is no overflow. Does parenthesis have any contribution in the constraint ?
(Q3) For C5 ::
(a) I observe different results across the 4 EDA tools. Randomization fails on 2 tools whereas it passes on 2 tools. What should the ideal output be ?
(b) What does the concatenation operator do in this case ?. As per LRM parenthesis has highest precedence followed by addition operator followed by == and then concatenation operator
(Q4) For C6 ::
(a) Will unpacked array arr iterate (5 times) without the presence of keyword item / item.index ?
A1) According to 7.12.4 Iterator index querying, the index type can be either an int or, for an associative array, it’s the same as the type of the array index.
A2) Since addition has precedence over equality, the parentheses don’t affect the result.
A3) Concatenation {} may have the lowest precedence, but the operands of a concatenation are all self-determined. This means that the width of the expression inside the concatenation is determined independently of the right-hand side of the equality. Consequently, the addition is evaluated in the context of a 2-bit width, which has a maximum value of 3, and this value can never equal 10. Therefore, this constraint always fails.
A4) This constraint is equivalent to 1+1+1+1+1, which evaluates to 5. Since 5 is a non-zero value, the constraint considers it a success. A constraint that always evaluates to a non-zero value is considered a non-constraint.
A5) This constraint is equivalent to the expression 0+0+0+0+0, which evaluates to 0. Since the constraint considers a zero value as a failure, it fails.