# COE 202: Digital Logic Design Sequential Circuits Part 1 Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: 22-324 Ahmad Almulhem, KFUPM.

## Presentation on theme: "COE 202: Digital Logic Design Sequential Circuits Part 1 Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: 22-324 Ahmad Almulhem, KFUPM."— Presentation transcript:

COE 202: Digital Logic Design Sequential Circuits Part 1 Dr. Ahmad Almulhem Email: ahmadsm AT kfupm Phone: 860-7554 Office: 22-324 Ahmad Almulhem, KFUPM 2009

Objectives Sequential Circuits Memory Elements Latches Flip-Flops Ahmad Almulhem, KFUPM 2009

Combinational vs Sequential A combinational circuit: At any time, outputs depends only on inputs Changing inputs changes outputs No regard for previous inputs No memory (history) Time is ignored ! Ahmad Almulhem, KFUPM 2009 Combinational Circuits inputs X outputs Z

Combinational vs Sequential A sequential circuit: outputs depends on inputs and previous inputs Previous inputs are stored as binary information into memory The stored information at any time defines a state next state depends on inputs and present state Ahmad Almulhem, KFUPM 2009 Combinational Circuits inputs X outputs Z Memory next state present state

Examples of sequential systems Ahmad Almulhem, KFUPM 2009 Traffic lightVending machine ATM What is common between these systems?

1-bit memory and 2 4-bit memory Only one full-adder! 4 clocks to get the output The 1-bit memory defines the circuit state (0 or 1) Sequential Adder Ahmad Almulhem, KFUPM 2009

Types of Sequential Circuits Two types of sequential circuits: Synchronous: The behavior of the circuit depends on the input signal values at discrete intervals of time (also called clocked) Asynchronous: The behavior of the circuit depends on the order of change of the input signals at any instance of time (continuous) Ahmad Almulhem, KFUPM 2009

Clock A clock generator produces a periodic train of pulses (alternating 0s and 1s) A clock signal is required for generating discrete time intervals in synchronous circuits The memory/state changes with the clock Combinational Circuits inputs X outputs Z Memory next state present state clock Ahmad Almulhem, KFUPM 2009

Memory - Latches A latch is binary storage component Can store a 0 or 1 The most basic memory element Built with gates (NORs, NANDs) Can be used to build flip-flops Ahmad Almulhem, KFUPM 2009

SR Latch What does this circuit do? Ahmad Almulhem, KFUPM 2009

SR Latch Two states: Set (Q = 1) and Reset (Q = 0) When S=R=0, Q remains the same, S=R=1 is not allowed! Provide a simple form of memory State of the circuit depends not only on the current inputs, but also on the recent history of the inputs Ahmad Almulhem, KFUPM 2009

S’ R’ Latch Ahmad Almulhem, KFUPM 2009 Similar to SR latch (complemented) Two states: Set (Q = 0) and Reset (Q = 1) When S=R=1, Q remains the same S=R=0 is not allowed!

SR Latch with Clock An additional input signal (Clock) can be introduced to make sure that the operation of the latch is modified depending on the value of the Clock (C) signal When C=0, the S and R inputs have no effect on the latch When C=1, the inputs affect the state of the latch and possibly the output Ahmad Almulhem, KFUPM 2009

D Latch How can we eliminate the undefined state? Ahmad Almulhem, KFUPM 2009

D Latch Ensure S and R are never equal to 1 at the same time Add inverter D stands for data Output follows the input when C = 1 When C = 0, Q remains the same Ahmad Almulhem, KFUPM 2009

Characteristic Table Similar to the truth table in combinational circuits Next state is defined in terms of the current state and the inputs K-Map can be used to obtain the characteristic equation The indeterminate states can be expressed as don’t cares Ahmad Almulhem, KFUPM 2009

Characteristic Table – SR Latch Ahmad Almulhem, KFUPM 2009 Q(t)SRQ(t+1) 0000 0010 0101 011undefined 1001 1010 1101 111

Characteristic Table – SR Latch Characteristic Equation S=R=1 is not permitted, therefore this condition is all included here Q(t)SRQ(t+1) 0000 0010 0101 011undefined 1001 1010 1101 111 Ahmad Almulhem, KFUPM 2009

Characteristic Table – D Latch Q(t)DQ(t+1) 000 011 100 111 Ahmad Almulhem, KFUPM 2009

Characteristic Table – D Latch Characteristic Equation for the D Latch Q(t)DQ(t+1) 000 011 100 111 Ahmad Almulhem, KFUPM 2009

Excitation Table Defines the input conditions for which a certain next state is reached from a certain current state for a circuit Lists the inputs for moving from one state to another Ahmad Almulhem, KFUPM 2009

Excitation Table Defines the input conditions for which a certain next state is reached from a certain current state for a circuit Lists the inputs for moving from one state to another Ahmad Almulhem, KFUPM 2009 Q(t)Q(t+1)SR 000X 0110 1001 11X0 Example: SR Latch

Clocked JK Latch How does it work? Function table? Characteristic Table/Equations? Excitation Table? extra feedbacks Ahmad Almulhem, KFUPM 2009

Clocked JK Latch The JK latch improves on the SR latch by ensuring that the no input combination will lead to an indeterminate state The outputs of this latch (Q, Q’) are coupled back to the latch input J and K behave like S and R. J implies the Set K implies the Reset For J=K=1, the latch switches to its complement state, i.e. Q becomes 0 if it was already 1 and vice versa Ahmad Almulhem, KFUPM 2009

JK Latch – Characteristic Table Ahmad Almulhem, KFUPM 2009

JK Latch – Excitation Table For the next state and present state to be equal to 0, J must be equal to 0 For both next and current states to be equal to 1, K must be equal to 0 To change state from 0 to 1, J must be 1 To change state from 1 to 1, K must be 1 Ahmad Almulhem, KFUPM 2009

Clocked T Latch The clocked T latch is a single input version of the JK latch The letter ‘T’ stands for Toggle, as it toggles the current state when equal to 1 When T=1, the next state is the complement of the current state Ahmad Almulhem, KFUPM 2009

T Latch (Tables) Characteristic table/equation Excitation table Functional table Ahmad Almulhem, KFUPM 2009

Problem with Latches What happens Clock=1? What will be the value of Q when Clock goes to 0? Problem: A latch is transparent; state keep changing as long as the clock remains active Due to this uncertainty, latches can not be reliably used as storage elements. Ahmad Almulhem, KFUPM 2009 C D Q Q Q Clock

Flip Flops A flip-flop is a one bit memory similar to latches Solves the issue of latch transparency Latches are level sensitive Flip-Flops are edge-triggered or edge-sensitive positive (rising) edge negative (falling) edge level Ahmad Almulhem, KFUPM 2009

Flip Flops Implementation Two methods: Master-Slave Two latches (master and slave) and additional logic Edge-Triggered Usually implemented differently at the transistor level Can also be built with latches similar to master-slave implementation Ahmad Almulhem, KFUPM 2009

Master-Slave SR Flip Flop Built using two latches (Master and Slave) C = 1, master is active C = 0, slave is active Q is sampled at the falling edge Also called pulse- triggered: data is entered on the rising edge of the clock pulse, but the output does not reflect the change until the falling edge of the clock pulse. Ahmad Almulhem, KFUPM 2009

Master-Slave JK Flip Flop Two SR Latches (master and slave) Function is similar to JK Latch but transparency issue is solved Ahmad Almulhem, KFUPM 2009

Edge-Triggered D Flip Flop This flip-flop takes exactly the form of a master-slave flip- flop, with the master a D latch and the slave an SR latch. Also, an inverter is added to the clock input of the master latch. Because the master latch is a D latch, the flip-flop exhibits edge-triggered rather than master-slave (pulse-triggered) behavior. Ahmad Almulhem, KFUPM 2009 -ve (falling) edge+ve (rising) edge

Standard Symbols Ahmad Almulhem, KFUPM 2009

Direct Inputs Ahmad Almulhem, KFUPM 2009 At power up or at reset, all or part of a sequential circuit usually is initialized to a known state before it begins operation This initialization is often done outside of the clocked behavior of the circuit, i.e., asynchronously. Direct R and/or S inputs that control the state of the latches within the flip-flops are used for this initialization. For the example flip-flop shown 0 applied to R resets the flip-flop to the 0 state 0 applied to S sets the flip-flop to the 1 state D C S R Q Q

D Flip Flop with Direct Inputs Ahmad Almulhem, KFUPM 2009 Question: What type of D-FF? Why?

Flip Flops Sheet (Mano’s Textbook) Ahmad Almulhem, KFUPM 2009

Summary In a sequential circuit, outputs depends on inputs and previous inputs Previous inputs are stored as binary information into memory The stored information at any time defines a state Similarly, next state depends on inputs and present state Two types of sequential circuits: Synchronous and Asynchronous Two types of Memory elements: Latches and Flip- Flops. A flip-flop is described using functional, characteristic table/equation and excitation tables Ahmad Almulhem, KFUPM 2009