previous | contents | next


Fig. 6. Fortran program to test 8-bit RTM multiplier of Fig. 4.


To have a concrete task to discuss, Figure 7 gives an algorithm for taking a weighted average. The components of a data vector, X[i], are each multiplied by weights, W[i], which are then summed (forming the vector dot product) and divided by the total weight, W. We will assume that the data remains within 8 bits, to avoid distraction from the central points. Since multiplication is available and not division, we have written the flowchart to use multiplication by 11W. The weights are themselves constant, hence 1/W is a given constant, just as W is. Since we are working with integers, 11W will be a fraction between 0 and 1, hence not representable. However, we can simply take 11W to be the fractional part (as an integer), which is equivalent to rescaling the expression. Actually since such a representation will cause unnecessary errors, we would have to use the integer division system to do the task properly.

THE NATURAL MAPPING: MACROS

One can attempt to produce an RTM flowchart directly from Figure 7, just as we did for the multiplication itself. However, unlike Figure 3, not every component of Figure 7 is a primitive module -- in particular, the two

 

117

previous | contents | next