Array reduction sum method with clause overflow protection

In reply to kuki2002:

If you put the randomization in a repeat loop, you will see that all tools produce some results that overflow.

If the largest element of your array is 32’hFFFF_FFFF and there are 10 elements, you need to make sure that (32’hFFFF_FFFF * 4’hA) does not overflow. That means you need to sum the elements using a width of (32+4) = 36 bits or prevent overflow.