RE: [sv-ec] RE: [sv-bc] 5.15.3 Array reduction methods - result type

From: Steven Sharp <sharp_at_.....>
Date: Mon Jul 31 2006 - 13:46:37 PDT
Shalom,

During discussion of the array methods in the SV-EC meeting today, we
realized that there is actually a way to force a sum to be done in a
wider width than the array elements, by using the "with" clause.

When you use a "with" clause, the thing that is summed is the expression
specified in that clause.  Presumably the width of the reduction method
result is the width of the expression in the "with" clause.  The default
when the clause is not provided is for the expression to be the array
item itself.  If that is not wide enough, you can provide a "with" clause
that has the same value as the item itself, but using one of the usual
tricks for forcing that value to be wider.  For example:

  logic bit_arr [1024];
  
  total = bit_arr.sum with (item + 0);
  
By adding the 32-bit constant 0, the items will be extended to 32 bits
before being summed.  It may not be obvious or pretty, but it turns out
it can be done.

Steven Sharp
sharp@cadence.com
Received on Mon Jul 31 13:54:15 2006

This archive was generated by hypermail 2.1.8 : Mon Jul 31 2006 - 13:54:23 PDT