Sequential Logic Combinational logic:

Slides:



Advertisements
Similar presentations
1 Lecture 16 Timing  Terminology  Timing issues  Asynchronous inputs.
Advertisements

11/12/2004EE 42 fall 2004 lecture 311 Lecture #31 Flip-Flops, Clocks, Timing Last lecture: –Finite State Machines This lecture: –Digital circuits with.
ECE C03 Lecture 81 Lecture 8 Memory Elements and Clocking Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ELEC 256 / Saif Zahir UBC / 2000 Timing Methodology Overview Set of rules for interconnecting components and clocks When followed, guarantee proper operation.
Announcements Assignment 7 posted, due Friday 18 th All project components ordered Dates –Thursday 12/1 review lecture –Tuesday 12/6 project demonstrations.
Chapter #6: Sequential Logic Design
Page 1 Sequential Logic Basic Binary Memory Elements.
Ch 8. Sequential logic design practices 1. Documentation standards ▶ general requirements : signal name, logic symbol, schematic logic - state machine.
Sequential Logic 1 clock data in may changestable data out (Q) stable Registers  Sample data using clock  Hold data between clock cycles  Computation.
1 Digital Design: State Machines Timing Behavior Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals.
Assume array size is 256 (mult: 4ns, add: 2ns)
Sequential Logic 1  Combinational logic:  Compute a function all at one time  Fast/expensive  e.g. combinational multiplier  Sequential logic:  Compute.
Embedded Systems Hardware:
11/16/2004EE 42 fall 2004 lecture 331 Lecture #33: Some example circuits Last lecture: –Edge triggers –Registers This lecture: –Example circuits –shift.
11/15/2004EE 42 fall 2004 lecture 321 Lecture #32 Registers, counters etc. Last lecture: –Digital circuits with feedback –Clocks –Flip-Flops This Lecture:
Sequential Circuits. 2 Sequential vs. Combinational Combinational Logic:  Output depends only on current input −TV channel selector (0-9) Sequential.
Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.
Chapter #6: Sequential Logic Design 6.2 Timing Methodologies
Contemporary Logic Design Sequential Logic © R.H. Katz Transparency No Chapter #6: Sequential Logic Design Sequential Switching Networks.
ENGIN112 L26: Shift Registers November 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 26 Shift Registers.
1 Digital Design: Sequential Logic Blocks Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals.
Sequential Circuit  It is a type of logic circuit whose output depends not only on the present value of its input signals but on the past history of its.
Lecture 21 Overview Counters Sequential logic design.
Rabie A. Ramadan Lecture 3
SEQUENTIAL CIRCUITS Component Design and Use. Register with Parallel Load  Register: Group of Flip-Flops  Ex: D Flip-Flops  Holds a Word of Data 
1 CSE370, Lecture 17 Lecture 17 u Logistics n Lab 7 this week n HW6 is due Friday n Office Hours íMine: Friday 10:00-11:00 as usual íSara: Thursday 2:30-3:20.
Topic: Sequential Circuit Course: Logic Design Slide no. 1 Chapter #6: Sequential Logic Design.
Registers Page 1. Page 2 What is a Register?  A Register is a collection of flip-flops with some common function or characteristic  Control signals.
Abdullah Said Alkalbani University of Buraimi
ECE C03 Lecture 81 Lecture 8 Memory Elements and Clocking Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Computer Organization CDA 3103 Dr. Hassan Foroosh Dept. of Computer Science UCF © Copyright Hassan Foroosh 2002.
Sequential logic circuits First Class 1Dr. AMMAR ABDUL-HAMED KHADER.
Digital Design: Sequential Logic Principles
Sequential Logic Design
Lecture 10 Flip-Flops/Latches
Digital Design: Sequential Logic Blocks
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Lecture 11: Sequential Circuit Design
Lecture #16: D Latch ; Flip-Flops
LATCHED, FLIP-FLOPS,AND TIMERS
Chapter #6: Sequential Logic Design
Registers and Counters
Clocks A clock is a free-running signal with a cycle time.
Computer Organization
Sequential circuit design with metastability
Digital Fundamentals Floyd Chapter 7 Tenth Edition
Sequential Logic.
Prof. Hsien-Hsin Sean Lee
Digital Fundamentals Floyd Chapter 7 Tenth Edition
Typical Timing Specifications
ECE Digital logic Lecture 16: Synchronous Sequential Logic
Instructor: Alexander Stoytchev
CPE/EE 422/522 Advanced Logic Design L03
Registers and Counters Register : A Group of Flip-Flops. N-Bit Register has N flip-flops. Each flip-flop stores 1-Bit Information. So N-Bit Register Stores.
LECTURE 15 – DIGITAL ELECTRONICS
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
CSE 370 – Winter Sequential Logic-2 - 1
COMP541 Sequential Circuits
触发器 Flip-Flops 刘鹏 浙江大学信息与电子工程学院 March 27, 2018
ECE 434 Advanced Digital System L05
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
CSE 370 – Winter Sequential Logic - 1
Lecture 15 Logistics Last lecture Today HW4 is due today
Registers and Counters
CSE 370 – Winter Sequential Logic-2 - 1
ECE 352 Digital System Fundamentals
Lecture 19 Logistics Last lecture Today
Registers and Counters
Week 11 Flip flop & Latches.
Lecture 3: Timing & Sequential Circuits
Presentation transcript:

Sequential Logic Combinational logic: Compute a function all at one time Fast/expensive e.g. combinational multiplier Sequential logic: Compute a function in a series of steps Slower/more efficient e.g. shift/add multiplier Key to sequential logic: circuit has feedback Use the result of one step as an input to the next Sequential Logic

What We Need: When inputs change... Wait until combinational logic has finished and result it stable... Then sample the output value and save... Feed the saved output back to the input of the combinational logic Make sure the saved output can’t change Key idea: we sample the result at the right time, i.e. when it is ready Only then do we update the stored value How do we know when to sample? How do we know when the inputs changed? How do we know how long to wait? Sequential Logic

What We Need: A circuit that can sample a value A signal that says when to sample Edge-triggered D flip-flop (register) Samples on positive edge of clock Holds value until next positive edge Most common storage element Clock Periodic signal, each rising edge signals D flip-flops to sample All registers sample at the same time D Q Sequential Logic

Let’s Use This D flip-flop Does this work? What do we need to say about the inputs X1, X2, ...? This is a synchronous sequential circuit X1 X2 • • • Xn Z1 Z2 • • • Combinational circuit D Q Sequential Logic

Registers Sample data using clock Hold data between clock cycles Computation (and delay) occurs between registers data in D Q D Q data out clock stable may change data in clock data out (Q) stable stable stable Sequential Logic

Example - Circuit with Feedback Output is a function of arbitrarily many past inputs Sequential Logic

Examples (cont’d) Output is a function of inputs and the previous state of the circuit B A outt outt+1 – 0 0 0 – 0 1 1 0 1 – 0 1 1 – 1 Sequential Logic

Example - Circuit without Feedback Output is a function of the input sampled at three different points in time Sequential Logic

Timing Methodologies (cont’d) Definition of terms setup time: minimum time before the clocking event by which the input must be stable (Tsu) hold time: minimum time after the clocking event until which the input must remain stable (Th) input clock Tsu Th data D Q D Q clock there is a timing "window" around the clocking event during which the input must remain stable and unchanged in order to be recognized stable changing data clock Sequential Logic

Typical timing specifications Positive edge-triggered D flip-flop setup and hold times minimum clock width propagation delays (low to high, high to low, max and typical) Th 2ns Tw 7ns Tplh 5ns 3ns Tphl 7ns 5ns Tsu 5ns D CLK Q all measurements are made from the clocking event that is, the rising edge of the clock Sequential Logic

Cascaded Flip-Flops Shift register: new value to first stage while second state obtains current value of first stage Outputs change only on clock tick Q0 Q1 D Q D Q IN OUT CLK Sequential Logic

Flip-flop Extras Reset (set state to 0) – R synchronous: Dnew = R' • Dold (when next clock edge arrives) asynchronous: doesn't wait for clock, quick but dangerous Preset or set (set state to 1) – S (or sometimes P) synchronous: Dnew = Dold + S (when next clock edge arrives) Both reset and preset Dnew = R' • Dold + S (set-dominant) Dnew = R' • Dold + R'S (reset-dominant) Selective input capability (input enable or load) – LD or EN multiplexor at input: Dnew = LD' • Q + LD • Dold load may or may not override reset/set Complementary outputs – Q and Q’ Output enable - tristate output Sequential Logic

Registers Collection of flip-flops with same control stored values somehow related (for example, form binary value) Examples shift registers counters R S D Q OUT1 OUT2 OUT3 OUT4 CLK IN1 IN2 IN3 IN4 Reset Sequential Logic

Shift register Holds samples of input store last 4 input values in sequence 4-bit shift register: D Q IN OUT1 OUT2 OUT3 OUT4 CLK Sequential Logic

4-bit Universal shift register Holds 4 values serial or parallel inputs serial or parallel outputs permits shift left or right shift in new values from left or right left_in left_out right_out clear right_in output input s0 s1 clock clear sets the register contents and output to 0 s1 and s0 determine the shift function s0 s1 function 0 0 hold state 0 1 shift right 1 0 shift left 1 1 load new input Sequential Logic

Design of Universal Shift Register Consider one of the four flip-flops new value at next clock cycle: clear s0 s1 new value 1 – – 0 0 0 0 output 0 0 1 output value of FF to left (shift right) 0 1 0 output value of FF to right (shift left) 0 1 1 input Nth cell to N-1th cell to N+1th cell Q D CLK CLEAR s0 and s1 control mux 1 2 3 Q[N-1] (left) Q[N+1] (right) Input[N] Sequential Logic

Binary counter Next state function for bit i XOR acts like a “programmable” inverter if bits 0:i-1 are 1, then toggle bit i requires an i-input AND for bit i Synchronous: outputs all change when clock ticks D Q OUT0 OUT1 OUT2 OUT3 CLK "1" Sequential Logic

Example: 4-bit binary synchronous counter Typical library component positive edge-triggered FFs w/ synchronous load and clear inputs parallel load data from D, C, B, A enable input: assert to enable counting RCO: “ripple-carry out” used for cascading counters high when counter is in its highest state 1111 implemented using an AND gate EN D C B A LOAD CLK CLR RCO QD QC QB QA (2) RCO goes high CLK (1) Low order 4-bits = 1111 Sequential Logic

Other Counters: cheaper/faster Sequences through a fixed set of patterns in this case, 1000, 0100, 0010, 0001 if one of the patterns is its initial state (by loading or set/reset) Mobius (or Johnson) counter in this case, 1000, 1100, 1110, 1111, 0111, 0011, 0001, 0000 D Q IN OUT1 OUT2 OUT3 OUT4 CLK D Q IN OUT1 OUT2 OUT3 OUT4 CLK Sequential Logic

Cascaded Flip-Flops (cont’d) Contamination delay > hold time next stage latches current value before it is replaced by new value Clock period > propagation delays + setup time new value must arrive early enough to be seen at next clock event Timing constraints guarantee proper operation of cascaded components Assumes infinitely fast distribution of clock signal In Q0 Q1 CLK Tsu 5ns Tsu 5ns Tcd 3ns Tcd 3ns Th 2ns Th 2ns Sequential Logic

Effect of Clock Skew IN CLK0 Q0 Q1 D Q OUT CLK1 delay IN Q0 Q1 CLK0 Sequential Logic

Clock Skew Correct behavior assumes that all storage elements sample at exactly the same time Not possible in real systems: clock driven from some central location different wire delay to different points in the circuit Problems arise if skew is of the same order as FF contamination delay Gets worse as systems get faster (wires don't improve as fast) 1) distribute clock signals in general direction of data flow 2) wire carrying the clock between two communicating components should be as short as possible 3) try to make all wires from the clock generator be the same length – clock tree Sequential Logic

Other Types of Latches and Flip-Flops Best choice is D-FF simplest design technique, minimizes number of wires preferred in PLDs and FPGAs good choice for data storage register edge-triggered has most straightforward timing constraints Historically J-K FF was popular versatile building block, usually requires least amount of logic to implement function two inputs require more wiring and logic (e.g., two two-level logic blocks in PLDs) good in days of TTL/SSI, not a good choice for PLDs and FPGAs can always be implemented using D-FF Level-sensitive latches in special circumstances popular in VLSI because they can be made very small (4 transistors) fundamental building block of all other flip-flop types two latches make a D-FF Preset and clear inputs are highly desirable Sequential Logic

Comparison of latches and flip-flops D Q D CLK Qedge Qlatch CLK positive edge-triggered flip-flop D Q CLK transparent, flow-through (level-sensitive) latch behavior is the same unless input changes while the clock is high Sequential Logic

What About External Inputs? Internal signals are OK Can only change when clock changes External signals can change at any time Asynchronous inputs Truly asynchronous Produced by a different clock This means register may sample a signal that is changing Violates setup/hold time What happens? Sequential Logic

Synchronization failure Occurs when FF input changes close to clock edge the FF may enter a metastable state – neither a logic 0 nor 1 – it may stay in this state an indefinite amount of time this is not likely in practice but has some probability logic 1 logic 0 logic 0 logic 1 small, but non-zero probability that the FF output will get stuck in an in-between state oscilloscope traces demonstrating synchronizer failure and eventual decay to steady state Sequential Logic

Calculating probability of failure For a single synchronizer Mean-Time Between Failure (MTBF) = exp ( tr /  ) / ( T0 f a ) where a failure occurs if metastability persists beyond time tr after a clock edge tr is the resolution time - extra time in clock period for settling Tclk - (tpd + TCL + tsetup) f is the frequency of the FF clock a is the number of asynchronous input changes per second applied to the FF T0 and  are constaints that depend on the FF's electrical characteristics (e.g., gain or steepness of curve) typical values are T0 = .4s and  = 1.5ns (sensitive to temperature, voltage, cosmic rays, etc.). Must add probabilities from all synchronizers in system 1/MTBFsystem =  1/MTBFsynch these are just averages Sequential Logic

Metastability Example input changes at 1 MHz system clock of 10MHz, flipflop (tpd + tsetup) = 5ns MTBF = exp( 95ns / 1.5ns ) / ( .4s 107 106 ) = 25 million years if we go to 20MHz then: MTBF = exp( 45ns / 1.5ns ) / ( .4s 2107 106 ) = 1.33 seconds! Must do the calculations and allow enough time for synchronization Sequential Logic

Guarding against synchronization failure Give the register time to decide Probability of failure cannot be reduced to 0, but it can be reduced Slow down the system clock? Use very fast technology for synchronizer -> quicker decision? Cascade two synchronizers? asynchronous input Q synchronized input D Q D Clk Sequential Logic

Another Problem with Asynchronous inputs What goes wrong here? (Hint: it’s not a metastability thing) What is the fix? Async Q0 D Q Input Clock D Q Q1 Clock Sequential Logic