Lecture 9: Sequential Networks: Implementation CSE 140: Components and Design Techniques for Digital Systems Spring 2014 CK Cheng, Diba Mirza Dept. of Computer Science and Engineering University of California, San Diego 1
Implementation • Format and Tool • Procedure • Excitation Tables • Example 2
Canonical Form: Mealy and Moore Machines Mealy Machine: y i (t) = f i (X(t), S(t)) Moore Machine: y i (t) = f i (S(t)) s i (t+1) = g i (X(t), S(t)) x(t) x(t) y(t) y(t) C1 C2 C1 C2 CLK CLK S(t) S(t) Moore Machine Mealy Machine 3
Understanding Current State and Next State in a sequential circuit Preparing for today tomorrow according to our effort today sunrise 4
Implementation Format Canonical Form: Mealy & Moore machines State Table à Netlist Tool: Excitation Table x(t) y(t) C1 C2 CLK Q(t) Q(t+1) = h(x(t), Q(t)) Circuit C1 y(t) = f(x(t), Q(t)) Circuit C2 5
Implementation Tool: Excitation Table State Table id x(t) Q(t) Q(t+1) 0 0 0 1 1 1 1 0 2 0 0 1 3 1 1 0 x(t) C1 Q(t) CLK Find D, T, (S R), (J K) to drive F-Fs 6
Implementation Tool: Excitation Table State Table id x(t) Q(t) Q(t+1) 0 0 0 1 1 1 1 0 2 0 1 1 3 1 1 0 Excitation Table x(t) Q(t) id x(t) Q(t) T(t) Q(t+1) T(t) C1 0 0 0 1 1 Q(t) 1 1 1 1 0 CLK 2 0 1 0 1 3 1 1 1 0 Example with T flip flop 7
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)) Excitation Table x(t) Q(t) id x(t) Q(t) T(t) Q(t+1) C1 Q(t) 0 0 0 1 1 CLK 1 1 1 1 0 2 0 1 0 1 3 1 1 1 0 8
Implementation: Procedure State Table => Excitation Table Problem: Given a state table, we have NS: Q(t+1) = h(x(t),Q(t)) We find D, T, (S R), (J K) to drive F-Fs from Q(t) to Q(t+1). Excitation Table: The setting of D(t), T(t), (S(t) R(t)), (J(t) K(t)) to drive Q(t) to Q(t+1). We implement combinational logic C1 D(t), T(t), (S(t) R(t)), (J(t) K(t)) are functions of (x,Q(t)). 9
Implementation: Procedure State Table => Excitation Table Problem: Given a state table, we have NS: Q(t+1) = h(x(t),Q(t)) We find D, T, (S R), (J K) to drive F-Fs from Q(t) to Q(t+1). Excitation Table: The setting of D(t), T(t), (S(t) R(t)), (J(t) K(t)) to drive Q(t) to Q(t+1). We implement combinational logic C1 D(t), T(t), (S(t) R(t)), (J(t) K(t)) are functions of (x,Q(t)). 10
Implementation: Procedure F-F State Table <=> F-F Excitation Table NS Q(t+1) DTSRJK PS PS Q(t) NS Q(t+1) Q(t) DTSRJK • D F-F • D(t)= e D (Q(t+1), Q(t)) • T F-F • T(t)= e T (Q(t+1), Q(t)) • SR F-F • S(t)= e S (Q(t+1), Q(t)) • R(t)= e R (Q(t+1), Q(t)) • JK F-F • J(t)= e J (Q(t+1), Q(t)) • K(t)= e K (Q(t+1), Q(t)) 11
Excitation Table State table of JK F-F: JK 00 10 11 01 0 0 1 1 0 1 Q(t+1) Q(t) 1 1 0 0 Excitation table of JK F-F : Q(t+1) NS PS 0 1 0- 1- 0 Q(t) 1 -1 -0 JK If Q(t) is 1, and Q(t+1) is 0, then JK needs to be -1. 12
Excitation Tables and State Tables State Tables: Excitation Tables: SR SR Q(t+1) NS SR PS PS 0 1 00 01 10 11 0- 10 0 0 1 - 0 0 Q(t) 1 01 -0 Q(t) 1 1 0 1 - Q(t+1) T T Q(t+1) NS T PS PS 0 1 0 1 0 1 0 1 0 0 Q(t) 1 1 0 Q(t) 1 1 0 Q(t+1) 13
Excitation Tables and State Tables Excitation Tables: State Tables: JK JK Q(t+1) NS JK PS PS 0 1 00 01 10 11 0- 1- 0 0 1 1 0 0 Q(t) 1 -1 -0 Q(t) 1 1 0 1 0 Q(t+1) D D Q(t+1) NS D PS PS 0 1 0 1 0 1 0 1 0 0 Q(t) 1 0 1 Q(t) 1 0 1 Q(t+1) 14
Implementation: Procedure 1. State table: y(t)= f(Q(t), x(t)), Q(t+1)= h(x(t),Q(t)) 2. Excitation table of F-Fs: • D(t)= e D (Q(t+1), Q(t)); • T(t)= e T (Q(t+1), Q(t)); • (S, R), or (J, K) 3. From 1 & 2, we derive excitation table of the system • D(t)= g D (x(t),Q(t))= e D (h(x(t),Q(t)),Q(t)); • T(t)= g T (x(t),Q(t))= e T (h(x(t),Q(t)),Q(t)); • (S, R) or (J, K). 4. Use K-map to derive optional combinational logic implementation. • D(t)= g D (x(t),Q(t)) • T(t)= g T (x(t),Q(t)) • y(t)= f(x(t),Q(t)) 15
Implementation: Example Implement a JK F-F with a T F-F J Q Q K C1 T Q’ Q(t+1) = h(J(t),K(t),Q(t)) = J(t)Q’(t)+K’(t)Q(t) Implement a JK F-F: JK JK PS 00 01 10 11 0 0 1 1 0 Q(t) 1 1 0 1 0 16
Example: Implement a JK flip-flop using a T flip-flop T(t) = Q(t) ⊕ Q(t+1) Excitation Table of T Flip-Flop Q(t+1) NS PS 0 1 0 0 1 Q(t) 1 1 0 T Excitation Table of the Design id J(t) K(t) Q(t) Q(t+1) T(t) 0 0 0 0 0 0 1 0 0 1 1 0 2 0 1 0 0 0 3 0 1 1 0 1 4 1 0 0 1 1 5 1 0 1 1 0 6 1 1 0 1 1 7 1 1 1 0 1 T(t) = Q(t) XOR ( J(t)Q’(t) + K’(t)Q(t)) 17
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 T Q’ K 18
iClicker Given a flip-flop, the relation of its state table and excitation table is A. One to one B. One to many C. Many to one D. Many to many E. None of the above 19
Let’s implement our free running 2-bit counter using T-flip flops S 0 S 1 S 3 S 2 State Table Next state PS S 1 S 0 S 2 S 1 S 3 S 2 S 0 S 3 20
Let’s implement our free running 2-bit counter using T-flip flops S 0 S 1 S 3 S 2 State Table with Assigned Encoding State Table Next Current 01 0 0 S 1 S 0 10 0 1 S 2 S 1 11 1 0 S 3 S 2 00 1 1 S 0 S 3 21
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q 1 (t) Q 0 (t) T 1 (t) T 0 (t) Q 1 (t+1) Q 0 (t+1) 0 0 0 0 1 1 0 1 1 0 2 1 0 1 1 3 1 1 0 0 22
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q 1 (t) Q 0 (t) T 1 (t) T 0 (t) Q 1 (t+1) Q 0 (t+1) 0 0 0 0 1 0 1 1 0 1 1 1 1 0 2 1 0 0 1 1 1 3 1 1 1 1 0 0 23
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q 1 (t) Q 0 (t) T 1 (t) T 0 (t) Q 1 (t+1) Q 0 (t+1) 0 0 0 0 1 0 1 1 0 1 1 1 1 0 2 1 0 0 1 1 1 3 1 1 1 1 0 0 T 0 (t) = T 1 (t) = Q 0 (t+1) = T 0 (t) Q’ 0 (t)+T’ 0 (t)Q 0 (t) Q 1 (t+1) = T 1 (t) Q’ 1 (t)+T’ 1 (t)Q 1 (t) 24
Let’s implement our free running 2-bit counter using T-flip flops Excitation table id Q 1 (t) Q 0 (t) T 1 (t) T 0 (t) Q 1 (t+1) Q 0 (t+1) 0 0 0 0 1 0 1 1 0 1 1 1 1 0 2 1 0 0 1 1 1 3 1 1 1 1 0 0 T 0 (t) = 1 T 1 (t) = Q 0 (t) 25
Free running counter with T flip flops Q 0 1 Q T Q’ Q Q 1 T Q’ T 1 T 0 (t) = 1 T 1 (t) = Q 0 (t) 26
Implementation: State Diagram => State Table => Netlist Pattern Recognizer: A sequential machine has a binary input x in {a,b}. For x(t-2, t) = aab, the output y(t) = 1, otherwise y(t) = 0. Assign mapping a:0, b:1 27
Implementation: State Diagram => State Table => Netlist Pattern Recognizer: A sequential machine has a binary input x in {a,b}. For x(t-2, t) = aab, the output y(t) = 1, otherwise y(t) = 0. Assign mapping a:0, b:1 PI Q How many states should the pattern recognizer have A. One because it has one output B. One because it has one input C. Two because the input can be one of two states (a or b) D. Three because . .. . . . . E. Four because . . . . . 28
PI Q: How many states should the pattern recognizer have A. One because it has one output B. One because it has one input C. Two because the input can be one of two states (a or b) D. Three because . .. . . . . E. Four because . . . . . 29
Implementation: State Diagram => State Table => Netlist Pattern Recognizer: A sequential machine has a binary input x in {a,b}. For x(t-2, t) = aab, the output y(t) = 1, otherwise y(t) = 0. b/1 b/0 a/0 a/0 S0 S1 S2 a/0 b/0 30
State Diagram => State Table with State Assignment b/1 b/0 a/0 a/0 S0 S1 S2 a/0 b/0 PS\x a b PS\x 0 1 00 01,0 00,0 S0 S1,0 S0,0 01 10,0 00,0 S1 S2,0 S0,0 10 10,0 00,1 S2 S2,0 S0,1 State Assignment S0: 00 a: 0 Q 1 (t+1)Q 0 (t+1), y S1: 01 b: 1 S2: 10 31
Example 2: State Diagram => State Table => Excitation Table => Netlist id Q 1 Q 0 x D 1 D 0 y PS\x 0 1 000 0 01 0 001 1 00 0 00 01,0 00,0 010 2 10 0 01 10,0 00,0 011 3 00 0 100 4 10 0 10 10,0 00,1 101 5 00 1 110 6 -- - 111 7 -- - 32
Example 2: State Diagram => State Table => Excitation Table => Netlist id Q 1 Q 0 x D 1 D 0 y Q 0 D 1 (t): 000 0 01 0 0 2 6 4 0 1 - 1 001 1 00 0 1 3 7 5 0 0 - 0 x(t) 010 2 10 0 Q 1 011 3 00 0 100 4 10 0 D 1 (t) = x’Q 0 + x’Q 1 D 0 (t)= Q’ 1 Q’ 0 x’ 101 5 00 1 y= Q 1 x 110 6 -- - 111 7 -- - 33
Example 2: State Diagram => State Table => Excitation Table => Netlist Q 0 Q’ 1 D 0 Q Q’ 0 D x’ Q’ Q 1 y x’ D 1 Q D Q 0 Q’ Q 1 x D 1 (t) = x’Q 0 + x’Q 1 D 0 (t)= Q’ 1 Q’ 0 x’ y= Q 1 x 34
Recommend
More recommend