CSE 140: Components and Design Techniques for Digital Systems Lecture 9: Sequential Networks: Implementation CK Cheng Dept. of Computer Science and Engineering University of California, San Diego
Implementation Format and Tool Procedure Excitation Tables Examples Mealy & Moore Machines, Excitation Table Procedure State Table to Logic Diagram Excitation Tables FFs Examples
Canonical Form: Mealy and Moore Machines Mealy Machine: yi(t) = fi(X(t), S(t)) Moore Machine: yi(t) = fi(S(t)) si(t+1) = gi(X(t), S(t)) x(t) x(t) C1 C2 y(t) C1 C2 y(t) CLK CLK S(t) S(t) Mealy Machine Moore Machine
iClicker In the logic diagram below, a D flip-flop has input x and output y. A: x= Q(t), y=Q(t) B: x=Q(t+1), y=Q(t) C: x=Q(t), y=Q(t+1) D: None of the above D y CLK x Q
Understanding Current State and Next State in a sequential circuit “Yesterday is gone. Tomorrow has not yet come. We have only today. Let us begin.” ― Mother Teresa today sunrise
Implementation Format Canonical Form: Mealy & Moore machines State Table Netlist Tool: Excitation Table x(t) C1 C2 y(t) CLK Q(t) Q(t+1) = g(x(t), Q(t)) Circuit C1 y(t) = f(x(t), Q(t)) Circuit C2
Implementation Tool: Excitation Table Example: State Table id x(t) Q(t) Q(t+1) 1 2 3 x(t) C1 CLK Q(t) Find D, T, (S R), (J K) to drive F-Fs
Implementation Tool: Excitation Table Example: State Table id x(t) Q(t) Q(t+1) 1 2 3 Excitation Table x(t) Q(t) C1 T(t) CLK id x(t) Q(t) T(t) Q(t+1) 1 2 3 Q(t) Example with T flip flop
Implementation Tool: Excitation Table Implement combinational logic C1 D(t), T(t), (S(t) R(t)), (J(t) K(t)) are functions of (x,Q(t)) Example: Excitation Table x(t) C1 CLK Q(t) id x(t) Q(t) T(t) Q(t+1) 1 2 3 Q(t)
Implementation: Procedure State Table => Excitation Table Problem: To implement C1, we need D(t), T(t), (S(t) R(t)), (J(t) K(t)) as functions of (x,Q(t)). 1. From state table, we have NS: Q(t+1) = g(x(t),Q(t)) 2. Excitation Table of F-Fs: The setting of D(t), T(t), (S(t) R(t)), (J(t) K(t)) to drive Q(t) to Q(t+1). 3. Combining 1 and 2, we have excitation table of C1: D(t), T(t), (S(t) R(t)), (J(t) K(t)) = h(x,Q(t)).
Implementation: Procedure F-F State Table <=> F-F Excitation Table DTSRJK PS Q(t) NS Q(t+1) D F-F D(t)= eD(Q(t+1), Q(t)) T F-F T(t)= eT(Q(t+1), Q(t)) SR F-F S(t)= eS(Q(t+1), Q(t)) R(t)= eR(Q(t+1), Q(t)) JK F-F J(t)= eJ(Q(t+1), Q(t)) K(t)= eK(Q(t+1), Q(t)) NS Q(t+1) PS Q(t) DTSRJK
Excitation Table State table of JK F-F: 00 1 01 10 11 Q(t) Q(t+1) JK 1 01 10 11 Q(t) Q(t+1) JK Excitation table of JK F-F: 0- -1 1 1- -0 PS NS Q(t) Q(t+1) JK Ex: If Q(t) is 1, and Q(t+1) is 0, then JK needs to be -1.
Excitation Tables and State Tables Q(t+1) JK 00 1 10 11 Q(t) Q(t+1) NS 01 JK 0- -1 1 1- -0 PS 1 Q(t) SR 0- XY 1 10 -0 PS NS Q(t) Q(t+1) SR 00 1 01 PS SR Q(t) Q(t+1) 10 11 - iClicker XY= -1 XY= 01 XY= 10 XY= 1- None of the above
Excitation Tables and State Tables 1 PS NS Q(t) Q(t+1) T D Q(t+1) D NS D PS 1 PS 1 1 1 Q(t) Q(t) Q(t+1)
Implementation: Procedure State table: y(t)= f(Q(t), x(t)), Q(t+1)= g(x(t),Q(t)) Excitation table of F-Fs: D(t)= eD(Q(t+1), Q(t)); T(t)= eT(Q(t+1), Q(t)); (S, R), or (J, K) From 1 & 2, we derive excitation table of the system D(t)= hD(x(t),Q(t))= eD(g(x(t),Q(t)),Q(t)); T(t)= hT(x(t),Q(t))= eT(g(x(t),Q(t)),Q(t)); (S, R) or (J, K). Use K-map to derive combinational logic implementation. D(t)= hD(x(t),Q(t)) T(t)= hT(x(t),Q(t)) y(t)= f(x(t),Q(t))
Implementation: Example Implement a JK F-F with a T F-F Q Q’ C1 J K T Q Implement a JK F-F: Q(t+1) = h(J(t),K(t),Q(t)) = J(t)Q’(t)+K’(t)Q(t) JK JK PS 00 1 01 10 1 11 1 1 Q(t)
Example: Implement a JK flip-flop using a T flip-flop Excitation Table of T Flip-Flop i.e. Q(t+1)(t) = JQ’(t)+K’Q(t) 1 PS NS Q(t) Q(t+1) State table: y(t)= f(Q(t), x(t)), Q(t+1)= g(x(t),Q(t)) Excitation table of F-Fs: D(t)= eD(Q(t+1), Q(t)); T(t)= eT(Q(t+1), Q(t)); (S, R), or (J, K) From 1 & 2, we derive excitation table of the system D(t)= hD(x(t),Q(t))= eD(g(x(t),Q(t)),Q(t)); T(t)= hT(x(t),Q(t))= eT(g(x(t),Q(t)),Q(t)); (S, R) or (J, K). Use K-map to derive combinational logic implementation. D(t)= hD(x(t),Q(t)) T(t)= hT(x(t),Q(t)) y(t)= f(x(t),Q(t)) Excitation Table of the Design id 1 2 3 4 5 6 7 J(t) K(t) Q(t) Q(t+1) T(t) T(t) = Q(t) XOR ( J(t)Q’(t) + K’(t)Q(t))
Example: Implement a JK flip-flop using a T flip-flop T(J,K,Q): K 0 2 6 4 0 0 1 1 T = K(t)Q(t) + J(t)Q’(t) 1 3 7 5 Q(t) 0 1 1 0 J J Q Q’ T K
iClicker Before state assignment, the relation of its state table and excitation table is One to one One to many Many to one Many to many None of the above
Let’s implement our free running 2-bit counter using T-flip flops State Table S0 S1 S2 S3 PS Next state
Let’s implement our free running 2-bit counter using T-flip flops State Table with Assigned Encoding State Table 0 0 0 1 1 0 1 1 Current 01 10 11 00 S0 S1 S2 S3 Next
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 2 3
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 2 3
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 2 3 T0(t) = T1(t) = Q0(t+1) = T0(t) Q’0(t)+T’0(t)Q0(t) Q1(t+1) = T1(t) Q’1(t)+T’1(t)Q1(t)
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q1(t) Q0(t) T1(t) T0(t) Q1(t+1) Q0(t+1) 1 2 3 T0(t) = 1 T1(t) = Q0(t)
Free running counter with T flip flops Q Q’ Q0 Q1 1 T1 T0(t) = 1 T1(t) = Q0(t)
Summary: Implementation Set up canonical form Mealy or Moore machine Identify the next states state diagram ⇨ state table state assignment Derive excitation table Inputs of flip flops Design the combinational logic don’t care set utilization