```CS W4825 Digital Systems Design

NOTES ON LINEAR SEQUENTIAL CIRCUITS    4-13-98 (revised 4/04)  S. H. Unger

1. INTRODUCTION
We are concerned here with binary variables, the addition (modulo-2)
operation, and unit delays.

Systems constructed on this basis are linear and all of linear algebra
applies.  (Much of this material could be generalized to systems based
on modulo-p numbers where p is any prime number.  But we will not do
that as it makes things more complicated and it appears that the most
important applications are where p = 2.)

2. LINEAR COMBINATIONAL CIRCUITS.

The set of equations (the + symbol now stands for XOR, or modulo-2

Z1 = X1
Z2 = X2 + X3 + X4
Z3 = X1 + X2
Z4 = X2 + X3

can be written in matrix form: Z = AX where A is a matrix and Z and X
are column vectors

1000
A =  0111
1100
0110

Using elementary row operations, we can find the inverse of A, A' =

1000
1010
1011
0101

Now we can find X given Z, that is, the circuit has an inverse.  We
could also have used determinants.  If the determinant of a matrix is
0, then it has no inverse.

3. LINEAR DEFINITE MACHINES Let DX be the value of X delayed by one unit
of time.  In general D^kX is X delayed by K units of time.  Obviously
D(D^k) = D^(k + 1).

We could describe a machine in terms of these delay operators.  For
example,
Z = X + DX + D^2X + D^4X = (I + D + D^2 + D^4)X, which we think of
as a delay polynomial of degree 4 operating on the input X.  In
general, a delay polynomial of degree k can be specified as a0I + a1D
+ a2D^2 + ...akD^k, where the coefficients ai are each either 0 or 1.

This expression is realized as a sequence of 4 delay elements
connected in cascade, with X and the outputs of 3 of the delays going
to a 4-input XOR-gate.
The impulse response of a circuit is the output produced by an input
consisting of a single 1 followed by an infinite string of 0s.  For
circuits of this type, the impulse response is obviously a finite
string of 1s and 0s followed by an infinite string of 0s.   It can
always be found by listing, in increasing order, the coefficients of
the powers of D in the delay polynomial.  In this example, the impulse
response is 11101.

An important concept is that of a null sequence of a polynomial.  For
any delay polynomial, there are periodic sequences, in addition to the
trivial one consisting of all 0s, for which, the steady-state output
of the corresponding circuit is 0.

For example, consider the circuit described by Z = (I + D + D^2)X.  If
we solve for X as a function of past values of X, with Z = 0, we get X
= DX + D^2X.  So , if X is always the sum of the most recent two past
values of X, the output will be 0.  Assume the last 2 values of X are
11, then the next value of X should be 1 + 1 = 0. This extends the
X-sequence to 110.  The NEXT value of X is 0 + 1 = 1, extending the
sequence to 1101.  The next value is 1 + 0 = 1, extending the sequence
to 11011.  Now the initial condition is what we started with, a
sequence of 2 1s, so the sequence will repeat.  The subsequence
constituting one period is therefore (110).  Note that all
subsequences of length equal to the period k of the polynomial (in
this case k = 2) are present in some phase of the null sequence.

For the example we did in class, the polynomial (shown above), was (I
+ D + D^2 + D^4).  We found a null sequence (1) i.e., the sequence of
all 1s, and then the sequence (1000110).  Observe that, for any linear
function f, f(x + y) = f(x) + f(y).  Therefore if S1 and S2 are null
sequences, it follows that S1 + S2 is also a null sequence.  So (1) +
(1000110) = (0111001) is also a null sequence.  Now we have, among
these 3 sequences all possible subsequences of length 4 (there are 2^4
= 16, including the trivial, all 0 sequence, which is, of course, a
null sequence of EVERY polynomial.)  Note that the sum of the periods
of all of the null sequences (excluding the all 0 sequence) must,
therefore be 2^k - 1.  In this example, this sum is 1 + 7 + 7 = 15.

Because of the commutative nature of the operations we are employing
(delay and XOR), if we cascade 2 circuits, the ordering does not
matter.  So, for example, if a signal is sent into a circuit C1
corresponding to Z = (I + D + D^2)X, and the output is fed to a
circuit C2 corresponding to some other polynomial P2, the output of
C1, and hence the input to C2 will be 0.  So the output of C2 will be
0 (the all 0 sequence is a null sequence of every polynomial).  If we
reverse the order of C1 and C2, the overall output must STILL be 0.

One consequence of this is that if a polynomial P can be factored into
the product of two or more smaller polynomials, then a null sequence
of any of the factors, is also a null sequence of P.

Note that some polynomials are easy to factor.  Recall the remainder
theorem from ordinary algebra.  It states that, for any polynomial
f(x), the remainder when f(x) is divided by (x - a) is f(a).  In our
modulo-2 system, minus is the same as plus, so that the only
non-trivial form corresponding to (x - a) is (D + I).  Then, for any
polynomial P(D), if (D + I) is a factor, the remainder after division
of P(D) by  (D + I) is 0, which occurs if, and only if P(I) = 0.  But,
it is easy to see that this is true if and only if there are an even
number of terms in the polynomial.  For example, in the case of the
polynomial, which we saw earlier, the number of terms is 4, and so (D
+ I) IS a factor.  Dividing, we get (I + D + D^2 + D^4) = (D + I)(D^3
+ D^2 + I).

4. MAXIMUM-LENGTH NULL SEQUENCES (OR M-SEQUENCES)
These are null sequences of maximum length for a polynomial of degree
k, i.e., they are of length 2^k - 1.  A polynomial with an m-sequence
is called an m-polynomial.  We have already seen one such m-sequence,
(110), the null sequence of (I + D + D^2).  (I + D + D^2 + D^4) is NOT
an m-polynomial because it has several short null sequences, rather
than one large one.  But one of its factors, (D^3 + D^2 + I) IS an
m-polynomial.  Clearly if a polynomial P can be factored, then it
can't be an m-polynomial, because the null sequences of its components
are also null sequences of P.  The properties of m-sequences
corresponding to k-degree polynomials include:
1. The length is 2^k - 1.
2. The corresponding polynomial is prime
3. They contain 2^(k - 1) 1s and 2^(k - 1) - 1 0s.
4. A shifted m-sequence differs from itself in exactly 2^(k - 1)
positions.
5. An m-sequence passed through a polynomial circuit for which it is
not a null sequence will be altered ONLY in phase.
In general, m-sequences look very much like random sequences.

Note that not every prime polynomial is an m-polynomial.  For example,
(I + D + D^2 + D^3 + D^4) is prime, but not an m-polynomial.  (Observe
that 11110 is ONE of its null sequences).

Some examples of relatively simple m-polynomials of high degree are
(D^23 + D^5 + I),  (D^31 + D^3 + I),  (D^60 + D + I)

5. DUALITY OF POLYNOMIALS AND NULL SEQUENCES.
First note that in conventional algebra, 1/(1-x) = 1 + x + x^2 + x^3 +
...
More generally, 1/(1 - x^k) = 1 + x^k + x^2k + x^3k + ...
Similarly, in our linear binary world, I/(I + D^k) = I + D^k + D^2k +
D^3k + ...
(You can verify this directly by carrying out the formal division
process, dividing (I + D^k) into I.)
So a periodic sequence such as 100010001000... can be formally
represented as I/(I + D^4).  A more complex periodic sequence, such as
the period-6 sequence (110100) can be represented by first describing
the typical period by a polynomial (I + D + D^3) and then
premultiplying this by the sequence 10000010000100000...  (Think of
the periodic part as being a sequence of impulses and the response
being represented by the polynomial).  Now we can replace the periodic
part by the reciprocal of the polynomial of form (I + D^k).  In our
example, this would be  I/(I + D^6).  Then the ratio of polynomials (I
+ D + D^3)/(I + D^6) represents the periodic sequence (110100).

Using this approach, we can see that another way to obtain null
sequences of a polynomial is to divide that polynomial into I.

Suppose that P/Q represents a null sequence of a polynomial R.  Then
R(P/Q) = I for some appropriate initial conditions.  But this could
also have been written as P(R/Q) = I.  So we can think of R as
representing the sequence and P the polynomial.  The roles of
polynomials and sequences can thus be interchanged.

Note that we can also express this as PR = Q.  Since Q is of the form
(I + D^k), it follows that a polynomial that is a factor of (I + D^k)
would have a null sequence of period k (or of a factor of k).  So if P
is an m-polynomial of degree n, it can't be a factor of any polynomial
(I + D^k) where k is less than 2^(n) - 1.

6. LINEAR SEQUENTIAL CIRCUITS WITH FEEDBACK
We can think of the polynomial type circuits discussed above in terms
of transfer functions relating the outputs to the inputs.  The form
for these circuits is Z/X = P(D).  What about a transfer function of
the form Z/X = I/P(D)?  This can be thought of as an inverse form.
For example,
Z/X = I/(D^2 + D + I).  To see how this can be realized, cross
multiply to get
(D^2 + D + I)Z = X.  Solving for Z we get Z = X + DZ + D^2Z.  So Z is
a function of the present value of X and two past values of Z.  A
circuit realizing this transfer function would consist of two cascaded
delays fed by the output of a 3-input XOR-gate whose inputs are X and
the outputs of each of the delays.  The output of the XOR-gate is Z.
What is the impulse response of such a circuit?  This would be the
solution of the equation
(D^2 + D + I)Z = 1.  Note that the right side is a single 1 followed
by an infinite number of 0s. So the solution is a null sequence of
(D^2 + D + I), which we found earlier to be (011).  So now we have a
way of GENERATING null sequences, including, as in this example,
m-sequences.

More general synthesis method: applicable where both the numerator and
denominator of the transfer function are non-trivial polynomials.
First step should be to reduce the fraction, i.e., remove any factors
common to both the numerator and denominator.  (The Euclidean
Algorithm can be used to accomplish this.)

Consider Z/X = (D^3 + D^2 + I)/(D^2 + D + I).  First realize the
denominator part as was done above.  That is, realize Z1/X = I/(D^2 +
D + I).  Then observe that Z = (D^3 + D^2 + I)Z1.
So we can simply add a polynomial circuit immediately after the one
with feedback.  But then we observe that the signal Z1 is fanned out
to the inputs of two strings of delays (we might think of these as
shift registers).  There is no need to duplicate all of these delays,
since the output after the first delay of each string is the same.
Thus we need only retain the longest of the two shift registers (in
this case the one corresponding to the numerator polynomial.  We send
signals from the outputs of each delay in the string to one, two, or
no XOR-gates (one for the numerator and the other for the
denominator.)  Thus, the number of delays needed corresponds to the
degree of the larger of the two polynomials (one for the numerator and
the other for the denominator).  In short, we can realize any
realizable transfer function with a shift register and two multi-input
XOR-gates.

SOURCES
The founder of the subject of linear sequential circuits was David
Huffman, whose original papers appeared in 1956.  The most
comprehensive study that I know of is the book by Arthur Gill, who
goes deeply into the math.  A good introduction along the lines that
we are following in this course is in Chapter 15 of Kohavi's book.

Gill, Arthur, "Linear Sequential Circuits", McGraw-Hill, 1966.
Kohavi, Zvi, "Switching and Finite Automata Theory", Second Ed.,
McGraw-Hill, 1978.
```