• Aucun résultat trouvé

An Application: LFSRs and Massey's Algorithm 51

Dans le document Methods and Algorithms for (Page 91-96)

I such that

3.9 An Application: LFSRs and Massey's Algorithm 51

(a) Block diagram

(b) Output sequence

(c) Alternate block diagram

(d) Output sequence for alternative real~zation Figure 1.22: A binary LFSR and its output

j

I

Y ; - I Y ; - 2 . ~ ; - 3

I

Y j (output) '

could clearly be obtained from an LFSR of Length N, each storage element containing one of the values. However, this may not be the shortest possible LFSR. Another approach to the system synthesis is to set up a system of equations of the following form (assuming that the length of the LFSR is p = 3):

0

I

00 1

These equations are in the same form as the Yule-Walker equations in (1.16); in particular, the matrix on the left is a Toeplitz matrix. Whereas the Yule-Walker equations were orig- inally developed in this book in the context of a stochastic signal model, we observe that there is a direct parallel with deterministic autoregressive signal models.

Knowing the value of p, the Yule-Walker equations could be solved by any means available to solve p equations in p unknowns. However, directly solving this set of equations is inefficient in at least two ways:

1

52 Introduction and Foundations

1. A general solution of a p x p set of equations requires O ( p 3 ) operations. We are interested in developing an algorithm that requires fewer operations. The algorithm we develop requires 0 ( p 2 ) operations.

2. The order p is not known in advance. The value of p could be determined by starting with a small value of p , and increasing the size of the matrix until an LFSR is obtained that produces the entire sequence. This could be done without taking into account the result for smaller values of p. More desirable would be an algorithm that builds recursively on previously-obtained solutions to obtain a new solution. This is, in fact, how we proceed.

Since we buildup the LFSR using information from prior computations, we need a notation to represent the polynomial used at different stages of the algorithm. Let

denote the feedback connection polynomial for the LFSR capable of producing the output sequence { y o , yl ,

. . .

, y,-I}, where L , is the degree of the feedback connection polynomial.

The algorithm we obtain provides an efficient way of solving the Yule-Walker equations when p is not known. In chapter 8 we encounter an algorithm for solving Toeplitz matrix equations with fixed p , the Levinson-Durbin algorithm. A third general approach, based on the Euclidean algorithm, is also known (see, e.g., [36]). Each of these algorithms has

o ( ~ * )

complexity, but they have tended to be used in different application areas, the Levinson- Durbin algorithm being used most commonly with linear prediction and speech processing, and the Massey or Sugiyama algorithm being used in finite-field applications, such as error-correction coding.

1.9.2 Massey's algorithm

We build the LFSR that produces the entire sequence by successively modifying an existing LFSR, if necessary, to produce increasingly longer sequences. We start with an LFSR that could produce yo. We determine if that LFSR could also produce the sequence { y o . y , } ; if it can, then no modifications are necessary. If the sequence cannot be produced using the current LFSR configuration, we determine a new LFSR that can produce the entire sequence.

We proceed this way inductively, eventually constructing an LFSR configuration that can produce the entire sequence { y o , y1, . .

.

, y ~ - ~ } . By this process, we obtain a sequence of polynomials and their degrees,

where the last LFSR produces { y o , . . . , Y N - I } .

At some intermediate step, suppose we have an LFSR C i n l ( D ) that produces ( y o , y l , .

. .

, y n - l ) for some n < N . We check if this LFSR will also compute y, by com- puting the output

If

F,,

is equal to j,,, then there is no need to update the LFSR, and ~ ~ " " ' ~ ( 5 ) = Cln1(D).

3 ,Y An Application: LFSRs and Ylassey's Algorithn: 53

Otherwise, there is some nonzero dl.scrvnnc,y,

1=I I =o

In this case, we will update our LFSR using the formula

where A is some element in the field, 1 is an integer, and Ctrnl(D) is one of the prior LFSRs produced by our process that also had a nonzero discrepancy dm. Using thls new LFSR, we compute the new discrepancy, denoted by d i , as

Now, let 1 = n - m. Then the second summation gives

L m

A cj""y,,,-, = Ad,,,.

Thus. if we choose A = -d;'ct,, then the sunlmation in (1.66) gives

So the new LFSR produces the sequence { y o , yi , . . . , y,)

1.9.3 Characterization of LFSR length in Massey's algorithm

The update in (1.65) is, in fact, the heart of Massey's algorithm. From an operational point of view, no further analysis is necessary. However, the problem was to find the shortest LFSR producing a given sequence. We have produced a means of finding an LFSR, but have no indication yet that it is the shortest. Establishing this will require some additional effort in the form of two theorems. The proofs are challenging, but it is worth the effort to think them through.

(In general, considerable signal processing research follows this general pattern. An algorithm may be established that can be shown to work empirically for some problem, but characterizing its performance limits often requires significant additional effort.)

Theorem 1.1 Suppose thatan LFSRof length L, produces thesequence { y o , yl ,

. . .

, y,-I), but not the sequence { y o , y 1, . .

.

, y,}. Then any LFSR thatproduces the latter sequence must have a length L,+l satisfjling

L,+I 2 n

+

1 - L,.

Proof The theorem is only of practical interest if L, < n (otherwise it is trivial to produce the sequence). Let us take, then, L, < n . Let

c["'(D) = 1 + c P I D

+ .

. . + c F 1 D L n

represent the connections for the LFSR which produces {yo, yl , .

. .

, y,-I }, and let

54 Introduction and Foundations

denote the connections for the LFSR whlch produces {yo. y ~ . . . . , y,,]. Now we d o a proof by contradiction:

Assume (contrary to the theorem) that

Frorn the definltlons of the connection polynomials, w e observe that

and

From (1.69). we have

L, - 1

, = I

The lndlces In t h ~ r summation range from 12 - 1 t o n - L,,I whlch, because ofthe (contrary) assulnptlon made In ( 1 67), 1s a wbset of the range L,. L,,

+

1 .

.

n - 1 T l ~ u s , the equallty in ( I 6 8 ) applles, and we can wrlte

Interchanging the order of summailon we have

h=1

In this surumatlon the ~ n d t c e s range from 11 - 1 to n - L,, w h ~ c h . because of ( I 67), 1s a subset of the range L,,-[

+

1

.

rz of (I 69) Thus. we can wrlte

L,, L,,*l

\,, #

Cornpanng ( 1 7 0 ) wlth ( 1 7 1 ). we o b w v e a contradlctron Hence, tile aicumptlon on the length of the LFSRs mu\t have been Incorrect By thti contradlctlon. we muit have

S ~ n c e [he iliorteit LFSR that produce\ the iequence { l o . I 1

.

I , , ) mu\i al\o produce the hrst part of that \equence, we mu\t l>,~\e L,,,l

>

L,, C o n ~ b l n ~ n g thii w ~ t h the result of the theorem. b e oht'iin

L,,-1 L m a x ( L , , . i ~ + I - L,,) (1.72) In other word\. the {Ii~ft regl\ter c'tnnot become \hortcr '15 more output\ dre prctduced

! 3 An Application: LFSKs and Vlassej'? Algorithm 55

We have seen how to update the LFSR to produce a longer sequence uslng (1.65), and ,ilso have teen that there 1s a lower bound on the length of the LFSR. We now show that t h ~ s lower bound can be achieved wtrh equality, thus provid~ng the shortert LFSR that produces the deslred sequence

lheorem 1.2 Let {(L,

. clil(

D)). i = 0, 2,

.

i t } be a req~tence qfmrnlm~lm-length LFSRs

p h c ~ r produce dze requente (40, v l , ,

v,-

1 } If C [ n + ' l ( ~ ) f C["l(d), then n new LFSR can

[I? jo~incr' thut ~ u t i $es

L,,I = max(L,, n

+

1 - L,).

Proof We will do a proof by induction, taking as the inductive hypothesis that

tor k = 0, 1 , . . . , n. This clearly holds when k = 0. since Lo = 0.

Let m < n , denote the lust connection polynomial before c["'(D) that can produce the sequence {yo, y 1. . . . , y,-' } but not the sequence {yo, yl ,

. .

. , y,}, such that

Then

L, < L,.

Lrn+~ = L n ; hence, in light of (1.73),

L,+[ = L, = i n + 1 - L,. ( 1.74) If C~""I(D) is updated from C["~(D) according to (1.65), with 1 = n - m , we have already observed that it is capable of producing the sequence {yo, yl ,

.

. . , y, ). By the update formula (1.651, we note that

L,+I = max(L,, n

-

m

+

L,)

Using (1.74) we find that

L,+I = max(L,, n

+

1 - L,).

In the update step, we observe that if

then, using (1.73), cinf ' I has length L,,! = L,, that is, the polynomial is updated, but there 1s no change in length.

The shift-register synthesis algorithm, known as Massey's algorithm, is presented first in pseudocode as Algorithm 1 '1, where we use the notations

56 Introduction and Foundations

A MATLAB implementation of Massey's algorithm with computations over GF(2) is shown in Algorithm 1.2. The vectorized structure of MATLAB allows the pseudocode implementation to be expressed almost directly in executable code. The statement c = mod([c zeros(1,Lm

+

s - Lnjl + [zeros(l,sJpl,2); simplyalignsthe polynomials represented in c and p by appending and prepending the appropriate number of zeros, after which they can be added directly (addition is mod 2 since operations are in GF(2)). , (Note: opposlte from usdal Matlab order)

N = length(y);

% Initialize the variables

Dans le document Methods and Algorithms for (Page 91-96)