670 likes | 1.03k Views
Logic Circuit Design. Yawgeng Chau. Contents. Binary Systems Boolean Algebra and Logic Gates Gate-Level Minimization Combinational Logic Synchronous Sequential Logic Registers and Counters Memory and Programmable Logic. 5.1 Sequential Circuits. Sequential circuits consist of
E N D
Logic Circuit Design Yawgeng Chau
Contents • Binary Systems • Boolean Algebra and Logic Gates • Gate-Level Minimization • Combinational Logic • Synchronous Sequential Logic • Registers and Counters • Memory and Programmable Logic Logic Circuits
5.1 Sequential Circuits • Sequential circuits consist of • Input, logic gates, output, storage elements • State of storage elements is a function of past input • Output depends on current and past inputs. • State: binary information stored in memory • Sequential circuit is specified by • A time sequence of inputs, outputs, and internal states. Logic Circuits
5.2 Synchronous vs. Asynchronous • Synchronous Sequential Circuit • Function according to its inputs and states at discrete instants of time. • Asynchronous Sequential Circuit (Ch. 9) • Function according to its inputs and states at discrete instants of time and the input changing order. • May become unstable due to feedback. Logic Circuits
Synchronous Clocked Sequential Circuit • Use clock generator to generate a periodic train of clock pulses. • Storage elements are activated when a clock pulse arrives. • States can change during pulse transition. Logic Circuits
Flip-Flops as storage elements • Flip-flop : binary storage device to store 1bit. Logic Circuits
S=1 Set State 5.3 SR Latch with NOR Gates • S or R must go back to 0 before further changes to avoid undefined states. • 1 should not on S and R at the same time. R=1 Reset State Forbidden Logic Circuits
R=0 Reset State SR Latch with NAND Gates • S or R must go back to 1 before further changes to avoid undefined states. • 0 shouldn't go on S and R at the same time. S=0 Set State Forbidden Logic Circuits
SR Latch with Control Input • Enable signal is used to determines when the state of the latch can be changed. En=1: enable; En=0: disable Logic Circuits
D Latch • To ensure that S and R never equal to 1 at the same time. • Transparent latch: temporary bit storage Logic Circuits
Graphic Symbols SR Latch with NAND gates NOR gates Logic Circuits
Latch Problem from Feedback (1/2) Unpredictable results if En=1 with changing D Logic Circuits
Latch Problem from Feedback (2/2) • Latch state changes once the clock pulse changes to 1. • New latch state appears at the output while the pulse is active. • The output works on the latch input through combinational feedback. • If inputs change while the clock pulse is in 1, the latch will respond and result in new outputs. Logic Circuits
5.4 Flip-Flops (1/2) • Flip-Flop (FF): a memory element changes at the edge of clock only • If level-triggered flip-flops are used • The feedback path may cause instability problem • Edge-triggered flip-flops • The state transition happens only at the edge • Eliminate the multiple-transition problem Logic Circuits
Flip-Flops (2/2) • Trigger : Change in control input. • Triggered only during a signal transition. Level trigger Positive trigger or rising-edge trigger Negative trigger or falling-edge trigger Logic Circuits
D Flip-Flops Q(t+1)=D • Work as D-latch, but edge-trigger Characteristic Table D Q(t+1) 0 0 1 1 Fig. 5.11 Graphic symbols foredge-triggered D flip-flop Logic Circuits
Master-Slave D Flip-Flop (1/2) • Negative-edge trigger Master: DY Slave: Q doesn’t change Y doesn’t change YQ Logic Circuits
Master-Slave D Flip-Flop (2/2) • How to make it be a positive-edge triggered flip-flop? Logic Circuits
D-Type Positive-Edge Triggered Flip-Flop • Initially, CLK=0, S=1,R=1; Q(t+1)=Q(t) • When CLK1 as D=0, R0, Q=0 • If D changes to 1 when CLK=1, R=0 because Q=0 • When CLK1 as D=1, S0, Q=1 • If D changes to 0 when CLK=1, S=0. Logic Circuits
Time Parameters • Setup Time: minimum time such that D must be maintained at a constant value before clock transition. • Hold Time: minimum time such that D does not change after the positive clock transition. • Propagation Delay Time: time from trigger edge to the time of a stable output. Logic Circuits
JK Flip-Flop J K Q(t+1) 0 0 Q(t) Hold 0 1 0 Reset 1 0 1 Set 1 1 Q'(t) Toggle Q(t+1)= D = JQ(t)' +K'Q(t) Logic Circuits
T Flip-Flop T=0, D=Q(t) , Q(t+1)=Q(t) T=1, D=Q'(t) , Q(t+1)=Q'(t) T=0, J=K=0, Q(t+1)=Q(t) T=1, J=K=1, Q(t+1)=Q'(t) T Q(t+1) 0 Q(t) Hold 1 Q'(t) Toggle Q(t+1)=TQ(t) Logic Circuits
Characteristic Tables Logic Circuits
Characteristic Equations K 0 1 J 0 1 Q(t+1)=J'K'Q+JK'+JKQ'=J'K'Q+JK'Q+JK'Q'+JKQ' = K'Q+JQ' Logic Circuits
Preset& Clear (Reset) • Asynchronous input R=0 clear; R=1 undo 1 1 Logic Circuits
5.5 Analysis • Given a sequential circuit, we try to guess what it is. • Step 1: write the excitation equations or the state equations • Step 2: draw the state table • Step 3: draw the state diagram • Step 4: guess… • All red keywords have the same meaning. Logic Circuits
Flip-Flop Input/Output Equations flip-flop input DA =Ax+ Bx DB =A'x y = (A+B)x' DA flip-flop name Step 1 (way 1) Compute input equation (or called excitation equation) & output equation Logic Circuits
Next-State Derivation Step 1 (Way1) : determine input equations (or excitation equations) using present states and input variables. Step 2: list all binary combination of inputs/state. Use characteristic table to determine next state values and create the state table. Logic Circuits
State Equations A DA=Ax+Bx x Step 1 (way 2) x excitation or input equation B DA =A x +B x DB = A' x output equation y = (A+B)x' A' DB=A'x characteristic equation x Q(t+1)=D state equation A(t+1) = DA =A x +B x B(t+1) = DB = A' x B y=x'(A+B) A x' x Logic Circuits
State Table (1/2) Step 2 Draw the state table (form 1) DA =Ax+ Box DB =A'x y = (A+B)x' (1) excitation equ. DADB A B 00 01 00 11 00 10 00 10 00 01 00 11 00 10 00 10 (2) state equ. A(t+1)= Ax+ Bx B(t+1)= A'x y(t) = (A+B)x' Logic Circuits
State Table (2/2) Step 2 Draw the state table (form 2) Logic Circuits
State Diagram Step 3 Draw the state diagram AB State Mealy Machine Logic Circuits
Example of D Flip-Flop Step 1 excitation equation or state equation DA=Axy xy Step 2 state table Step3 state diagram Logic Circuits
Example of JK Flip-Flop (1/3) Step 1 excitation equation JA= B KA=Bx' JB= x' KB=Ax JA=B x' KA=Bx' B JB=x' A KB=Ax x Logic Circuits
Example of JK Flip-Flop (2/3) Step 2 state table JA= B KA=Bx' JB= x' KB=Ax Logic Circuits
State Equations Derived with Characteristic Equations and Input Equations characteristic equation Q(t+1)= D = JQ(t)' +K'Q(t) → State equations JA=B A (t+1)= JAA' +KA'A = BA' +(Bx')'A = A'B +AB' +Ax KA=Bx' JB=x' B (t+1)= JBB' +KB'B = x'B' +(Ax)'B = B'x' +ABx +A'Bx' KB=Ax Logic Circuits
Example of JK Flip-Flop (3/3) Step3 state diagram Logic Circuits
Example of T Flip-Flop (1/3) x TA=Bx y=AB B Step 1 characteristic equation input/output equation TB=x state equation Logic Circuits
Example of T Flip-Flop (2/3) Step 2 state table TA= Bx TB = x y = AB TATB A B 00 01 01 10 10 11 11 00 Logic Circuits
Example of T Flip-Flop (3/3) Step 3 state diagram Input AB / y State/output Moore Machine Logic Circuits
Mealy FSM (Finite State Machine) • Output is a function of input and present state. • For synchronized output, inputs are synchronized with the clock. • Outputs must be sampled during the clock edge. y=x'(A+B) Logic Circuits
Moore FSM x TA=Bx y=AB B • Output is a function of present state only. • Outputs are synchronized with the clock. TB=x Logic Circuits
5.7 State Reduction • To reduce the flip-flop number. • May require more combinational gates. Design a ciruit: Step 1 Draw the state diagram but find the graph is complex Logic Circuits
Example (1/5) 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 Logic Circuits
Example (2/5) Step 2 Draw the state table Logic Circuits
Example (3/5) • States g and e are equivalent. g is replaced by e. Step 2 Find two equivalent states, replace one with another, redraw the state table Logic Circuits
Example (4/5) • States f and d are equivalent. f is replaced by d. Step 3 Repeat Step 2 until you can not find any more Logic Circuits
Example (5/5) Step 4 Redraw the state diagram Logic Circuits
State Assignment Step 5 State assignment Redraw the state table Logic Circuits
5.8 Simplified Design Procedure Step 1: Derive a state diagram from operation specifications. Step 2: Obtain the state table by finding the input values of flip-flops. Step 3: Derive input equations and output equations. Step 4: Draw the sequential circuit Logic Circuits