Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Constantinides G.A., Cheung P.Y.K., Luk W. - Synthesis and optimization of DSP algorithms (2004)(en).pdf
Скачиваний:
23
Добавлен:
15.08.2013
Размер:
1.54 Mб
Скачать

4.5 Optimization Strategy 2: Optimum Solutions

53

Set bestsig ← j, bestmin minval end if

end foreach

if bestmin < currentcost

nbestsig ← nbestsig 1 while bestmin < currentcost

end

Algorithm Word-LengthFalling will, in general, provide better results under a convex constraint space. However the non-convexities described in Section 4.3.1 should not a ect its operation too severely. The binary search mechanism will result in ‘jumping over’ infeasible portions of non-convex constraint space in some cases, and will remain stuck on one side of an infeasible region in other cases. In either case, since the word-lengths are only reduced by one bit each time, the next iteration will be facing the non-convexity from a di erent direction. Non-convexity can manifest itself in intermediate word-length vectors having infeasible error properties. However the final word-length vector will always be feasible, as moves are only ever performed in a direction leading to a feasible solution and the cost metric AG(n, p) is monotonic in n.

The overwhelming proportion of execution time in Algorithm WordLengthFalling is spent in the iterative refinement of the initial scaled-up uniform word-length solution. The average-case execution time will be discussed in Section 4.6.1.

4.5 Optimization Strategy 2: Optimum Solutions

The contribution of section is to present a technique for optimum word-length allocation, for the case where the DSP algorithm to be synthesized is a linear, time-invariant (LTI) system [Mit98].

The Mixed Integer Linear Programming (MILP) technique described in this section has been applied to several small benchmark circuits, and the results compared to the heuristic presented in Section 4.4. Modelling as a MILP permits the use of industrial-strength MILP solvers such as BonsaiG [Haf]. Although MILP solution time can render the synthesis of large circuits intractable, optimal results even on small circuits are valuable as benchmarks with which to compare heuristic optimization procedures.

The proposed MILP model contains several variables, which may be classified as: integer signal word-lengths and signal word-lengths before quantization, binary auxiliary signal word-lengths and auxiliary signal word-lengths before quantization, binary decision variables, real adder costs, and real fork node errors.

Note that only adders, gains, and delays cost area resources (forks are considered free). However adders have an inherently complex area model and

54 4 Word-Length Optimization

thus while gains and delays are included directly in the objective function, the cost of each adder v VA is represented by a distinct variable Av .

We are now in a position to formulate an area-based objective function for the MILP model (4.21), where cw(v) represents the coe cient word-length of gain node v.

min: v VA Av + v VG (k3cw(v) + k4)nin(v)

 

 

 

 

 

 

 

 

k4nout(v) + (k3 + k4)cw(v) +

k5nin(v)

(4.21)

v VD

Constraints on quantization error propagation are much harder to cast in linear form due to the exponentiation, shown in Section 4.1. In order to overcome this nonlinearity, we propose to use an additional binary variables, n¯, one for each possible word-length that a signal could take. This is expressed in (4.22), and (4.23) ensures that each signal can only have a single wordlength value. Here \ is used to denote set subtraction. Note that in order to apply this technique, it is necessary to know upper-bound word-lengths nˆs for each s S. Techniques to derive these will be discussed in Section 4.5.1. Note that signals which drive fork nodes are not considered in this way, as fork node error models are considered separately (see Section 4.5.3).

nˆs

 

 

 

b

· n¯s,b = 0

(4.22)

s S \ pred(VF ), ns

b

=1

 

 

 

nˆs

 

 

s S \ pred(VF ),

b

(4.23)

 

n¯s,b = 1

 

=1

 

Using these binary variables it is possible to re-cast expressions of the form 22nj , which appear in error constraints (see Section 4.1), into linear

form as nˆs 22bn¯j,b. Similarly it is necessary to linearize the exponentials

b=1

in word-lengths before quantization (4.24)–(4.25).

 

nˆsq

 

 

b

 

 

s S \ pred(VF ) \ succ(VF ), nsq

bn¯s,bq

= 0

(4.24)

 

=1

 

 

 

nˆq

 

 

 

s

 

 

s S \ pred(VF ) \ succ(VF ),

b

 

 

n¯s,bq

= 1

(4.25)

 

=1

 

 

For each system output, we propose to use an error constraint of the form given in (4.26). E represents the user-defined bound on the error power at the system output, and hence on the signal quality. Note that in this section

4.5 Optimization Strategy 2: Optimum Solutions

55

we only consider single-output systems, for simplicity of explanation, however the technique is easily extensible to multiple-input, multiple-output (MIMO) systems.

 

Ev +

 

 

 

 

22ps

 

v VF

 

s S\pred(VF )\succ(VF )\succ(VI )

 

 

 

 

 

nˆs

 

 

 

nˆsq

 

 

 

 

 

 

 

 

 

b

 

) +

 

L2

H

(z) ( 22bn¯

s,b

22bn¯q

 

 

2{

s

}

 

s,b

 

 

 

 

b=1

 

 

 

=1

 

 

 

 

22ps L22{Hs(z)}(

 

nˆs

22bn¯s,b 22nsq )

 

 

b=1

 

succ(V )

 

 

 

 

 

 

s I

 

 

 

 

12E

(4.26)

 

 

 

 

 

 

Note that those signals driven by system inputs are considered separately, since there is no need for Boolean variables representing the pre-quantization word-length of a variable, as this parameter is defined by the system environment. Place-holders Ev are used for the contribution from fork nodes; these will be defined by separate constraints in Section 4.5.3.

4.5.1 Word-Length Bounds

Upper bounds on the word-length of each signal, before and after quantization, are required by the MILP model in order to have a bounded number of binary variables corresponding to the possible word-lengths of a signal.

Our bounding procedure proceeds in three stages: perform a heuristic word-length optimization on the computation graph (Section 4.4); use the resulting area as an upper-bound on the area of each gain block within the system, and hence on the input word-length of each gain block; ‘condition’ the graph, following the procedure described in Section 4.1.1. The intuition is that typically the bulk of the area consumed in a DSP implementation comes from multipliers. Thus reasonable upper-bounds are achievable by ensuring that the cost of each single multiplier cannot be greater than the heuristically achieved cost for the entire implementation.

Of course this only bounds the word-length of signals which drive gain blocks. In addition, the word-length of signals driven by primary inputs is bounded by the externally-defined precision of these inputs. Together this information can be propagated through the computation graph, resulting in upper bounds for all signals under the condition that any closed loop must contain a gain block.

In the remainder of this paper, we denote by nˆs the so-derived upper bound on the word-length of signal s S and by nˆqs the upper bound on the word-length of the same signal before LSB truncation.

56 4 Word-Length Optimization

4.5.2 Adders

It is necessary to express the area model of Section 4.2 as a set of constraints in the MILP. Also a set of constraints describing how the word-length at an adder output varies with the input word-lengths is required.

In the objective function, the area for each adder v VA was modelled by a single variable Av . It will be demonstrated in this section how this area can be expressed in linear form.

Let us define βv for an adder v VA with input signals a and b (4.27), where the inputs ‘a’ and ’b’ are chosen to match with Fig. 4.1 (reproduced with more detail as Fig. 4.16) so that it is b which needs to be left-shifted for alignment purposes. sv is also illustrated in Fig. 4.16, and models the number of bits by which input b must be shifted.

 

 

 

βv = max(na − sv , nb)

 

(4.27)

a:

 

na

a:

 

na

 

 

S

 

S

nb

 

b: +

 

nb

s

b: +

 

s

S

 

 

S

 

 

 

 

 

m-1

nqo

 

 

m-1

nqo

 

 

 

S

 

 

 

S

 

o:

 

no

 

o:

 

no

 

 

S

 

 

S

 

 

 

(a)

 

 

 

(b)

 

a:

 

 

na

a:

 

na

 

 

S

 

S

 

 

b: +

 

nb

s

b: +

 

nb

s

S

 

 

S

 

 

 

 

 

m-1

nqo

 

 

m-1

nqo

 

 

 

S

 

 

 

S

 

o:

 

no

 

o:

 

no

 

 

S

 

 

S

 

 

 

(c)

 

 

 

(d)

 

Fig. 4.16. Multiple Word-Length Adder Types

We may then express the area of an adder as (4.28). Signal o is the output signal for the adder and mv models the number of MSBs of the addition

4.5 Optimization Strategy 2: Optimum Solutions

57

which are known through scaling to contain no information, as described in Chapter 3 and illustrated in Fig. 4.1. This value is independent of the wordlengths, and for an adder can be expressed as mv = max(pa, pb) + 1 − po.

A =

 

no + mv

β + 1

(4.28)

v

 

k1(no + 1) + k2

[β − mv − no + 1] ,

 

k1 [β mv + 2] ,

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

otherwise

The non-linearities due to the max operator in (4.27) and the decision in (4.28) must be linearized for the MILP model. This is achieved through the introduction of four binary decision variables δv1, δv2, δv3 and δv4 for each adder v VA.

For the remainder of this section, we consider a general adder with inputs i and j and output o, to distinguish from the more specific case considered above, where input b was used to denote the left-shifted input to an adder. In order to model (4.27), if pj ≤ pi then (4.29)–(4.32) are included in the MILP. Otherwise (4.33)–(4.36) are included in the MILP. The right-hand side of each inequality consists of a trivial bound on the left-hand side, multiplied by a decision variable.

ni − nj + pj − pi < δv1ni + pj − pi)

(4.29)

βv − nj + pj − pi (1 − δv1)(−nˆj − pi + pj )

(4.30)

ni − nj + pj − pi ≥ δv2(−nˆj + pj − pi)

(4.31)

βv − ni (1 − δv2)(−nˆi)

(4.32)

nj − ni + pi − pj < δv1nj − pj + pi)

(4.33)

βv − ni + pi − pj (1 − δv1)(1 − nˆi − pj + pi)

(4.34)

nj − ni + pi − pj ≥ δv2(−nˆi + pi − pj )

(4.35)

βv − nj (1 − δv2)(−nˆj )

(4.36)

Note that βv and αv are only bounded from below by the constraints given. Inequalities are used in order to allow disjunctions and thus implications, for example selecting δv1 = 0 in (4.29) gives ni −nj +pj −pi < 0, whereas selecting δv1 = 1 gives βv − nj + pj − pi 0. Allowing δv1 as an optimization variable results in ni ≥ nj − pj + pi βv ≥ nj + pj − pi. Equality of Av is guaranteed through its positive coe cient in the objective function.

In order to model (4.28), (4.37)–(4.40) are included in the MILP. These terms model the choice in (4.28) as a pair of implications, in an identical manner to that described above.