Chapter 5 Sequential Logic Circuits Part II Hiroaki Kobayashi 7//2 Ver. 72 7//2 Computer Engineering What is a Sequential Circuit? A circuit consists of a combinational logic circuit and internal memory to store its current state, and outputs depend on the current inputs as well as internal state The next state is also generate based on the current inputs and state, and stored in the internal memory. State transition of the current state to the next state is triggered when inputs are changed Combinational Logic circuit Internal Memory 7//2 Computer Engineering 2 Sequential Logic Circuit
Basic Element for Sequential Circuits SR Latch Latch Store one-bit information (two states of and ) Two inputs, R and R and Two outputs and (state) Basic functions of SR-latch S Set SR-latch S R Reset SR-latch S R Hold the current value of SR-latch memory S=R=, take unstable values! Prohibited inputs Circuit of SR-latch Timing chart to describe time-variant behavior of SR-latch 7//2 Computer Engineering 3 Asynchronous or Synchronous Asynchronous Circuits Takes an action when inputs changed States of sequential circuits changed soon after inputs provided No implicit control for circuits unexpected behaviors responding to transit input signals Synchronous Circuits Inputs are accepted when control clock asserted (rising or failing edge of clock) Easy to control circuits Clock should appropriately be adjusted to guarantee the correct behavior of circuits Timing design is very important for synchronous circuits clock Timing of PL Timing of NL Positive logic Negative logic (PL) (NL) Clocking of synchronous circuits Waveform of clock with period T and its activation timing 7//2 Computer Engineering 4
Hazard: Malfunction of Asynchronous Circuit Due to Signal Racing Example What happen on a circuit of Fig.(a) when inputs (X,Y) changed from (,) to (,)? Ideal (expected) But may go into the unstable state If the change of Y is a little bit delayed compared with that of X due to some signal transmission delay from preceding circuits, and the delay of XOR is a bit larger than that of AND (S,R) temporally become (,)(See Fig. c ) Hazard 7//2 S R AND Output (,) unchanged because inputs of the latch (S,R) changed from (,) to (,) (See Fig. (b)) XOR X Y (a) X X Y Y S S R R Unstable Unstable (b)ideally Prohibited inputs provided due to signal transmission delay (c)but actually Computer Engineering 5 Flip Flop: Building Element for Synchronous Circuits Flip Flop XOR Memory element controlled at the low-high clock transition or high-low clock transition. (Clock) Synchronized circuit X Y R AND Valid Valid S R FF activated at Ti Y 7//2 CLK X Edge-triggered FF S Invalid FF activatedat Ti+ Data held CLK Computer Engineering 6 Sampling points at Ti and Ti+
Inputs, States and Outputs of SR-Flip Flop FF holds one of two states State Memorize =) State Memorize =) Inputs S,R, and (current state) " is the current state before sampling at clock edge, Output " is the next state after sampling at clock edge. (a) Block diagram # Sampling: check inputs and states to take an action Clock t Clock t+ State Transition 7//2 Computer Engineering 7 Behavior of SR-Flip Flop(SR-FF) Edge-triggered SR-FF samples the inputs on the low-to-high (or highto-low) clock transition, and when S R Output (= )becomes Set FF to. S R Output (= ) becomes Reset FF to. S R Hold the current state (memory) = S R Unstable output inhibited! Inhibited inputs (b) State transition (c ) State Transition table(truth Table) diagram 7//2 Computer Engineering 8
Behavior of SR-FF (Cont d) Characteristic Equation of SR-FF to describe the next state in terms of the inputs and current state.! SR= Prohibited inputs (not allowed)! = SR+R =(S+)R = (S+)+R Hold Reset Set Hold By using SR=! =SR+SR+R=S(R+R)+R =S+R Reset Set Karnaugh Map 7//2 Computer Engineering 9 JK-FF JK-FF is designed to avoid the prohibited inputs for SR-FF (now called J and K, instead of S and R), and add some circuit to complement the current state (negation of the current state) if two inputs are. $ Functions of JK-FF J K= = J K= = J K= = J K= = (a) Block diagram (b) State Transition Table (Truth Table) 7//2 Computer Engineering
JK-FF Cont d) Behavior of JK-FF J 0 K= J 1 K= J 0 K=1 J 1 K=1 = =1 =0 = (a) Karnaugh Diagram Characteristic Equation of JK-FF J K (b) State Transition Diagram J CK JK-FF is a popular device as memory element for sequential circuits. 7//2 K Computer Engineering Implementation of Edge-Triggered JK-FF 7//2 Computer Engineering 2
D-FF: another FF D FF(Data Flip-Flop, or Delay Flip-Flop) Store an input as the internal state. Output the input at the next clock edge Characteristic Equation D Block diagram Truth Table Karnaungh Map State Transition Diagram 7//2 Computer Engineering 3 One More: T-FF(Toggle Flip-Flop) The toggle FF has a single input that causes the stored state to be complemented when the input is asserted Input T Output Input T (asserted) Output Characteristic equation T+T Block Diagram Truth Table State Transition Diagram 7//2 Computer Engineering 4
Relationship among SR-FF, JK-FF, T-FF, and D-FF Characteristic equations of RS, JK, T and D FFs. RS-FF =S+R, SR= JK-FF =J+K T-FF =T+T D-FF =D Excitation Table to describe required inputs of RS, JK, T and D FFs to make a transition from to. RS,JK,T,D?? X means an arbitrary value 7//2 Computer Engineering 5 Conversion of One Flop-Flop Type to Another: D-FF Implementation by Using JK-FF Excitation Table Karnaugh Map of a circuit to generate J and K inputs Design a combinational circuit to generate appropriate J and K inputs by and D D-FF D FF by using JK FF 7//2 Computer Engineering 6
T-FF Implementation by Using JK-FF Exciting Table T X X T X X J=T K=T Design a combinational circuit to generate appropriate J and K inputs by and T CLK Circuit 7//2 Computer Engineering 7 JK-FF Implementation by Using D-FF Excitation Table Design a combinational circuit to generate an appropriate D input by, J and K Circuit?? 7//2 Computer Engineering 8
Procedure for Sequential Circuit Design I. Define sets of inputs, outputs, and internal states based on the specification of a desired sequential circuit to be implemented II. Allocate binary numbers to each of inputs, outputs, and states III. Design state transition diagram and/or state transition table (truth table) to clarify the behavior of the circuit based on its specification IV. Decide FF type to be used for the circuit (JK, D, or T) V. Design a combinational circuit to generate appropriate inputs of FFs by using the state transition table and the truth table VI. Implement a sequential circuit by combining the FFs and the designed combinational circuit. Combinational Logic circuit FF FF General configuration of Sequential Logic Circuit 7//2 Computer Engineering 9 Example of Sequential Circuits Counter Count the number of s provided to the input Octal counter (3-bit),,,,,,,,,... $8 internal states input Z 3-bit for 8 internal states need 3 FFs A, B, C: current states of 3 FFs A, B,C : next state of 3 FFs Z: carry signal generated when counting-up from 8 to State transition table (Truth table) State transition diagram 7//2 Computer Engineering 2
Behavior of Octal Counter Waveform (timing chart) of octal counter Describe the behavior in terms of inputs, current state and the next state (outputs) across time Input (Clock signal 7//2 Computer Engineering 2 Design a Circuit of Octal Counter Using D-FFs Use D-FFs to store internal states of the counter! Need a combinational circuit to generate an appropriate inputs for D- FFs Combinational Circuit Block Diagram of an Octal (3-bit) Counter 7//2 Computer Engineering 22
Design a Circuit of Octal Counter Using D-FFs(Cont d) Characteristic Eq. of D-FF =D $ Prepare for D inputs Current state Next state Required inputs for Inputs Outputs Karnaugh Map State Transition Table (truth table) of D-FFs of the counter 7//2 Computer Engineering 23 Design a Circuit of Octal Counter Using D-FFs Cont d) 7//2 Computer Engineering 24
Final Design of a 3-bit (Octal) Counter Combinational Logic Circuit 7//2 Computer Engineering 25 If You Want to Use JK-FFs instead of D-FFs In JK-FFs, only J(= ) decides the output when =, or only K(= ) decides the output when =, so A B C A B C J A J B J C K A K B K C * * * * * * * * * * * * * * * * * * * * * * * * :Don t care 7//2 Computer Engineering 26
If You Want to Use JK-FFs instead of D-FFs In JK-FFs, only J(= ) decides the output when =, or only K(= ) decides the output when =, so A B C A B C J A J B J C K A K B K C * * * * * * * * * * * * * * * * * * * * * * * * :Don t care 7//2 Computer Engineering 27 If You Want to Use JK-FFs instead of D-FFs Design a combinational circuit to generate the outputs for JK-inputs A B C A B C * * * * = B C = B C J A K A * * * * J A K A A A Z * * * * J B B = C = C J B K B * * * * * * * * J C = K C = * * * * CLK K B J C K C B C C 7//2 Computer Engineering 28
Pattern Detector Ex. Detect a specific bit-pattern from - sequence (given -bit by bit) $ Generate signal when pattern detected. Step : Design a state transition diagram for a -pattern detector Input X Output signal of detected or not. There are four states: *(initial): State : State : State : 2 FFs needed. 7//2 Computer Engineering 29 Design of a -pattern Detector using D-FFs Step 2: Design a state transition table (truth table) and derive a logical equation for inputs of FFs of a -pattern detector When using two D-FFs, and input X ( or ) defined, design a combination circuit. Karnaugh Map State transition table (truth table) Logical Equations for inputs of D-FFs 7//2 Computer Engineering 3
A Circuit of a Bit-Pattern- Detector 7//2 Computer Engineering 3 Exercise % uestion! To design a vending machine for a 2-yen candy, draw a state transition diagram, and then design its sequential circuit. & Accept only -yen and 5-yen coins, & and output a 2-yen candy and change ' If other coins are used,. generate an error signal 2. return the deposit at that machine has, and 3. go back to the initial condition. 7//2 Computer Engineering 32
Register: On-Chip Memory using D-FFs Register On-chip temporal storage for data processing Fast data access achieved compared to data access to/from off-chip memory! Arithmetic Units use data on Registers instead of directly using data on off-chip memory Functions of Register: Block diagram of 4-bit register 4-bit register implementation using D-FFs When LD=, data loaded into registers When LD=, hold the data When CLR=, D- 7//2 Computer Engineering FF are reset to 33 Computer System Architecture: General Model Processor Memory 7//2 Computer Engineering 34
Sift Register Register with a functionality of data shifting Block diagram Implementation using D-FFs 4-bit shift register 7//2 Computer Engineering 35