Download Lecture Notes on Sequential Circuit Analysis | CS 231 and more Study notes Computer Architecture and Organization in PDF only on Docsity!
3/15/^
Sequential circuit analysis
Sequential Circuit Analysis
•^ Last week we started talking about latches and flip-flops, which arebasic one-bit memory units.•^ Today we’ll talk about sequential circuit analysis and design.•^ First, we’ll see how to analyze and describe sequential circuits.–^ State tables
show the inputs, outputs, and flip-flop state changesfor sequential circuits.– State diagrams^ are an alternative but equivalent way of showingthe same information.CombinationalInputscircuit Memory
Outputs
3/15/^
Sequential circuit analysis
An example sequential circuit
•^ Here is a sequential circuitwith two JK flip-flops. Thereis one input, X, and oneoutput, Z.•^ The values of the flip-flops(QQ) form the state, or the^10 memory, of the circuit.•^ The flip-flop outputs also goback into the primitive gateson the left. This fits thegeneral sequential circuitdiagram at the bottom.
CombinationalInputscircuit Memory
Outputs
X^
Z Q0Q
3/15/^
Sequential circuit analysis
Analyzing our example circuit
•^ A basic state table for our example circuitis shown below.•^ Remember that there is one input X, oneoutput Z, and two flip-flops Q
Q. 10
•^ The present state Q
Qand the input will 1 0
determine the next state and the output.Present State
Inputs^ Next State
Outputs Q^ Q^1
X^ Q^ Q^1
Z
3/15/^
Sequential circuit analysis
The outputs are easy
•^ The output depends on the current state –Q0 and Q1 – as well as the inputs.•^ From the diagram, you can see that
Z = QQX^10 Output at the current timePresent State^ Inputs
Next State^
Outputs Q^ Q^1
X^ Q^ Q^1
Z
3/15/^
Sequential circuit analysis
Step 1: Flip-flop input equations • For our example, the flip-flopinput equations are:J = X’ Q 1 0 K = X + Q 1 0 J = X + Q 0 1 K = X’ 0 • JK flip-flops each havetwoinputs, J and K. (D and T flip-flops have one input each.)
3/15/^
Sequential circuit analysis
Step 2: Flip-flop input values
•^ With these equations, we can make a table showing J
, K^ , J^ and K^ for 1 10 0
the different combinations of present state Q
Qand input X. 10
J^ = X’ Q^1
J^ = X + Q^0
K^ = X + Q^1
K^ = X’^0
Present State^ Inputs
Flip-flop Inputs Q^ Q^1
X^ JK^1
JK^0
3/15/^
Sequential circuit analysis
Step 3 concluded
•^ Finally, here are the next states for Q
and Q, using these equations: 1 0 Q(t+1) = K ’Q(t) + J^ Q’(t) 1 1 1 1 1 Q(t+1) = K ’Q(t) + J^ Q^ ’(t) 00000
Present State^ Inputs
FF Inputs
Next State Q^ Q^1
X^ JK^1
JKQ^0 0
Q^0
3/15/^
Sequential circuit analysis
Getting the state table columns straight • The table starts with Present State and Inputs.– Present State and Inputs yield FF Inputs.– Present State and FF Inputs yield Next State, based on the flip-flop characteristic tables.– Present State and Inputs yield Output.• We really only care about FF Inputs in order to find Next State.Present State^ Inputs^
FF Inputs^ Next State
Outputs
QQX^1
JKJ^ K^1 1 0
Q^ QZ^1
3/15/^
Sequential circuit analysis
Sizes of state diagrams
0/0^ 0/0 0/
Present State^ Inputs
Next State^ Outputs Q^ QX^1
Q^ Q^ Z^1
•^ Always check the size of your state diagrams.–^ If there are
n flip-flops, there should be 2
n^ nodes in the diagram.
–^ If there arem inputs, then each node will have 2
m^ outgoing arrows.
•^ From each state• In our example,– We have two flip-flops, and thus four states or nodes.– There is one input, so each node has two outgoing arrows.
A D
B C
3/15/^
Sequential circuit analysis
Sequential circuit analysis summary • To analyze sequential circuits, you have to:– Find Boolean expressions for the outputs of the circuit and the flip-flop inputs.– Use these expressions to fill in the output and flip-flop inputcolumns in the state table.– Finally, use the characteristic equation or characteristic table ofthe flip-flop to fill in the next state columns.• The result of sequential circuit analysis is a state table or a statediagram describing the circuit.
3/15/^
Sequential circuit analysis
Sequence recognizers
•^ A sequence recognizer is a special kind of sequential circuit that looksfor a special bit pattern in some input.•^ The recognizer circuit has only one input, X.–^ One bit of input is supplied on every clock cycle. For example, itwould take 20 cycles to scan a 20-bit input.–^ This is an easy way to permit arbitrarily long input sequences.•^ There is one output, Z, which is 1 when the desired pattern is found.•^ Our example will detect the bit pattern “1001”:
Inputs:^ 1 1 1 0 0 1 1 0 1 0 0 1 0 0 1 1 0 …Outputs:^ 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 …Here, one input and one output bit appear every clock cycle.
•^ This requires a sequential circuit because the circuit has to “remember”the inputs from previous clock cycles, in order to determine whether ornot a match was found.
3/15/^
Sequential circuit analysis
A basic state diagram
•^ What state do we need for the sequence recognizer?–^ We have to “remember” inputs from previous clock cycles.–^ For example, if the previous three inputs were 100 and the currentinput is 1, then the output should be 1.–^ In general, we will have to remember occurrences of parts of thedesired pattern—in this case, 1, 10, and 100.•^ We’ll start with a basic state diagram:A^
B^
C^
D
1/^
0/^
State^
Meaning A^ None of the desired pattern (1001) has been input yet.B^ We’ve already seen the first bit (1) of the desired pattern.C^ We’ve already seen the first two bits (10) of the desired pattern.D^ We’ve already seen the first three bits (100) of the desired pattern.