on k-stable feedback shift registers

9
IEEE TRANSACTIONS ON COMPUTERS, JULY 1969 On k-Stable Feedback Shift Registers ABRAHAM LEMPEL, MEMBER, IEEE Abstract-A state graph (SG) is a directed graph with exactly one arc issuing from every vertex of the graph. The degree of an SG is the smallest integer d such that at most d, arcs are entering any vertex of the graph. An SG is said to be k-stable if it contains k> 1 cycles of unit length (loops) and these are the only cycles of the graph. A k-stable SG with mn vertices and degree d is called a (k, m, n)-SG if m> k, d and if the distance from any vertex to a loop of the graph is at most n. This note deals with (k, m, n)-SGs and their realization by feedback shift registers with the minimum possible number of stages. Necessary and sufficient conditions under which a given (k, m, n)- SG has a minimal realization are derived and an efficient realiza- tion procedure is presented. Index Terms-Feedback shift registers, minimal realization of a stable FSR, sequential machines, state graphs. I. INTRODUCTION The state graph (SG) of an autonomous sequential machine (SM) is a directed graph depicting all the pos- sible state transitions in the machine. Distinct states of the SM are represented by distinct vertices (states) of the SG and a possible transition from state x to state y is indicated by an oriented arc issuing from x and enter- ing y. x is called a predecessor of y and y is called the successor of x. Each state has exactly one successor but may have no, or several, predecessors. The SG of an SM will be denoted by the couple (X, F) where X is the set of states and F is the so-called next-state operator of the machine. Formally, r is a mapping of X into X defined by xF =y iff yEX is the successor of xCX. Throughout this paper, the set X is assumed to be finite and no distinction is made between a given SM and its SG. The set of predecessors of a state x will be denoted by xr-l. The ith, nonnegative power ri of r is defined recursively by xFo=x for every xCX and ri=ri-lr, i > 1. A cycle of length p in (X, r) is a closed sequence of p distinct states x1,- -, xP such that xPF =x1 and xip=xi+1, i =1, * * - , p-1. Since X is finite, one may readily verify that each maximal connected piece of the SG (X, F) contains exactly one cycle. A cycle of unit length is called a loop (equilibrium state). Thus, x&X is a loop of (X, r) if xr =x. An SG is called k-stable if each of its cycles is a loop and the number of loops is k. If k = 1, the SG is called stable. The height of a k-stable SG is the smallest integer h such that for every xeX, xrh is a loop. The height of a state x is the smallest integer h(x) such that xrh(x) is a loop. The (in-)degree of (X, F) is an integer d, equal to the maximum number of states in X which have a common successor. Manuscript received March 18, 1968; revised February 20, 1969. This research has been supported in part by the Air Force Office of Scientific Research through the European Office of Aerospace Re- search, O.A.R., U.S. Air Force, under Grant AF EOAR 67-21. The author is with the University of Southern California, Los Angeles, Calif. on leave of absence from the Technion-Israel In- stitute of Technology, Haifa, Israel. I f eedback logic f (x) Fig. 1. General form of an autonomous a unit delay. 0000 00003 FSR. Di, i=1, * * * , n, is Il0 1S 10 10 lol Fig. 2. The SG of a (2, 2, 4)-FSR. A k-stable SG of height h and degree d is called a (k, m, n)-SG if m and n are integers such that m> k, d, n>h and |X| =m . This paper deals with (k, m, n)-SGs and their realiza- tion by feedback shift registers. An autonomous feed- back shift register (FSR) is a highly specialized SM, distinguished by its structural simplicity. The general form of an m-ary, n-stage FSR is shown in Fig. 1. The m-ary n-tuple x = (xi, * *, xn) is the state of the FSR, where xi(M= {0, 1, * * , m-1}, i= 1, * * *, n, is the output of the ith unit-delay stage Di. The input into Di is xi+,1, ii1, * * * , n-1, and the input into Dn is f(x) =f(x1, * * *, x.), wheref is an m-ary function, called the feedback function of the FSR. If x=(x1, - * - , x,n)is the present state of the FSR, then the successor of x, i.e., the state after one unit time, will be (X2, * * - , x,n f(x)). The SG of an m-ary, n-stage FSR will be denoted by the couple (Vmn, F). The set of states Vmnn= Mn is the set of mn n-tuples formed by the nth Cartesian power of M and the next-state operator F is the mapping of Vmn into Vmn defined by the feed- back function f. It is readily observed that every state of (Vmn, F) may have at most m predecessors and that the only states which may be loops are n-tuples of the form c = (c, c, . * * , c), with all components equal to cEM. Consequently, an m-ary FSR may have at most m dis- tinct loops and if the FSR is k-stable then k <im. An m-ary, n-stage, k-stable FSR with height h<n will be referred to as a (k, m,n)-FSR. Note that this def- inition is consistent with that of a (k, m, n)-SG. The SG of a (2, 2, 4)-FSR is shown in Fig. 2. An SG (X, r) is said to be FSR-realizable if there exist an FSR (VJmn, F) and a one-to-one mapping (mono- morphism) R of X into V.mn such that for every x&X, (xR) F = (xr)R. Such a mapping R, when it exists, will be called a realization of (X, F) by (Vmn, F). Given the parameter 652

Upload: a

Post on 23-Sep-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: On k-Stable Feedback Shift Registers

IEEE TRANSACTIONS ON COMPUTERS, JULY 1969

On k-Stable Feedback Shift RegistersABRAHAM LEMPEL, MEMBER, IEEE

Abstract-A state graph (SG) is a directed graph with exactlyone arc issuing from every vertex of the graph. The degree of an SGis the smallest integer d such that at most d, arcs are entering anyvertex of the graph. An SG is said to be k-stable if it contains k> 1cycles of unit length (loops) and these are the only cycles of thegraph. A k-stable SG with mn vertices and degree d is called a(k, m, n)-SG if m> k, d and if the distance from any vertex to aloop of the graph is at most n.

This note deals with (k, m, n)-SGs and their realization byfeedback shift registers with the minimum possible number of stages.Necessary and sufficient conditions under which a given (k, m, n)-SG has a minimal realization are derived and an efficient realiza-tion procedure is presented.

Index Terms-Feedback shift registers, minimal realization of astable FSR, sequential machines, state graphs.

I. INTRODUCTION

The state graph (SG) of an autonomous sequentialmachine (SM) is a directed graph depicting all the pos-sible state transitions in the machine. Distinct states ofthe SM are represented by distinct vertices (states) ofthe SG and a possible transition from state x to state yis indicated by an oriented arc issuing from x and enter-ing y. x is called a predecessor of y and y is called thesuccessor of x. Each state has exactly one successor butmay have no, or several, predecessors.The SG of an SM will be denoted by the couple

(X, F) where X is the set of states and F is the so-callednext-state operator of the machine. Formally, r is amapping of X into X defined by xF =y iff yEX is thesuccessor of xCX. Throughout this paper, the set X isassumed to be finite and no distinction is made betweena given SM and its SG.The set of predecessors of a state x will be denoted by

xr-l. The ith, nonnegative power ri of r is definedrecursively by xFo=x for every xCX and ri=ri-lr,i> 1. A cycle of length p in (X, r) is a closed sequence ofp distinct states x1,- -, xP such that xPF =x1 andxip=xi+1, i =1, * * - , p-1. Since X is finite, one mayreadily verify that each maximal connected piece of theSG (X, F) contains exactly one cycle. A cycle of unitlength is called a loop (equilibrium state). Thus, x&Xis a loop of (X, r) if xr =x.An SG is called k-stable if each of its cycles is a loop

and the number of loops is k. If k = 1, the SG is calledstable. The height of a k-stable SG is the smallest integerh such that for every xeX, xrh is a loop. The height ofa state x is the smallest integer h(x) such that xrh(x) isa loop.The (in-)degree of (X, F) is an integer d, equal to the

maximum number of states in X which have a commonsuccessor.

Manuscript received March 18, 1968; revised February 20, 1969.This research has been supported in part by the Air Force Office ofScientific Research through the European Office of Aerospace Re-search, O.A.R., U.S. Air Force, under Grant AF EOAR 67-21.

The author is with the University of Southern California, LosAngeles, Calif. on leave of absence from the Technion-Israel In-stitute of Technology, Haifa, Israel.

I f eedback logic f (x)

Fig. 1. General form of an autonomousa unit delay.

0000

00003

FSR. Di, i=1, * * * , n, is

Il0

1S

10 10

lol

Fig. 2. The SG of a (2, 2, 4)-FSR.

A k-stable SG of height h and degree d is called a(k, m, n)-SG if m and n are integers such that m> k, d,n>h and |X| =m .

This paper deals with (k, m, n)-SGs and their realiza-tion by feedback shift registers. An autonomous feed-back shift register (FSR) is a highly specialized SM,distinguished by its structural simplicity. The generalform of an m-ary, n-stage FSR is shown in Fig. 1. Them-ary n-tuple x = (xi, * *, xn) is the state of the FSR,where xi(M= {0, 1, * * , m-1}, i= 1, * * *, n, is theoutput of the ith unit-delay stage Di. The input intoDi is xi+,1, ii1, * * *, n-1, and the input into Dn isf(x) =f(x1, * * *, x.), wheref is an m-ary function, calledthe feedback function of the FSR.

If x=(x1, - * - , x,n)is the present state of the FSR,then the successor of x, i.e., the state after one unit time,will be (X2, * * - , x,n f(x)). The SG of an m-ary, n-stageFSR will be denoted by the couple (Vmn, F). The set ofstates Vmnn= Mn is the set of mn n-tuples formed by thenth Cartesian power of M and the next-state operatorF is the mapping of Vmn into Vmn defined by the feed-back function f.

It is readily observed that every state of (Vmn, F) mayhave at most m predecessors and that the onlystates which may be loops are n-tuples of the formc = (c, c, .* * , c), with all components equal to cEM.Consequently, an m-ary FSR may have at most m dis-tinct loops and if the FSR is k-stable then k <im.An m-ary, n-stage, k-stable FSR with height h<n

will be referred to as a (k, m,n)-FSR. Note that this def-inition is consistent with that of a (k, m, n)-SG. TheSG of a (2, 2, 4)-FSR is shown in Fig. 2.An SG (X, r) is said to be FSR-realizable if there exist

an FSR (VJmn, F) and a one-to-one mapping (mono-morphism) R of X into V.mn such that for every x&X,(xR)F= (xr)R.Such a mapping R, when it exists, will be called a

realization of (X, F) by (Vmn, F). Given the parameter

652

Page 2: On k-Stable Feedback Shift Registers

SHORT NOTES

m, a realization of (X, r) by (Vmn, F) is called minimalif Mn I<XIl <m n

Under this definition, it is clear that if a realization ofa (k, m, n)-SG by an m-ary, n-stage FSR exists, then itis minimal and the realizing FSR is a (k, m, n)-one.An extensive account on FSR-realizability of SGs may

be found in Haring [11]. Most of the known results,however, refer to binary (m =2) and nonminimal re-alizations. Existence theorems and efficient techniquesfor minimal realization have been derived only for cer-tain very special SG classes. Among these we mentionthe well-known result [2]-[4] that a cycle of any finitelength p has a minimal, binary FSR-realization. Thisresult has recently been generalized [5] also for thenonbinary case. Minimal realization techniques for cer-tain classes of stable SGs may be derived from the re-sults obtained by several authors [6]-[8] in connectionwith stable FSRs.

In this note, we derive necessary and sufficient condi-tions for minimal realizability of (k, m, n)-SGs, and anefficient realization procedure based on these conditionsis presented. The essential part of the procedure con-sists of a systematic manipulation of a compact expres-sion representing the hierarchy of state transitions inthe given (k, m, n)-SG. This expression, called the for-mula of the graph, and the rules for its manipulationare derived in Section II. The main results, followed byillustrative examples are given in Section III. For con-tinuity of presentation, the proofs of all results arepostponed to Section IV, where it is also shown thatevery (k, m, n)-SG has a simple m-ary, (n+1)-stageFSR-realization.

II. FORMULAS OF (k, m, n)-STATE GRAPHSConsider a (1, m, n)-SG(X, r). We define a set of n-1

equivalence relations Er, reN1= {1, I, n-1}, onX as follows:

xEry iff Xrr = ypr; x, y C X.

One may easily verify that Er, reNi, is indeed an equiv-alence, since xEry iff x and y have a common r-successor,

i.e., a state zCX which is reachable after r transitionsfrom both x and y.

An equivalence relation E on X is called a congruence

on (X, r) if xEy implies (xr)E(yF) for all x, yEX. Onereadily verifies that the following is true.Lemma 1: For all rCNi, Er is a congruence on (X, F).Thus, each Er defines a partition 7rr of X into blocks

(congruence classes) in such a way that all successors ofany block belong to the same block. This is the so-calledsubstitution property of the partition.A (1, 2, 4)-SG is shown in Fig. 3. The three partitions

for this SG are:

= {{1, 2}, {3,4}, {5,6}, {7,8}, {9,10}, {11,12},

{13,14}, {15,16}}

I={ {1 2, 3,4}, {5,6, 7,81, {9, 10, 11, 12},

{13, 14,15, 161}

9 10 11 12 13 14 15 16

Fig. 3. A (1, 2, 4)-SG.

3 = {172,37,4,5,6,7,8},{9, 10,11,12,13,14,15, 16}}.

It is easily observed that 7rr-l is a refinement of 7rr,r 2, 3, i.e., any block of rr-l is wholly contained in ablock of rr. Moreover, as may readily be shown byinduction on n, we have Lemma 2.Lemma 2: For every (1, m, n)-SG, with m>2, n>3,

each block of 7r contains exactly m blocks of lrr-l; thenumber of blocks in 7rr, rGEN1, is mn-r and the numberof states in each block is mr.The n-1 partitions wT, r C N1, may be represented in

a single expression by inserting among the blocks of 7r'a hierarchy of parentheses which corresponds to thehierarchy of successive block refinements. Let 7r denotethe resulting expression. The smallest groupings ofstates in ir correspond to blocks of wr', the next ones toblocks of 1r2 and so on, with the main groupings cor-responding to blocks of w'-1The expression 7r will be referred to as the formula of

the (1, m, n)-SG (X, F). For instance, the formula ofthe (1, 2, 4)-SG of Fig. 3, takes on the form of (2).

r {[((1, 2), (3, 4)), ((5, 6), (7, 8))], (2)

[((9, 10), (11, 12)), ((13, 14), (15, 16))]}.In the sequel, the outmost braces will not be written.

The groupings in 7r corresponding to blocks of 7rr,rENi, will be called words of order r. Two kinds ofwords which will frequently be referred to are words oforder 1 and words of order n -1. For brevity, the firstwill be called terms and the latter factors. The wholeformula will also be referred to as a word of order n andthe states contained in it as words of order zero. Thus,the terms of the formula 7r given in (2) are (1, 2), (3, 4),(5, 6), etc., and its factors are the two main wordswritten in brackets [ ].

Let S= (X, F) be a (1, m, n)-SG and let S= (Y, P) beany sub-SG of S, i.e., r is the restriction of F to thesubset YCX and YIC Y.The formula of S is defined to be the expression #

obtained from the formula -r of S by deleting from itsterms the states which belong to X- Y. A term of 7rwhich contains no states of Y appears in X as an emptyterm denoted by q. For example, consider the SG ofFig. 3 and its sub-SG S generated by the set of statesY= { 1 ,2, 3, 4, 5, 9, 10 }. The formula of S appears in (3).

*r = [((I; 2), (3, 4)), ((5), 0)], [((9; 10), 0), (01 0)]. (3)

653

Page 3: On k-Stable Feedback Shift Registers

IEEE TRANSACTIONS ON COMPUTERS, JULY 1969

Finally, let S= (X, r) be any (k, m, n)-SG and let3i=(Xi, ri), iCEK= {O, 1, * * *, k-1} be the k stablepieces of (X, 1). Since each Si is a sub-SG of some(1, m, n)-SG Si, the formula #ri of Si may readily beobtained from that of Si.The formula r of S is defined to be the set of the k

formulas *i, iCK, of its stable pieces Si. The *i will bereferred to as the subformulas of S. Note that everysubformula *i of S contains exactly m factors with m-2terms in each factor and that the number of states inany term does not exceed m (for empty terms thisnumber is zero). Note further that given any statexEX, there are exactly one i&K and one term in iiwhich contain x.

Let Si be a (1, m, n)-SG containing the stable pieceSi of S and let 7-i be the formula of Si. Note that theloop of Si is a common (n- 1)-successor of all the stateswhose height is less than n and, therefore, all of thembelong to the same factor of 7ri. The height of any statecontained in the other m -1 factors of 7ri is equal to n.A state will be called marginal if its height is equal to

n and nonmarginal otherwise. The same terminologywill also be used with reference to words of a formula.'

Returning now to the formula *i of 3i and recallingthe way it is obtained from ri, it follows that eachiri, iEK, contains exactly one nonmarginal factor andm -1 marginal ones. For instance, the first factor of ir,given in (3), is nonmarginal and the second one ismarginal.Two words of a formula are said to be permutable

if both are of the same order r and contained in thesame word of order r+ 1.

It is readily observed that the formula of a (k, m, n)-SG is defined up to the ordering among its permutablewords. As shown in the sequel, minimal FSR-realiza-bility of a given (k, m, n)-SG depends on the attainableorderings among the permutable words of its formula.In manipulating a formula to obtain an alternativeordering, any-and only-permutable words may becommuted. Henceforth, any reordering of a formulamentioned in the sequel should be understood as asequence of commutations among permutable words.Two formulas are said to be equivalent if each of them

is a reordering of the other one. For instance, theformula

i = [(o 0) (,O, (9, 10))],[+ (5)), ((I, 2), (3, 4))] (4)

and that given in (3) are equivalent.Consider the k subformulas r#i, iEK, of a (k, m, n)-

SG. Let iij, jEM, denote the (j+l)st factor of *i,counted from left to right.The formula of a (k, m, n)-SG with k>3 is said to be

in normal form if, for all iCK, the nonmarginal factorof *i is ii-.By definition, the formula of a (2, m, n)-SG and that

of a (1, m, n)-SG are always in normal form.

1 Note that all the states contained in any word of order rE Ni areeither marginal states, or all of them are nonmarginal ones.

Let rij, j = 1, . - - , mn-1, denote the set of states con-tained in the jth term (counted from left to right) of *r,iCK. In the following definition attention is focused onthese sets and, for convenience, *i will be denotedby [#^jI.The (termwise) union of ir*a= [*aj] and rb=[rb=],

a, bCK, is defined to be a formula 7ru = [7ruj] with7uj =7rajU7[bjjr , * *

The k subformulas of a (k, m, n)-SG are said to becompatible if there exists an equivalent set of k sub-formulas in normalform irj, one for each stable piece Si,i K, such that every term of their union Irk = UiEK fricontains exactly m states.

Theorem 1: A (k, m, n)-SG has a minimal, m-ary FSRrealization iff its k subformulas are compatible.2

I II. THE REALIZATION PROCEDURE

The realization procedure of a (k, m, n)-SG S= (X, F),derived from Theorem 1, consists of three parts.

a) A test for compatibility, by which minimal realiza-bility of S is decided.

b) An imbedding procedure, by which every stablepiece 3i = (Xi, Pi) of S is imbedded in a (1, m, n)-SGSi=(X, ri).

c) An assignment process, by which the set X ismapped onto the set of m-ary n-tuples Vmn, result-ing in a minimal FSR-realization of S.

The compatibility test forms the main part of thisprocedure. Once this part is over, and the given SGturns out to be realizable, the rest of the procedure isentirely routine.

A. The Compatibility Test

Let ,i= [&ij], iEK, be a subformula of S and leti= [rij] be the expression obtained from #ri by sub-

stituting for each of its terms the integer rij=rijj= 1, * * , mn-, equal to the number of states in thatterm. ri will be referred to as the record of #ri (or, of si).For instance, the record of the formula #r given in (3) is

T = [(2, 2), (1, 0)][(2, 0), (0, 0)]. (5)

The groupings in a record will also be referred to aswords, with the integers rij being words of order 1, orterms, and so on. The rules for manipulating records,the notion of equivalence and the conditions on the setof records Ti, iCK, to be in normal form are all the sameas those for formulas. Thus, two records are equivalentiff the corresponding formulas are. Similarly, a set of krecords ri, iEK, of S is in normal form iff the cor-responding set of subformulas is. The operation cor-responding to the union of subformulas is the (termwise)sum of their records. Compatibility of records is definedin an obvious way. A given set of compatible records innormal form is called summable if each term of their sumis equal to m. It should be remembered that the notion

2 The proof of this theorem and of all results stated in Section IIIare given in Section IV.

654

Page 4: On k-Stable Feedback Shift Registers

SHORT NOTES

of summability refers only to records which are in nor-mal form.Thus, the test of a given S for compatibility consists,

essentially, of a systematic manipulation of its recordswith the objective to obtain, whenever possible, anequivalent set of summable ones. This test turns out tobe very simple and easy to apply if k = 2 (if k = 1, thereis nothing to test), and becomes more complicated ask increases.For k = 2, the compatibility of the two records rT and

iri may readily be checked by applying the principle oflexicographic ordering.A lexicographic ordering of a record r is defined as

follows.Two words in r are lexicographically comparable iff

they are permutable. The weight of a word is the totalsum of terms contained in it. The lexicographic orderingamong comparable words is, in the first place, accordingto their weight and, in the second place, according to theweight of successive lower order words contained inthem.

A lexicographic ordering of r is said to be rightwardif the weights increase from left to right and leftwardin the opposite case. For instance, the record r given in(5) is ordered leftward. A rightward reordering of thisrecord results in

' = [(0, 0), (0, 2)][(0, 1), (2, 2)].Now, let the rightward ordering be applied to ro, theleftward one to r1, and let the resulting pair of recordsbe TrI and r1', respectively.One may easily verify that T,, and r1 are compatible

iff r0' and Ti' are summable,3 i.e., iff each term of T2=To'+ri' is equal to m.Example 1: The subformulas of the (2, 3, 3)-SG

shown in Fig. 4, may readily be written down by in-specting the figure. These are

fr = [(1, 2, 3), (4, 5, 6), (7)], [(8, 9, 10), (11, 12),(13, 14)], [(15), 0t7 (6)

#1 = [(16, 17, 18), (19, 20, 21), (22, 23)],

[(24), (25), 0]> [(26, 27), 01 0].The corresponding records are

To = [3, 3, 1], [3, 2, 2], [1, 0, 0]

Tj = [3, 3, 2], [1, 1, 0], [2, 0, 0].Applying the lexicographic ordering, these become

TO' = [0, 0, 1], [1, 3, 3], [2, 2, 3] (8)Ti' = [3, 3, 2], [2, 0, 0], [1, 1, 0] (9)

andT2 = To' + Tl' = [3, 3, 3], [3, 3, 3], [3, 3, 3].

Thus, the records and, hence, the subformulas are com-patible and the other two parts of the procedure may

I Recall that the subformulas and records of a (2, m, n)-SG are,by definition, always in normal form.

8 9 10 11 12 13 14 15 24 25 26 27

7 19 212 23

18~~3 i

So S,

Fig. 4. The (2, 3, 3)-SG of Example 1.

be applied to obtain a minimal realization (see Examples2 and 3 which follow). Note that a slight modificationof the SG just tested, say, choosing the successor ofstate 13 to be state 5 instead of state 6 suffices to causeincompatibility. In fact, the record of the modifiedstable piece will be [3, 3, 1], [3, 3, 1], [1, 0, 0], which isincompatible with the unchanged record of the otherpiece.Of course, if k>2, the lexicographic method of order-

ing is not applicable any more. However, since k maynot exceed m, this method completely covers the caseof binary FSR-realization which, so far, is still the dom-inating case in practice.The derivation of an efficient ordering method for the

case k> 2 is left as a problem to the interested reader.For moderate values of k, it seems that any systematicmanipulation of the records will quickly show whetherthey are compatible or not. If the records turn out to becompatible, proceed as described in the following sub-section; if not, the given SG has no minimal realization.However, a nonminimal FSR-realization of a (k, m, n)-SGdoes always exist and may readily be obtained by usinga (k, m, n+1)-FSR (see Theorem 2, Section IV).

B. The Imbedding Procedure

Suppose the k records of the graph S= (X, r) undertest are compatible. Once an equivalent set of summablerecords has been found, the corresponding set of sub-formulas in normal form #ri', i K, whose unionIrk = UiEK ri has exactly m states in each term, is alsoknown.The formula Irk iS used now to construct m auxiliary

SGs. Before these SGs are defined, consider the m fac-tors Okj, jEM, of Irk. Recalling that 7rk is a union of sub-formulas in normal form,4 it follows that for every iCK,all the nonmarginal states of 3i= (Xi, rI) are containedin Oki and each of its marginal states is contained insome Okj, j i. Note also that if k <im, then for everyje(M-K) all the states of S contained in 4kj aremarginal ones.The auxiliary SGs constructed by the imbedding pro-

cedure are obtained as follows.a) Imbed each stable piece 3i= (Xi, ri) of S= (X, r)

in a (1, m, n)-SG Si= (X, ri) such that for all izKthe formula of Si is 7rk-

4 The assertion which follows relies on the definition of normalform for k>3. For our present purpose, there is no loss of generalityin assuming the same definition to hold alsofork = 1, 2 (see Lemma 8).

655

Page 5: On k-Stable Feedback Shift Registers

IEEE TRANSACTIONS ON COMPUTERS, JULY 1969

b) If k<m, draw m-k (1,m,n-1)-SGs Q,, j&E(M-K), such that the formula of Qj is thefactor 4kj of irk.

Both steps a) and b) of this procedure are alwayspossible and straightforward. To obtain Si, iEK, welook for words of 7rk which correspond to nonemptywords of #i', starting with terms and then proceeding towords of successively higher order up to order n. IfXirCXi Xir,¢4), and X CX are the sets of states con-tained in corresponding words of order r, r = 1, , n,of #ri' and lVk, respectively, and if in Si

y = XFjj

8 9 o 11 24 12 13 25 14 16 17 18 22

so

(10)then in Si

y = XrF'r. (11)

A construction according to (10) and (11), with theorder of words gradually increasing from 1 to n, willreadily yield an imbedding of Si = (Xi, Pi) in a (1, m, n)-SG Si= (X, ri). Generally, such an imbedding is notunique, but any possible alternative is acceptable.The construction of Qj, jC(M-K), is even more

simple and is also not unique. Once an arbitrary statecontained in 0kj is chosen to be the loop of Qj, the m-arytree of height n-1 rooted at this loop is easily drawnin accordance with the hierarchy of words in 4)kjExample 2: Proceeding with the results of Example 1,

the pair of subformulas in normal form which correspond(after commuting the first two factors) to the summablerecords, given in (8) and (9), are

= [(7), (1, 2, 3), (4, 5, 6)], [0, X, (15)],[(11, 12), (13, 14), (8, 9, 10)]

= [(26, 27), 4), ], [(16, 17, 18), (19, 20, 21),

(22, 23)], [(24), (25), 0],and their union is

72 = TIoUJl = [(7, 26, 27), (1, 2, 3), (4, 5, 6)],[(16, 17, 18), (19, 20, 21), (15, 22, 23)],

[(11, 12, 24), (13, 14, 25), (8, 9, 10)].

A pair of imbedding SGs SO and SI are shown in Fig.5(a). The two sub-SGs in solid lines are the stable piecesSO and S1. The partial augmentations resulting accordingto (10) and (11) from the comparison of nonemptyterms (r = 1) of iir and ii1 with the corresponding termsof 7r2, are indicated in continuous lines and those ob-tained from higher order words are drawn in dashedlines.A (1, 3, 2)-SG Q2, corresponding to the third factor of

72, with state 8 as a loop is shown in Fig. 5(b).C. The Assignment Process

The consistency of the assignment process definedbelow is proved in Section IV. The process consists oftwo steps.

a) Initial assignments which, to a certain extent, arearbitrary and refer to the k loops of the imbed-

S,(a)

II 12 24 13 14 25

9\ 10

(b)Fig. 5. (a) A pair of imbedding SGs for Example 2. (b) A (1, 3, 2)-

SG Q2 for Example 2.

ding SGs Si, iCK, and to all the states of themi-k (1,m,n-1)-SGs Qj, jE (M-K).

b) A self-maintaining assignment process which isstarted by the initial assignments and goes onuntil the whole set X is assigned. The assignmentsgenerated at this step are uniquely determined bythe initial ones.

Step a: Assign the n-tuple i= (i, i, * *, i) Vmn tothe loop of Si, iCK, and assign the n-tuple j& Vm. tothe loop of Qj, jE (M-K).Once the n-tuple (x1, * * - , x,n) has been assigned to a

state x of Qj, the assignment of its m predecessors,though arbitrary to a certain extent, goes along well-defined lines. The n-tuples assigned to distinct predeces-sors yi, iE M, of x differ only in their first component y1i.The last n -1 components of each yi are (y2i, * * * , y.i)= (x1, * * *, x,n_). Note that distinct Qj have no com-mon states and that the total number of states assignedso far is s=k+(m-k)mn-1.

Before defining Step b, we proceed right away to ob-tain an initial set of assignments for the SGs of Fig. 5.Example 3a: The n-tuples assigned to the loops of the

SGs of Fig. 5 are

1: (000); 16: (111); 8: (222).

For the two unit-height predecessors of state 8 in Q2we choose

9 (022) and 10 (122).

656

Page 6: On k-Stable Feedback Shift Registers

SHORT NOTES

A possible alternative for the predecessors of state 9 is

11 : (002); 12: (102); 24: (202)

and for those of state 10,

13 : (012); 14 :(112); 25 :(212).

Step b: This step consists of several cycles, with the as-signments made at the (j+1)st cycle Cj+,, j = 0, 1, * *being uniquely defined by those made at Cj, where C.is Step a.

Let XOCX be the set of s states assigned in Step a,and let xiCX be the loop of Si, iEK. Note that for alliCEK, each state yE(Xo_1 {xi}) =Xoi is a marginal statein Si and since m>2, XoiqSO. Note further that if then-tuple (yi, * .. , yn) C Vmn was assigned to yCX, then(Y2, * * *, yn, i) must be assigned to yri in Si, iEK.The set of new states assigned in each Si at the first

cycle is X,i =U, Xoirir. It is clear from the abovediscussion that all assignments on Xi' are uniquely de-fined by those on Xoi and that if j$i, then all the statesof Xi' are marginal states in Sj, i, jEK. If some statesof X are still unassigned, let Ki =K - { i I and letXi=UjERKi Xjl'The set of new states assigned in each Si at the second

cycle is a nonempty subset of rX2UX=IThe other cycles are defined in a similar way and the

process keeps maintaining itself until the whole set Xis assigned.Example 3b: Continuing Example 3a, we have

X00 = {16, 8, 9, 10, 11, 12, 24, 13, 14, 25}

X01 = {1, 8, 9, 10, 11, 12, 24, 13, 14, 25}.

The new assignments generatedtabulated below.

at the first cycle are

so S,

26: (110) 23: (001)xoir 4: (220) 21 (221)

5 :(020) 19 (021)6 (120) 20 (121)

xo r2 33 (100) 18 (011)2 (200) 17 (211)

The states listed in the columns of SO, and S1 form thesets X.' =X" and X11= X10, respectively.The second cycle results in

So S,

x1-r 7 : (010) 22 : (101)27: (210) 15 : (201)

which completes the assignment on X and yields a

minimal realization of the SG of Fig. 4.

IV. PROOFS AND SOME FURTHER RESULTS

In order to prove Theorem 1 and the results of SectionIII we need the following lemmas.Lemma 3: An m-ary, n-stage FSR is a (1, m, n)-SG

iff its feedback function f is identically equal to a con-stant cEM.

Proof: The "if" part of the lemma is evident,since for f-c the only possible cycle is the loopc = (c, c, . .. , c) and the height of any state cannotexceed n. For the "only if" part, let x, yE Vmn be anytwo states of a (1, m, n)-FSR (Vm., F). The only statesof any FSR which may be loops are n-tuples of the formc = (c, c, * * , c), with all components equal to cCM.Since all the states of a (1, m, n)-FSR converge, after atmost n transition, to its single loop, we have xFn = yFn = c.However, xFn= (x2, * , xn, f(x)) Fn-1, and hence f(x)is equal to the first component of xF . Similarly, f(y) isequal to the first component of yFn. Thus, both f(x)and f(y) are equal to c.

Q.E.D.

Let T= (Vmn, F) be a k-stable FSR and let T7= (Vmni, Fi), iECK, be the stable pieces of T. Let f be thefeedback function of T and let fi be the restriction of fto Vmni, iCK.Lemma 4: A k-stable, m-ary, n-stage FSR is a

(k, m, n)-SG iff for all iEK, fi is identically equal to aconstant ciE M.

Proof: The "if" part is again evident. The proofof the "only if" part goes along the same lines as that ofLemma 3, by considering any two states of the same Ti.

Q.E.D.

An immediate consequence of Lemma 4 is Lemma 5.Lemma 5: Let T, be a stable piece of a (k, m, n)-FSR

and let c be the loop of T,. Then, T, is a sub-SG of the(1, m, n)-FSR whose feedback function is identicallyequal to cE M.One may easily verify the following property, dis-

tinguishing the marginal states of a (k, m, n)-FSR.Lemma 6: Let T, be a stable piece of a (k, m, n)-FSR

and let c be the loop of -T. A state (x1, * * *, xn) of T,,is marginal iff Xn5c.Lemma 7: The formulas of any two (1, m, n)-FSRs are

equivalent.Proof: Let T. = (Vmn, Fa) and Tb = (Vmn, F,) be any

pair of (1, m, n)-FSRs with loops a and b, respectively,a, bCM. Let 7ri be the formula of Ti, i=a, b, and let7rir, rEN1= { 1, * * *, n-1 }, be the corresponding n-Istate partitions of Ti. To prove the lemma we have toshow that 7rar=7rbr, or equivalently, that Ear = Ebr for allrEN1, where E r is the congruence on Ti correspondingto rir. Thus, suppose xEary, rE NM, x, yC Vmn, and letz = xFar=yFar. Clearly,

z = (z1 * Zn-r, Zn-r+l * * Zn)= (z1 Z* * Xzn-.r a, ... a)

and

(%1, , Zn-r) = (Xr+I . . , Xn) = (Yr+17 , yn).Hence,

xFbT= (z1, * * ,Xzn-r b, - . . , b) = yFbr

657

Page 7: On k-Stable Feedback Shift Registers

IEEE TRANSACTIONS ON COMPUTERS, JULY 1969

or xEbry. Thus, for any x, yE Vmn, xEary implies XEbryfor all rGNi. Similarly, xEbry implies xEary and henceEar= Ebr for all rCENi.

Q.E.D.We are able to prove now the necessity part of the

realizability condition given in Theorem 1.Theorem la: The subformulas of a (k, m, n)-FSR

are compatible.Proof: Consider the k-stable pieces Ti= (Vmni, Fi)

of a (k, m, n)-FSR T=(Vmn, F). By Lemma 5, eachTi may be imbedded in a (1, m, n)-FSR Ti = (Vmn, Ft).By Lemma 7, the formulas iri, iCK, of the Ti are pair-wise equivalent, and we may assume that identicalwords occupy the same position in all 7rw. Consider thenonmarginal factors5 of any two distinct 7rw, i&K. ByLemma 6, the nonmarginal factor of 7ra and that of ib,a, bCK, a 5b, cannot occupy the same position in bothformulas, since nonmarginal states of different Ti mustdiffer in their last component. Thus, we may also assumethat for all iG3K, the nonmarginal factor of iri is ii.Now, let -ri be the formula of Ti. Recalling that the

states contained in any word of -ri are a subset of thosecontained in the corresponding word of 7ri, it followsthat the k #ri are in normal form. Since for any xE Vmn,there are exactly one iCK and one term in #ri such thatx belongs to that term, it is clear that 7rk = UEGK ri isequivalent to (actually, identical with) each of the7ri and that exactly m states are contained in each termof 7rk.

Q.E.D.

The above proof points out the reason for imposingthe condition of normal form in the definition of com-patibility. For a (k, m, n)-SG with k>3, this conditionguarantees that if the subformulas #ri, i-K, are in nor-mal form, then no factor of their union 7rk contains non-marginal states of two different stable pieces. Thenecessity of this requirement is obvious from the proofof Theorem la. Since no condition has been imposed inthe case k =2, we have to prove the following.Lemma 8: Let S be a (2, m, n)-SG and let #0 and -ri

be subformulas of S such that each term of their union72= #rUJrl contains exactly m states. Then, whateverthe ordering of factors in -ri, and #ri might be, the positionoccupied by the nonmarginal factor in r-, is never thesame as that in #1i.

Proof: Every factor of fri, i =0, 1, contains exactlymn-2 terms. If the nonmarginal factor of #0 occupies thesame position as that of -ri then the total sum of non-marginal states of S must be mn-i. As shown below, thiscan never be the case if S is a (2, m, n)-SG.

Let S, and Si be the stable pieces of S and let hjdenote the number of states at height r in Ss, r =0,1, * - *, n. Let Hi denote the number of nonmarginal

6 Recall that a word of 7ri is called nonmarginal iff the statescontained in it are nonmarginal states in T7. Though all the 7ri areequivalent, they represent different SGs and identical words con-tained in distinct 7ir may be attributed different qualifications ac-cording to the position occupied by their states in distinct SGs.

states in Si and let H=H0+Hi. Clearly,n-1 n-I

Hi = Z hir = 1± hir, i = O,1r=Tr=i

and

H + hon + hln = mn.

It is also clear that

hir+i < mhir, i = 0, 1; r = 1, . . .I,X- 1,

and hence

(12)

(13)

(14)

n-I n-i

Ei hrr+l< m E irr=l r=l

orn-1

hin < h' + (m - 1) E hi,.r=l

Since hi' <m-1, we haven-1

hin < (m- 1) I + E h,i) = (m--)Hijr=l

and

hon + hln <(m - 1)1H.

i= 0, 1

(15)

Equality in (15) may hold iff it holds in (14) for allvalues of r and both values of i and hoi=hll=m-1.But, then If0+h0n =Hl+hln = mn, which contradicts(13). Hence,

hon + hln < (m- 1)H

andH + h n + hln = mn < mH.

Thus, H>mn-i and the number of nonmarginal statesin a (2, m, n)-SG is never equal to mn-i.

Q.E.D.

This result guarantees that if the lexicographicallyordered records of a (2, m, n)-SG turn out to be sum-mable, then the positions occupied by their nonmar-ginal factors are never the same.

In the following theorem we prove the validity of therealization procedure defined in Section III and, thereby,complete the proof of Theorem 1.

Theorem lb: If S= (X, r) is a (k, m, n)-SG with com-patible subformulas then the imbedding procedurefollowed by the assignment process will always result ina minimal FSR-realization of S.

Proof: The main point which has to be proved isthe consistency of the assignment process. Then wehave to show that the process is complete, i.e., that itdoes not terminate before the whole set X is assigned.To begin with, suppose the subformulas of S are com-patible and let #ri, iCK, be a set of subformulas in nor-mal form of S such that each term of rk = UiEK ri con-tains exactly m states. It is clear now that also for k = 2(and, of course, for k = 1) we may assume that the non-marginal factor of #ri is $;i.

658

Page 8: On k-Stable Feedback Shift Registers

SHORT NOTES

Let Si= (X, r,), i&K, and Qj, je(M-K), be the mauxiliary SGs obtained by the imbedding procedure.The defining properties of these SGs (which, as shownin Section III-B, are always attainable) are thefollowing.

Property 1: For all iCK, Si is a (1, m, n)-SG and itsformula is rk.

Property 2: The stable piece Si= (Xi, ri), iEK, of Sis a sub-SG of Si.

Property 3: Qj, jE(M-K), is a (1, m, n-1)-SG andits formula is the factor ki, of Irk.By property 1, we have the following.Property 4: Two states x, yEX are contained in the

same word of order r in Ik if x and y have a commonr-successor, rCNl, in every Si, ieK.

It is also clear that the following holds.Property 5: A state xEX is nonmarginal in Si, iCK,

iff x is contained in the factor 4ki of 7kWe turn now to prove the consistency of the assign-

ment process. Since the only states of a (k, m, n)-FSRwhich may be loops are n-tuples of the formc= (c, c, .* * , c), with all components equal to cEM,and since distinct Qj have no common states, the con-sistency of Step a is evident. Let XOCX be the set ofstates which were assigned in Step a and let xiCXo bethe loop of Si, iEK. By Property 5, all the states ofXoi = Xo -{ xi } are marginal in Si and no inconsistencymay take place at the beginning of Step b. The twothings which have to be proved with respect to everycycle of Step b are the following.

bl) The assignments performed in each Si are con-sistent.

b2) The assignments performed in any Si are con-sistent with those performed in the other Si.

Consider the first cycle of Step b. To be specific, let xand y be any two states of Xoo and let (xi, . * *,xI) E Vmnand (yi, * - *, y.) E Vmn be the n-tuples assigned to x andy, respectively, in Step a. If in SO, x and y have a com-mon r-successor other than the loop x, then by Prop-erty 4, both belong to the same factor of 7rk, and henceto the same Qj. Moreover, if z is a common r-successor,1 <r<n, of x and y in SO, i.e., Z =xF0r=yror, then x andy have also a common r-successor in Qj, and, therefore,(Xr+l, * **x,) = (y,+i, * - , y.). Hence, the n-tuple(Xr+l, , xn, 0, * *, 0) determined for z by x, is thesame as that determined for z by y and this provesbl) for the first cycle with respect to SO. By similararguments, bl) is true for each Si, i-K, at this cycle.Now, the set of states assigned in Si at the first cycle isXil=Un-1 xoirir. By Property 5, all the states of Xi'are nonmarginal in Si and marginal in any other Sj,jCKi=K-{i}. Hence, the k sets Xi', iCK, are pair-wise disjoint and the assignments performed at the firstcycle in distinct Si are independent. Thus, b2) is alsotrue at this cycle.The proof of bl) and b2) for the next cycles goes along

the same lines. The assignments performed at the(p+l)st cycle Cp+l in Si are determined by those per-

formed at Cp, P. 1, in all the other Sj, jCKi. Any pairof previously assigned marginal states in Si, which havea common r-successor, 1 < r < n, that is assigned atCp,+, must also have a common r-successor in someSj, jEK,. It is also clear that the assignments made indistinct Si at any cycle are independent and, hence, thewhole assignment process is consistent.

It remains to show that the process does not ter-minate before the whole set X is assigned. To this end,suppose the process terminates with some states stillunassigned. These states must belong to the first kfactors of 7rk since all the states of the other m - k factorswere assigned in Step a. Thus, each unassigned state isnonmarginal in exactly one Si, iCK. Let x be the lowestunassigned state and let the height of x be a. If x is non-marginal in Si then the mn-a marginal states of S whosecommon (n--a)-successor is x must be unassigned. LetXa be the set of these mn- states. Since the loop of Siis assigned, a>O, n-a<n and all the states of Xabelong to the same factor of Irk. Hence, all of them arealso nonmarginal in the same Sj, jKi, and have acommon (n--a)-successor y=XXaFjn-a in that S. Sinceany state may be a common (n-a)-successor of atmost mn-a states, there is no assigned state whoser-successor in Sj, for some r, is the state y. Hence, y isalso unassigned. Now, since the set Xa is marginal in Siand nonmarginal in Sj, y must be lower than x. This,however, is a contradiction, since we have assumed thatx is the lowest unassigned state.

Q.E.D.

Finally, we consider the case in which the subformulasof a given (k, m, n)-SG are incompatible. This case iscovered by the following theorem.

Theorem 2: Every (k, m, n)-SG is realizable by anm-ary, (n+1)-stage FSR.

Proof: Consider the m-ary, (n+ 1)-stage FSR whosefeedback function is f(x) = Xn+l. It is readily observedthat this FSR is m-stable and that each of its stablepieces is a (1, m, n)-SG. Since each stable piece of a(k, m, n)-SG is a sub-SG of a (1, m, n)-SG, the theoremfollows.

Q.E.D.

Obviously, Theorem 2 is applicable to any(k, m, n)-SG, whether its subformulas are compatibleor not. In the first case, the realization suggested byTheorem 2 is, of course, not a minimal one, but involvesa very simple feedback logic which, in many practicalsituations, may compensate for the single extra delayelement. In the second case, when the subformulas areincompatible, this realization seems to be the best pos-sible one.

ACKNOWLEDGMENTThe author is grateful to Prof. M. Yoeli of the

Faculty of Electrical Engineering, Technion-IsraelInstitute of Technology, for reading the manuscriptand for many helpful discussions in the course of itspreparation.

659

Page 9: On k-Stable Feedback Shift Registers

IEEE TRANSACTIONS ON COMPUTERS, JULY 1969

REFERENCES[1] D. R. Haring, Sequential-Circuit Synthesis: State Assignment

Aspects, M.I.T. Res.-Mono. 31. Cambridge, Mass.: M.I.T.Press, 1966.

[21 M. Yoeli, "Binary ring sequences," Am. Math. Monthly, vol. 69,pp. 852-855, November 1962.

[3] P. R. Bryant, F. G. Heath, and R. D. Killick, "Counting withfeedback shift registers by means of a jump technique," IRETrans. Electronic Computers (Correspondence), vol. EC-11, pp.285-286, April 1962.

[4] S. W. Golomb, Shift Register Sequences. San Francisco, Calif.:Holden-Day, Inc., 1967.

[5] A. Lempel, "M-ary closed sequences," J. Combinatorial Theory,to be published.

[6] J. L. Massey and R. Liu, "Monotone feedback shift-registers,"1964 Proc. 2nd Ann. Allerton Conf. on Circuit and System Theory.

[7] F. L. Mowle, "Enumeration and classification of stable feedbackshift-registers," University of Notre Dame, Notre Dame, Ind.,Tech. Rept. EE-661, January 1966.

[8] C. L. Liu, "The stability problem of several classes of feedbackshift-registers, " in Theorie des Graphes-Journees Internationalesd'Etudes. Paris: Dunod, 1967, pp. 233-243.

The Design of Shift Register Generatorsfor Finite Sequences

MARTIN COHN AND SHIMON EVEN, MEMBER, IEEE

Abstract-The construction of a shortest feedback shift registerwhich generates a given finite sequence is described for the cases oflinear and nonlinear feedback logic. It is shown that the ratio of thenumber of delay elements required in the linear case to that of thenonlinear case grows without bound for proper choice of sequences.

Index Terms-Finite sequences, linear and nonlinear feedbacklogic, short shift registers, worst linear case.

I. INTRODUCTION

This report describes the design of a shortest feedbackshift register which, when properly initiated, will gen-erate a desired finite binary sequence. The discussion isin two parts, the first treating the case where arbitraryfeedback logic is allowed, and the second where thislogic is restricted to be linear. (See Fig. 1.)The output at each unit of time is constrained to be

the content of the last delay element in the register.This is known to be no restriction in the linear case [1],but is important in the nonlinear case where, if addi-tional output logic is allowed, a minimal counter solvesthe problem.

II. THE NONLINEAR CASE

Suppose it is desired to realize a given binary se-quence as the output of the shortest possible shiftregister with feedback logic alone, and that subsequentoutput behavior is irrelevant. The sequence should firstbe tested for periodicity, since all periods after thesecond can be ignored. The algorithm below simplysearches for the shortest constraint length which allowsthe feedback to be realized without inconsistency.

For each k starting with k =1, consider all subse-quences or "windows" of length k. If a subsequencerecurs in the given sequence, it should be followed by

Manuscript received August 28, 1968; revised March 20, 1969.M. Cohn is with the Sperry Rand Research Center, Sudbury,

Mass.S. Even is with the Aiken Laboratory, Harvard University,

Cambridge, Mass.

Fig. 1. Feedback shift register.

the same digit; otherwise increment k and begin again.The first k (call it k = n) for which consistency is ob-served is the length of the minimum shift register; thefeedback function is found by treating the distinct sub-sequences of length n and their associated followingdigits as rows in an incompletely specified truth table.Example 1: Let the given sequence be

1 0 1 1 0 1 1 1.

Then

n 3 1 because the sequence is not constant;n - 2 because 11 is followed by 0 and later by 1;nX3 because 0 1 1 is followed by 0 and later by 1;n 4 because 1 0 1 1 is followed by 0 and later by 1.

For k =5 there are no inconsistencies, so n = 5 and thefeedback logic is given by the truth table:

1 00 11 1

1 1 0 11 0 1 10 1 1 1

The logic can be minimized by treating all other inputconfigurations as don't-care conditions. Observe that ifoutput logic were allowed, this sequence could be gen-erated by a circuit with only three delays.

III. THE LINEAR CASEThe case where the feedback logic is constrained to

be linear has been treated by Massey [3]. He cites arecursive solution which along the way finds shortestgenerators for all prefixes of the given sequence. Themethod presented here is felt to be simpler in conceptand implementation than that of [3 ], although thestorage requirements are more severe. It amounts toseeking the lowest order linear constraint satisfied bythe sequence by testing successive shifts of the given se-quence, with all possible continuations, for linear de-pendence upon earlier shifts.To do so, let the given sequence be Si, S2, S3, , SN,

and an arbitrary continuation be x1, X2, X3, ,XN-1,so that the continued sequence is

Sly S2, . . .*, SNI X1, X2, . .*, XNv-1

Then write successive subsequences of length N as rowsof a table:

Si S2 SS3 . . SN

S2 S3 . . . SN X1

SN Xl X2 * * * XN-1.

660