Download Synchronous Sequential Logic - Design and Analysis - Lecture Notes and more Study notes Digital Systems Design in PDF only on Docsity!
COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES
Chapter 5: Synchronous Sequential Logic NOTE: For more examples and detailed description of the material in the lecture notes, please refer to the main textbook: Digital Design 3rd Edition, By Morris Mano, Publisher Prentice Hall, 3rd Edition All examples used in the lecture notes are from the above reference.
Sequential Circuits
- A sequential circuit consists of a combinational circuit and a feedback through the storage elements in the circuit.
Combinational Circuit
Inputs^ Outputs Memory Element
- Sequential circuits can be categorized as being synchronous or asynchronous.
- A synchronous sequential circuit usually has a clock pulse (clocked sequential circuits).
- Flip-flops are storage elements which are used in clocked sequential circuits.
- Each flip-flop can store one bit.
- A synchronous clocked sequential circuit is shown below:
Combinational Circuit
Inputs^ Outputs Memory Clock Pulse Element
Clock Pulse
Latches
- Latches are the basic types of flip-flops.
- The SR latch is a latch with two inputs S (set) and R (reset), and an output Q.
- Q = 1 ( Q’ = 0) represents the set state and Q = 0 ( Q’ = 1) represents the reset state.
- The SR latch can be implemented by NOR gates or NAND gates.
R S
Q
0 R
S
Q
Q ’
S R Q Q ’
1 0 1 0 (Set state) 0 0 1 0 (After S =1, R =0) 0 1 0 1 (Reset state) 0 0 0 1 (After S =0, R =1) 1 1 0 0 (Undefined)
- After any change in the input, it has to go to zero so that the circuit becomes ready for the next state.
- In undefined state the next output is not predictable when both inputs go back to zero (it depends whether the S or R input goes to zero first).
- NAND gate implementation:
S R Q Q ’ 1 0 0 1 1 1 0 1 (After S =1, R =0) 0 1 1 0 1 1 1 0 (After S =0, R =1) 0 0 1 1 (Undefined)
S
R
Q
Q ’
- One should make sure that both inputs are not connected to zero simultaneously.
- SR latch with control input is shown below:
- Two different ways to construct a D flip-flop from latches are shown below.
D C
D C
D Y Q
CLK
D latch (master)
D latch (slave)
- The value of D is being transferred to Y during CLK = 1 but it is being transferred to Q only when CLK changes from 1 to 0.
- One can change the position of the inverter to make the circuit a positive-edge triggered D flip-flop.
Q
Y
D
CLK
- More efficient construction (using three SR latches)
Q
Q ’
S
CLK
R
Z
Y
D
- S and R are equal to 1 while CLK = 0 (which causes no change in the output)
- If D = 0 when CLK becomes 1, R changes to 0 (Since S = 1, Z = 1, CLK = 1) and this resets the Flip-Flop, making Q = 0.
- Now if D changes its value (while CLK = 1), since R = 0, we will have Z = 1 and it will not change the value of R.
- When clock goes to 0, R goes to 1 (while S = 1 too) which is a normal condition, causing no change in the output.
- Now if D = 1 when CLK goes to 1, it makes Z = 0 ( D = 1, R = 1) and it causes Y = 1 and since CLK = 1, Y = 1, so S becomes 0, and this sets the output ( S = 0, R = 1)
- Any change in D while CLK = 1 does not affect the output.
- Setup time is the minimum time for which the D input must stay at a constant value prior to the next clock change.
- Hold time is the minimum time for which the D input must stay unchanged after the clock change.
- Propagation delay is the interval between the trigger edge and the stabilization of the output to a new state.
- The symbols for D flip flop are shown in the following figures.
D C
D C Positive-edge triggered D flip-flop Negative-edge triggered D flip-flop
- There are three operations that can be performed with a flip-flop: set, reset, or complement the output.
JK Flip-Flop:
- The JK flip-flop can be derived from the D flip-flop using the Boolean function D = JQ ′+ K ′ Q as follows:
- The characteristic equation of the D flip-flop and the JK flip-flop are as follows: Q ( t +1)= D , Q ( t +1)= J. Q ’( t )+ K ’. Q ( t )
T Flip-Flop
- The T (toggle) flip-flop can be derived from the D flip-flop using the Boolean function D = T ⊕ Q = T. Q ′+ T ′. Q as follows.
D C
T Q Q ’
- It can also be derived from a JK flip-flop as follows.
J K
C
T Q ’
Q
- When T =0, then D is equal to Q , which means that the output remains unchanged after the next clock edge.
- When T =1, then D becomes equal to Q ’, which implies that the output is complemented after the next clock edge.
- The characteristic equation of the T flip-flop can be obtained as follows. D = T ⊕ Q = T. Q '+ T '. Q ⇒ Q ( t + 1 )= T. Q '+ T '. Q
- The characteristic table of the T flip-flop is given below.
T Q ( t +1) 0 Q ( t ) No change 1 Q ’( t ) Compliment
- The graphic symbol of the T flip-flop is as follows.
T C
- Direct inputs: Sometimes asynchronous inputs are used to change the state of a flip- flop to a preset (direct set) or clear (direct reset) state at any desired time (regardless of clock pulses).
D
Preset
Clear
R
S Q
Q ’
CLK
x
y
- Start with S = R = 1 (normal condition). Assume that Clear = 0. Then Q’ = 1, and since S = 1 and Preset = 1, it resets the flip-flop ( Q = 0).
- Start again with S = R = 1 (normal condition). Assume now that Preset = 0. Then Q will be equal to 1, and since R = 1 and Clear = 1, thus Q’ goes to zero, which sets the flip-flop ( Q = 1).
- Thus, if Clear is zero, the flip-flop will be cleared to zero, i.e. Q = 0, and if Preset is equal to 0, it forces the flip-flop into Q = 1.
- In general case, we will have the following representation of the D flip-flop with direct reset (↑ represents the positive edge of the CLK ).
D^ Reset^ C^ D^ Q^ Q ’ C
Q Q ’
Data CLK
Reset
R^0
X
X
m flip-flops n inputs
Present state Input Next state Output A B x A B y 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 0 0
A.x+B.x A’.x A.x’+B.x’
2 m + n rows
- For some applications (like state reduction) we may use the following form of the state table: Next state Output Present state x= 0 x= 1 x= 0 x= 1 A B A B A B y y 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 0 1 0
- State diagram:
AB (^) Input/output AB
Present state Next state
- The state diagram follows directly from the state table.
- For the previous example:
1/0 1/
- Flip-flop input equations or excitation equations (for a circuit with D flip-flops, it is the same as the state equation):
y A B x
D A x
D Ax Bx B
A
= +^ ′
- Each interconnection with the corresponding initial and final states, can be built by using a combinatorial circuit corresponding to the interconnections)
- Example (analysis with D flip-flop): In the circuit below, we have D (^) A = A ⊕ x ⊕ y
Present inputs state
Next state
A x y A 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1
Fig. 5.
0/1^ 0/
0/0 1/
D C
x (^) A y CLK
Present state Input^ Next State Flip-Flop inputs A B x A B (^) J (^) A K (^) A J (^) B KB 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 0 0 0 0 0 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0
Not part of a table, but needed for obtaining next states. These are obtained from the boolean expressions just like ordinary truth table.
- One can find the next state from the state equations by substituting the input equations into the flip-flop characteristic equations.
- Characteristic equation for the previous example is:
Bt J B K B
At J A K A B B
A A ( 1 )..
'
'
- Substituting the flip-flop input equations given in (5.1) into the above equations:
Bt x B A x B B x ABx ABx
At BA Bx A A B AB Ax ( 1 ). ( )...... stateequations: (^1 ). (. )....
⇒ find the next states in the state table (no need for the flip-flop inputs).
1
1 1
Fig. 5.
0 0
0
1
- Analysis with T flip-flops:
- It can be done by using either the characteristic table, or the characteristic equation.
- Example:
y A B
T x
T Bx B
A
.
0
CLK
x (^) T A C (^) R
y
T C (^) R
reset
B
- Characteristic equations:
Bt T B
At T A B
A
- Substituting the input equations into the characteristic equations:
Bt x B
At Bx A Bx A AB Ax ABx
+ = ′ + ′= ′+ ′+^ ′
Present state Input^ Next State Output A B x A B y 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 0 1
a
- In Particular, for the input sequence 01010110100 and assuming that the initial state is a , we will have:
- State reduction means to reduce the number of states in a sequential circuit with an identical input-output relationship.
- The easiest way of state reduction is through state table as follows:
State a a b c d e f f g f g a Input 0 1 0 1 0 1 1 0 1 0 0 Output 0 0 0 0 0 1 1 0 1 0 0
c
1/
0/0 (^) b
0/
1/
0/
0/
e
1/
g d
f
1/
0/
1/
1/ 0/
1/
0/
Present Next state Output state x=0 x=1 x=0 x= a a b 0 0 b c d 0 0 c a d 0 0 d e f 0 1 e a f^0 f g f 0 1 g a f 0 1
- Two states are equivalent if for identical inputs they give exactly the same output and result in a transition to the same state (or an equivalent state).
- If two states are equivalent, one of them can be removed without changing the input- output operation of the circuit.
- We have to find a pair of equivalent states and delete one.
- States g and e are equivalent and we can delete g and replace it with e.
Present Next state Output state (^) x=0 x=1 x=0 x= a a b 0 0 b c d 0 0 c a d 0 0 d e f 0 1 e a f 0 1 f e f 0 1
- Now we can see that d and f also have similar rows associated with them.
- Reduced table:
- State assignment using coded binary values is required for designing a sequential circuit.
- The number of bits ( n ) in the code must be such that , when m is the number of states.
2 n^ ≥ m
state
Assignement 1 Binary
Assignement 2 Gray code
Assignement 3 One-hot
a^0 0 0 0 0 0 0 0 0 0 b 0 0 1 0 0 1 0 0 0 1 0 c 0 1 0 0 1 1 0 0 1 0 0 d^0 1 1 0 1 0 0 1 0 0 e 1 0 0 1 1 0 1 0 0 0 0
- Using binary assignment 1, the previous simplified state table will be:
Present Next state Output state (^) x=0 x=1 x=0 x= 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1
- Design Procedure:
- Translating the design specifications to the state diagram.
- State reduction
- Assigning binary values to the states
- Obtaining binary coded state table
- Choosing the type of flip-flop
- Deriving the simplified flip-flop input equations and output equations.
- Drawing the logic diagram
- Example: Design a circuit that detects three or more consecutive 1’s in a string of bits coming through an input line.
- Note that this is a Moore model as the output only depends on the states.
Synthesis using D Flip-Flops:
- We have to find the state table first.
- Find the flip-flop input equations:
y AB x
Bt D ABx
At D ABx B
A
Present state Input^ Next State Output A B x A B y 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 1 0 1 1 0 0 0 1 1 1 1 1 1 1
S (^) 0/0 1 S (^) 1/
1
0
S (^) 3/1 1 S (^) 2/
0 0
0
1