next up previous [pdf]

Next: Circuit Design: Basic Arithmetic Up: Customized Number Representations Previous: Customized Number Representations


Profiling

In the profiling stage, the major objective is to collect range and distribution information for the variables. The idea of our approach is to instrument every target variable in the code, adding function calls to initialize data structures for recording range information and to modify the recorded information when the variable value changes.

For the range information of the target variables (variables to map into the circuit design), we keep a record of four specific points on the axis, shown in figure 2.

axis
Figure 2.
axis
[pdf] [png]

The points $a$ and $d$ presents the values far away from zero, i.e., the maximum absolute values that need to be represented. Based their values, the integer bit-width of fixed-point numbers can be determined. Points $b$ and $c$ represent the values close the zero, i.e., the minimum absolute values that need to be represented. Using the minimum and maximum values, the exponent bit-width of floating-point numbers and integer bit-width of logarithmic numbers can be determined.

For the distribution information of each target variable, we keep a number of buckets to store the frequency of values at different intervals. Fig. 3 shows the distribution information recorded for the real part of variable wfld (a complex variable). In each interval, the frequency of positive and negative values are recorded separately. The results show that, for the real part of variable wfld, in each interval, the frequencies of positive and negative values are quite similar, and the major distribution of the values falls into the range $10^{-1}$ to $10^4$.

range-wfld
Figure 3.
Range distribution of the real part of variable `wfld'. The leftmost bucket with index$=-11$ is reserved for zero values. The other buckets with index$=x$ store the values in the range $(10^{x-1}- 10^x$.
range-wfld
[pdf] [png]

The distribution information provides a rough metric for the users to make an initial guess about which number representations to use. If the values of the variables cover a wide range, floating-point and logarithmic number formats are usually more suitable. Otherwise, fixed-point numbers shall be enough to handle the range.


next up previous [pdf]

Next: Circuit Design: Basic Arithmetic Up: Customized Number Representations Previous: Customized Number Representations

2007-09-18