David Culler Electrical Engineering and Computer Sciences

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.
1 Lecture 14 Memory storage elements  Latches  Flip-flops State Diagrams.
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.
Computer Architecture CS 215
Flip-Flops, Registers, Counters, and a Simple Processor
Announcements Assignment 7 posted, due Friday 18 th All project components ordered Dates –Thursday 12/1 review lecture –Tuesday 12/6 project demonstrations.
Fall 2004EE 3563 Digital Systems Design EE 3563 Sequential Logic Design Principles  A sequential logic circuit is one whose outputs depend not only on.
Chapter #6: Sequential Logic Design
1 Sequential Systems A combinational system is a system whose outputs depend only upon its current inputs. A sequential system is a system whose outputs.
1 Lecture 20 Sequential Circuits: Latches. 2 Overview °Circuits require memory to store intermediate data °Sequential circuits use a periodic signal to.
Page 1 Sequential Logic Basic Binary Memory Elements.
INTRODUCTION TO SEQUENCIAL CIRCUIT
Sequential Logic 1 clock data in may changestable data out (Q) stable Registers  Sample data using clock  Hold data between clock cycles  Computation.
Lecture 9 Memory Elements and Clocking
ENGIN112 L20: Sequential Circuits: Flip flops October 20, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 20 Sequential Circuits: Flip.
Sequential Logic 1  Combinational logic:  Compute a function all at one time  Fast/expensive  e.g. combinational multiplier  Sequential logic:  Compute.
11/10/2004EE 42 fall 2004 lecture 301 Lecture #30 Finite State Machines Last lecture: –CMOS fabrication –Clocked and latched circuits This lecture: –Finite.
CS 151 Digital Systems Design Lecture 20 Sequential Circuits: Flip flops.
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.
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.
ELEC 256 / Saif Zahir UBC / 2000 Sequential Logic Design Sequential Networks Simple Circuits with Feedback R-S Latch J-K Flipflop Edge -Triggered Flip-Flops.
1 CSE370, Lecture 14 Lecture 14 u Logistics n Midterm 1: Average 90/100. Well done! n Midterm solutions online n HW5 due date delayed until this Friday.
1 CSE370, Lecture 16 Lecture 19 u Logistics n HW5 is due today (full credit today, 20% off Monday 10:29am, Solutions up Monday 10:30am) n HW6 is due Wednesday.
COE 202: Digital Logic Design Sequential Circuits Part 1
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 9 Sequential.
ENGR-43_Lec-05c_Thevenin_AC_Power.pptx 1 Bruce Mayer, PE Engineering-43: Engineering Circuit Analysis Bruce Mayer, PE Licensed.
Chap 4. Sequential Circuits
VI - Sequential Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Sequential logic Sequential circuits  simple circuits with feedback  latches.
D Latch Delay (D) latch:a) logic symbolb) NAND implementationc) NOR implementation.
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.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
How Computers Work Lecture 8 Page 1 How Computers Work Lecture 8 Asynchronous State Machines and Metastability.
ECE C03 Lecture 81 Lecture 8 Memory Elements and Clocking Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
6-1 Programmable and Steering Logic Chapter #6: Sequential Logic Design.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
Sequential logic circuits
Chapter5: Synchronous Sequential Logic – Part 1
CSE 140: Components and Design Techniques for Digital Systems Lecture 7: Sequential Networks CK Cheng Dept. of Computer Science and Engineering University.
Synchronous Sequential Circuits by Dr. Amin Danial Asham.
CS151 Introduction to Digital Design Chapter 5: Sequential Circuits 5-1 : Sequential Circuit Definition 5-2: Latches 1Created by: Ms.Amany AlSaleh.
Synchronous Sequential Circuits by Dr. Amin Danial Asham.
Computer Organization CDA 3103 Dr. Hassan Foroosh Dept. of Computer Science UCF © Copyright Hassan Foroosh 2002.
ENGR-43_Lec-05c_Thevenin_AC_Power.pptx 1 Bruce Mayer, PE Engineering-43: Engineering Circuit Analysis Bruce Mayer, PE Licensed.
Sequential logic circuits First Class 1Dr. AMMAR ABDUL-HAMED KHADER.
Digital Design: Sequential Logic Principles
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Lecture #16: D Latch ; Flip-Flops
David Culler Electrical Engineering and Computer Sciences
Chapter #6: Sequential Logic Design
Sequential Logic Combinational logic:
ECE Digital logic Lecture 16: Synchronous Sequential Logic
LECTURE 15 – DIGITAL ELECTRONICS
CS Fall 2005 – Lec. #5 – Sequential Logic - 1
CSE 370 – Winter Sequential Logic-2 - 1
触发器 Flip-Flops 刘鹏 浙江大学信息与电子工程学院 March 27, 2018
Instructor: Alexander Stoytchev
CSE 370 – Winter Sequential Logic - 1
Lecture 16 Logistics Last lecture Today HW5 out, due next wednesday
Instructor: Alexander Stoytchev
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 16 Logistics Last lecture Today HW5 out, due next wednesday
CSE 370 – Winter Sequential Logic-2 - 1
Synchronous sequential
Synchronous Sequential
Lecture 19 Logistics Last lecture Today
Presentation transcript:

EECS 150 - Components and Design Techniques for Digital Systems Lec 22 – Sequential Logic - Advanced David Culler Electrical Engineering and Computer Sciences University of California, Berkeley http://www.eecs.berkeley.edu/~culler http://inst.eecs.berkeley.edu/~cs150

Traversing Digital Design EECS150 wks 6 - 15 Sequential Circuit Design and Timing EECS150 wks 1-6 CS61C EE 40

RTL & ISA

Types of Latches We have focused on D-flips D latch => D FlipFlop => Registers (ld, clr) Most commonly used today (CMOS, FPGA) Many other types of latches RS, JK, T Should be familiar with these too Opportunity to look much more closely at timing behavior Latch vs Flip Flops Timing Methodology

Recall: Forms of Sequential Logic Asynchronous sequential logic – “state” changes occur whenever state inputs change (elements may be simple wires or delay elements) Synchronous sequential logic – state changes occur in lock step across all storage elements (using a periodic waveform - the clock) Clock

Example – ring oscillator B C D E X (b) Timing waveform

Recall: General Model of Synchronous Circuit input clock Tsu Th Our methodology so far: registers as D flipflops with common control Single-phase clock, edge triggered design Assumptions underlying the clean abstraction Input to FF valid a setup time before clock edge Outputs don’t change too quickly after clock edge (hold time) Clk-to-Q => hold time

Circuits with Feedback How to control feedback? What stops values from cycling around endlessly X1 X2 • • • Xn Z1 Z2 • • • Zn switching network

Simplest Circuits with Feedback Two inverters form a static memory cell Will hold value as long as it has power applied How to get a new value into the memory cell? Selectively break feedback path Load new value into cell "0" "1" "stored value" "remember" "load" "data" "stored value"

Latches Level-sensitive latch D Q Level-sensitive latch holds value when clock is low Transparent when clock is high What does it take to build a consistent timing methodology with only latches? Very hard! All stages transparent at same time. Require that minimum propagation delay is greater than high phase of the clock (duty period) a b D Q D Q in clk a b

Clocks Used to keep time Clocks are regular periodic signals Wait long enough for inputs (R' and S') to settle Then allow to have effect on value stored Clocks are regular periodic signals Period (time between ticks) Duty-cycle (time clock is high between ticks - expressed as % of period) duty cycle (in this case, 50%) period

Two-phase non-overlapping clocks Sequential elements partition into two classes phase0 ele’ts feed phase1 phase1 ele’ts feed phase0 Approximate single phase: each register replaced by a pair of latches on two phases Can push logic across (retiming) Can always slow down the clocks to meet all timing constraints a b D Q D Q c/l clk-0 clk1 in clk0 clk1 a b

Master-Slave Structure Construct D flipflop from two D latches clk’ clk clk clk’ clk’ clk clk’ clk

Latches vs FlipFlips Level sensitive vs edge triggered Very different design methodologies for correct use Both are clocked, but latch is asynchronous Output can change while clock is high D Clk Q FF Latch

Asynchronous R-S Latch Cross-coupled NOR gates Similar to inverter pair, with capability to force output to 0 (reset=1) or 1 (set=1) Cross-coupled NAND gates Similar to inverter pair, with capability to force output to 0 (reset=0) or 1 (set=0) R S Q Q' 1 R S Q 1 Q Q' S' R' R' S' Q

State Behavior of R-S latch Transition Table Sequential (output depends on history when inputs R=0, S=0) but asynchronous characteristic equation Q(t+) = S + R’ Q(t) S(t) R(t) Q(t) Q(t+) 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 X 1 1 1 X hold reset set not allowed R S Q Q' 0 0 1 0 X 1 Q(t) R S

Theoretical R-S Latch Behavior Q Q' SR=10 SR=00 SR=01 SR=00 SR=10 Q Q' 0 1 Q Q' 1 0 Q Q' 0 0 Q Q' 1 1 SR=01 SR=10 SR=01 SR=01 SR=10 SR=11 SR=11 SR=11 State Diagram States: possible values Transitions: changes based on inputs possible oscillation between states 00 and 11 SR=00 SR=00 SR=11

Timing Behavior R S Q Q' Reset Hold Set Reset Set Race 100 R S Q \Q

Observed R-S Latch Behavior Very difficult to observe R-S latch in the 1-1 state One of R or S usually changes first Ambiguously returns to state 0-1 or 1-0 A so-called "race condition" Or non-deterministic transition Q Q' 0 1 Q Q' 1 0 Q Q' 0 0 SR=10 SR=01 SR=00 SR=11 SR=00

characteristic equation R-S Latch Analysis Break feedback path R S Q Q' Q(t) Q(t+) S R S R Q(t) Q(t+) 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 X 1 1 1 X hold reset set not allowed 0 0 1 0 X 1 Q(t) R S characteristic equation Q(t+) = S + R’ Q(t)

Gated R-S Latch Control when R and S inputs matter Otherwise, the slightest glitch on R or S while enable is low could cause change in value stored Ensure R & S stable before utilized (to avoid transient R=1, S=1) enable' S' Q' Q R' R S Set Reset S' R' enable' Q Q' 100

Towards a Synchronous Design Controlling an R-S latch with a clock Can't let R and S change while clock is active (allowing R and S to pass) Only have half of clock period for signal changes to propagate Signals must be stable for the other half of clock period clock' S' Q' Q R' R S clock R' and S' changing stable

Cascading Latches Connect output of one latch to input of another How to stop changes from racing through chain? Need to control flow of data from one latch to the next Advance from one latch per clock period Worry about logic between latches (arrows) that is too fast Shortest paths, not critical paths clock R S Q Q'

Announcements Guest Lecture, Nov 29, Dr. Robert Iannucci, CTO Nokia Sarah Lecture on Testing Methodology Thurs. HW out tonight, due before Break Lab lecture covers “final point” Wireless CP this week Next week TAs will do extended office hours M-W rather than formal lab. Final Check off week 14 No Class Dec 6. Final report Friday Dec. 7. Sign up for 10 min slots 5 min presentation, 5 min Q&A Arrive 20 mins before scheduled slot to set up

Master-Slave Structure Break flow by alternating clocks (like an air-lock) Use positive clock to latch inputs into one R-S latch Use negative clock to change outputs with another R-S latch View pair as one basic unit master-slave flip-flop twice as much logic output changes a few gate delays after the falling edge of clock but does not affect any cascaded flip-flops master stage slave stage P P' CLK R S Q Q' CLK CLK’

The 1s Catching Problem In first R-S stage of master-slave FF 0-1-0 glitch on R or S while clock is high "caught" by master stage Leads to constraints on logic (feeding the latch) to be hazard-free master stage slave stage P P' CLK R S Q Q' Set 1s catch S R CLK P P' Q Q' Reset Master Outputs Slave Outputs

D Flip-Flop Make S and R complements of each other in Master stage Eliminates 1s catching problem Input only needs to settle by clock edge Can't just hold previous value (must have new value ready every clock period) Value of D just before clock goes low is what is stored in flip-flop Can make R-S flip-flop by adding logic to make D = S + R' Q D Q Q' master stage slave stage P P' CLK R S 10 gates

JK Flip Flops J(t) K(t) Q(t) Q(t+) 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 hold reset set toggle R Q’ Q’ K R-S master/slave J S Q Q

(neg) Edge-Triggered Flip-Flops More efficient solution: only 6 gates sensitive to inputs only near edge of clock signal (not while high) Q D Clk=1 R S D’ Q’ holds D' when clock goes low negative edge-triggered D flip-flop (D-FF) 4-5 gate delays must respect setup and hold time constraints to successfully capture input holds D when clock goes low characteristic equation Q(t+1) = D

Edge-Triggered Flip-Flops (cont’d) D = 0, Clk High 1 Act as inverters D’ D D’ Hold state R Q Clk=1 1 S D D’ D

Edge-Triggered Flip-Flops (cont’d) D = 1, Clk High 1 1 ® 0 0 ® 1 D’ D D’ R Q Clk=1 1 S D 0 ® 1 D’ D 1

D-FF Behavior when CLK=1 Q D Clk=1 R S Dl D’ Du’ Du clk 0->1 1->0 0->1 D 1->0 D’ Q’ Du R=Du’ S=Dl Q Q’ Change in D propagate through lower and upper latch, but R=S=0, isolating slave

Behavior when CLK 1->0 Q D Clk=1 R S Dl D’ Du’ Du clk 1 D D’ Q->1 Q’ 1->0 Du Q’->0 0->1 R=Du’ S=Dl 1 Q Q’ Falling edge allows latched D to propagate to output latch

D-FF; behavior when CLK==0 Q new D Clk=0 R S D D’ D->~D’=D Lower output 0 Upper latch retains old D RS unchanged Q’ R’=Q=old D D’->0 new D  old D when clock is low data is held

Edge-Triggered Flip-Flops (cont’d) Positive edge-triggered Inputs sampled on rising edge; outputs change after rising edge Negative edge-triggered flip-flops Inputs sampled on falling edge; outputs change after falling edge 100 D CLK Qpos Qpos' Qneg Qneg' positive edge-triggered FF negative edge-triggered FF

Timing Methodologies Rules for interconnecting components and clocks Guarantee proper operation of system when strictly followed Approach depends on building blocks used for memory elements Focus on systems with edge-triggered flip-flops Found in programmable logic devices Many custom integrated circuits focus on level-sensitive latches Basic rules for correct timing: (1) Correct inputs, with respect to time, are provided to the flip-flops (2) No flip-flop changes state more than once per clocking event

Timing Methodologies (cont’d) Definition of terms clock: periodic event, causes state of memory element to change; can be rising or falling edge, or high or low level 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

Comparison of Latches and Flip-Flops (cont’d) Type When inputs are sampled When output is valid unclocked always propagation delay from input change latch level-sensitive clock high propagation delay from input change latch (Tsu/Th around falling or clock edge (whichever is later) edge of clock) master-slave clock high propagation delay from falling edge flip-flop (Tsu/Th around falling of clock edge of clock) negative clock hi-to-lo transition propagation delay from falling edge edge-triggered (Tsu/Th around falling of clock flip-flop edge of clock)

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 5ns Tw 25ns Tplh 25ns 13ns Tphl 40ns 25ns Tsu 20ns D CLK Q all measurements are made from the clocking event that is, the rising edge of the clock

Cascading Edge-triggered Flip-Flops Shift register New value goes into first stage While previous value of first stage goes into second stage Consider setup/hold/propagation delays (prop must be > hold) CLK IN Q0 Q1 D Q OUT 100 IN Q0 Q1 CLK

Cascading Edge-triggered Flip-Flops (cont’d) Why this works Propagation delays exceed hold times Clock width constraint exceeds setup time This guarantees following stage will latch current value before it changes to new value In Q0 Q1 CLK Tsu 4ns Tsu 4ns timing constraints guarantee proper operation of cascaded components Tp 3ns Tp 3ns assumes infinitely fast distribution of the clock Th 2ns Th 2ns

Clock Skew The problem Correct behavior assumes next state of all storage elements determined by all storage elements at the same time This is difficult in high-performance systems because time for clock to arrive at flip-flop is comparable to delays through logic Effect of skew on cascaded flip-flops: 100 In Q0 Q1 CLK0 CLK1 CLK1 is a delayed version of CLK0 original state: IN = 0, Q0 = 1, Q1 = 1 due to skew, next state becomes: Q0 = 0, Q1 = 0, and not Q0 = 0, Q1 = 1 Need Propagation – Skew > Hold Time

Summary of Latches and Flip-Flops Development of D-FF Level-sensitive used in custom integrated circuits can be made with 4 pairs of gates Usually follows multiphase non-overlapping clock discipline Edge-triggered used in programmable logic devices Good choice for data storage register Historically J-K FF was popular but now never used Similar to R-S but with 1-1 being used to toggle output (complement state) Good in days of TTL/SSI (more complex input function: D = JQ' + K'Q Not a good choice for PALs/PLAs as it requires 2 inputs Can always be implemented using D-FF Preset and clear inputs are highly desirable on flip-flops Used at start-up or to reset system to a known state

Flip-Flop Features 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/load) – LD or EN Multiplexer at input: Dnew = LD' • Q + LD • Dold Load may/may not override reset/set (usually R/S have priority) Complementary outputs – Q and Q'

Maintaining the Digital Abstraction (in an analog world) Vout Vdd Vin Circuit design with very sharp transitions Noise margin for logical values Carefully Design Storage Elements (SE) Internal feedback Structured System Design SE + CL, cycles must cross SE Timing Methodology All SE advance state together All inputs stable across state change D Q

Where does this breakdown? Interfacing to the physical world Can’t tell it “not to change near the clock edge” Digital Abstraction

inconsistent state may be reached! Example Problems D Q Q0 Clock Q1 Async Input Clocked Synchronous System D Q Q0 Clock Q1 Async Input Synchronizer In Q0 Q1 CLK In is asynchronous and fans out to D0 and D1 one FF catches the signal, one does not inconsistent state may be reached!

Metastability horrible example In worst cast, cannot bound time for FF to decide if inputs can change right on the edge Circuit has a metastable balance point logic 0 logic 1

Practical Solution Series of synchronizers Async Q0 Q1 D Q D Q D Q Input Clock Clock Series of synchronizers each reduces the chance of getting stuck (exponentially) Make P(metastability) < P(device failure) Oversample and then low pass

Metastability throughout the ages Didn’t take EECS 150 Buridan, Jean (1300-58), French Scholastic philosopher, who held a theory of determinism, contending that the will must choose the greater good. Born in Bethune, he was educated at the University of Paris, where he studied with the English Scholastic philosopher William of Ocham. After his studies were completed, he was appointed professor of philosophy, and later rector, at the same university. Buridan is traditionally but probably incorrectly associated with a philosophical dilemma of moral choice called "Buridan's ass." In the problem an ass starves to death between two alluring bundles of hay because it does not have the will to decide which one to eat.