User manual
Tutorial: Using the logic estimator
The replicated par{} builds a copy of the line of code it contains for every tap in the FIR, and all the
lines are executed in parallel. The results from the parallel multiplications are stored in the
MultResults array, and are added together by a call to the RecurseAdd macro as shown below:
Accumulator = RecurseAdd(MultResults, Taps-1);
RecurseAdd is a recursive macro expression which is passed an array and the index of the top element
of that array. It will add all the elements of the array together in a single cycle and return the result. The
definition is shown below. This macro takes the top element off the array (specified by
Index) and adds
to to the result of another call to
RecurseAdd, which is passed Index-1, until the final call, when the
last element of the array is returned instead of any further calls to the macro being made.
macro expr RecurseAdd(Array, Index) =
Array[Index] + select(Index == 1, Array[0] , RecurseAdd(Array,
Index-1));
This version of
RecurseAdd is not optimal, as the adder tree which it will build is as shown below:
result
7 6 5 4 3 2 1 0
ADDER TREE BUILT BY RECURSEADD
www.celoxica.com
Page 108