Chap2 Book

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

LOOP BOUND AND ITERATION BOUND 45

(1)
dl
d2
(1)
d3
(1)

Fig. 2.2 A DFG with three loops that have loop bounds of 4/2 u.t., 5/3 u.t., and 5/4
u.t. The iteration bound for this DFG is Too ;::: 2 u.t.

The critical path of a DFG is defined to be the path with the longest
computation time among all paths that contain zero delays. The critical path
in the DFG in Fig. 2.1(b) is the path A -+ B, which requires 6 u.t. The DFG
in Fig. 2.2 contains several paths with no delays. The maximum computation
time among these paths is 5 u.t. (the two paths 6 -+ 3 -+ 2 -+ 1 and
5 -+ 3 -+ 2 -+ 1 are both critical paths), so the critical path computation
requires 5 u. t. The critical path is the longest path for combinational rippling
in the DFG, so the computation time of the critical path is the minimum
computation time for one iteration of the DFG.
A DFG can be classified as nonrecursive or recursive. A nonrecursive DFG
contains no loops, while a recursive DFG contains at least one loop. For ex~
ample, an FIR filter is nonrecursive, while the DFG in Fig. 2.1(b) is recursive
because it contains the loop A -+ B -+ A. A recursive DFG has a funda-
mental limit on how fast the underlying DSP program can be implemented in
hardware. This limit, called the iteration bound, Too [1],[2], holds regardless of
the computing power available for the implementation of the DSP program.

2.3 lOOP BOUND AND ITERATION BOUND

A loop is a directed path that begins and ends at the same node, such as the
path A -+ B -+ A in Fig. 2.1(b). The terms "loop" and "cycle" are used
interchangeably to describe a directed cycle in a directed graph. The amount
of time required to execute a loop can be determined from the precedence
relations described by the edges of the DFG. For the DFG in Fig. 2.1(b), the
46 ITERATION BOUND

2D 2D
(a) (b)
Fig. 2.3 (a) A DFG with one loop that has a loop bound of 6/2 = 3 u. t. The iteration
bound for this DFG is 3 u.t. (b) A DFG with iteration bound Too = max{6/2, 11/1} =
11 u.t.

edges describe the precedence constraints

where single arrows (-+) represent intra-iteration precedence constraints and


double arrows (:::}) represent inter-iteration precedence constraints. According
to these precedence constraints, iteration k of the loop consists of the sequen-
tial execution of Ak and B k. Given that the execution times of nodes A and B
are 2 and 4 u.t., respectively, one iteration of the loop requires 6 u.t. This
is the loop bound, which represents the lower bound on the loop computation
time. Formally, the loop bound of the l-th loop is defined as tdWI' where tl
is the loop computation time and WI is the number of delays in the loop. We
can verify that the loop bound for the loop in Fig. 2.1(b) is 6/1 = 6 u.t.
The loop in Fig. 2.3(a) has two delays, requires 6 U.t. to compute, and has
a loop bound of 6/2 = 3 u.t. To see how one iteration of this loop can be
executed in 3 u.t., we need to examine the precedence constraints

Ao -+ Bo :::} Az -+ B z :::} A4 -+ B4 :::} At> -+ .. .


Al -+ Bl :::} A3 -+ B3 :::} A5 -+ B5 :::} AT -+ .. .

This shows two independent sets of precedence constraints, one set for the
even iterations and one set for the odd iterations. In this case, two iterations
can be computed in 6 u.t., resulting in a loop bound of 6/2 = 3.
The DFG in Fig. 2.3(b) contains two loops, namely, the loops II = A -+
B -+ A and lz = A -+ B -+ C -+ A. The loop bounds for hand lz are
6/2 = 3 u.t. and 11/1 = 11 u.t., respectively. The critical loop is the loop
with the maximum loop bound, so the loop lz is the critical loop in this
example. The loop bound of the critical loop is the iteration bound of the
DSP program, which is the lower bound on the iteration or sample period of
the DSP program regardless of the amount of computing resources available.
ALGORITHMS FOR COMPUTING ITERATION BOUND 47

Formally, the iteration bound is defined as

Too = max {~}, (2.1)


IEL WI

where L is the set ofloops in the DFG, tl is the computation time of the loop t,
and WI is the number of delays in the loop t. For the DFG in Fig. 2.3(b) we
have
6 T
Too = max { 2' 11} = 11 U.t.

A straightforward technique for finding the iteration bound of a DFG is to


locate all loops and directly compute Too using (2.1); however, the number
of loops in a DFG can be exponential with respect to the number of nodes,
so this technique can require long execution times. Three techniques have
been developed for computing Too in polynomial time, namely the longest
path matrix algorithm [3], the minimum cycle mean algorithm (4], and the
negative cycle detection algorithm [5]. The first two techniques are described
in Section 2.4.

2.4 ALGORITHMS FOR COMPUTING ITERATION BOUND

The two iteration-bound algorithms described in this section are demonstrated


using the DFG in Fig. 2.2. This DFG has three loops: loop II = 1 -t 4 -t
2 -t 1 with loop bound 4/2 u.t., loop l2 = 1 -t 5 -t 3 -t 2 -t 1 with loop
bound 5/3 u.t., and loop l3 = 1 -t 6 -t 3 -t 2 -t 1 with loop bound 5/4 u.t.
Therefore, the iteration bound of this DFG is

Too = max { ;, ~, ~} = 2 u. t.

2.4.1 Longest Path Matrix Algorithm

In the longest path matrix (LPM) algorithm [3], a series of matrices is con-
structed, and the iteration bound is found by examining the diagonal elements
of the matrices. Let d be the number of delays in the DFG. These matrices,
L(m), m = 1,2, ... , d, are constructed such that the value of the element
l~J) is the longest computation time of all paths from delay element di to
delay element dj that pass through exactly m - 1 delays (not including di and
dj). If no such path exists, then l~J) = -1. Note that longest path between
any two nodes can be computed using any path algorithm in Appendix A.
For example, to determine l~l~ for the DFG in Fig. 2.2, all paths from the
delay element d3 to the delay' element d1 that pass through exactly zero de-
lay elements must be considered. There is one such path, namely, the path
CONCLUSIONS 57

Fig. 2.11 An equivalent SRDFG for the MRDFG in Fig. 2.9.

same as the iteration bound of the MRDFG in Fig. 2.9.


Various techniques have been suggested to reduce the number of nodes and
edges in an equivalent SRDFG without affecting the iteration bound of the
graph. These reductions can be used to redute the complexity of determining
the iteration bound of the equivalent SRDFG, which directly leads to reduced
complexity for determining the iteration bound of the MRDFG. The inter-
ested reader can find algorithms for reducing the complexity of the equivalent
SRDFG in [4].

2.6 CONCLUSIONS

DSP programs have the property that they are executed from n = 0 to n = 00.
These programs are often represented using DFGs, which can be recursive or
nonrecursive. When the DFG is recursive, the iteration bound is the fund a-
mental limit on the minimum sample period of a hardware implementation of
the DSP program. Two algorithms for computing the iteration bound were

You might also like