© 2003-2008 BYU 18 ASYNCH Page 1 ECEn 224 Handling Asynchronous Inputs.

Slides:



Advertisements
Similar presentations
Registers Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens A clock is a free-running signal with a cycle time. A clock may.
Advertisements

Clock Domain Crossing (CDC)
Digital Logic issues in Embedded Systems. Things upcoming Remember that the first two topic talks are on 10/24 (ultrasonic distance and stepper motors)
CS370 – Spring 2003 Hazards/Glitches. Time Response in Combinational Networks Gate Delays and Timing Waveforms Hazards/Glitches and How To Avoid Them.
ECE C03 Lecture 71 Lecture 7 Delays and Timing in Multilevel Logic Synthesis Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
1 Lecture 16 Timing  Terminology  Timing issues  Asynchronous inputs.
Aug Data/Clock Synchronization Fourteen ways to fool your synchronizer Ginosar, R.; Asynchronous Circuits and Systems, Proceedings. Ninth International.
1 Introduction Sequential circuit –Output depends not just on present inputs (as in combinational circuit), but on past sequence of inputs Stores bits,
Digital Logic Design Lecture # 17 University of Tehran.
Digital Logic Circuits (Part 2) Computer Architecture Computer Architecture.
1 Combinational Logic Network design Chapter 4 (continued ….)
Sequential Logic 1 clock data in may changestable data out (Q) stable Registers  Sample data using clock  Hold data between clock cycles  Computation.
Synchronous Digital Design Methodology and Guidelines
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)
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Debouncing Switches Mechanical switches are one of the most common interfaces to a uC. Switch inputs are asynchronous to the uC and are not electrically.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Dr. Shi Dept. of Electrical and Computer Engineering.
ENGIN112 L28: Timing Analysis November 7, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 28 Timing Analysis.
Give qualifications of instructors: DAP
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 6 –Selected Design Topics Part 3 – Asynchronous.
ENGIN112 L20: Sequential Circuits: Flip flops October 20, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 20 Sequential Circuits: Flip.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 11 - Timing and Metastability.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 12 - Metastability.
CS 151 Digital Systems Design Lecture 20 Sequential Circuits: Flip flops.
ECE C03 Lecture 61 Lecture 6 Delays and Timing in Multilevel Logic Synthesis Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
CS 151 Digital Systems Design Lecture 32 Hazards
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
CS 151 Digital Systems Design Lecture 28 Timing Analysis.
111/9/2005EE 108A Lecture 13 (c) 2005 W. J. Dally EE108A Lecture 13: Metastability and Synchronization Failure (or When Good Flip-Flops go Bad)
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.
Review for Exam 3 LC3 control State Graphs
© 2003 Xilinx, Inc. All Rights Reserved FPGA Design Techniques.
Rabie A. Ramadan Lecture 3
1 Digital Design: Time Behavior of Combinational Networks Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth,
SEQUENTIAL CIRCUITS Component Design and Use. Register with Parallel Load  Register: Group of Flip-Flops  Ex: D Flip-Flops  Holds a Word of Data 
Digital Logic Design Lecture # 21 University of Tehran.
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.
Lecture #26 Page 1 ECE 4110– Sequential Logic Design Lecture #26 Agenda 1.State Encoding 2.Pipelined Outputs 3.Asynchronous Inputs Announcements 1.n/a.
© BYU 13 COUNTERS Page 1 ECEn 224 COUNTERS Counters Transition Tables Moore Outputs Counter Timing.
MicroComputer Engineering DigitalCircuits slide 1 Combinational circuits Changes at inputs propagate at logic speed to outputs Not clocked No internal.
Flip Flop Chapter 15 Subject: Digital System Year: 2009.
© BYU 11b MSFF Page 1 ECEn 224 MSFF Master/Slave Flip Flops.
Timing Behavior of Gates
ECE 171 Digital Circuits Chapter 9 Hazards Herbert G. Mayer, PSU Status 2/21/2016 Copied with Permission from prof. Mark PSU ECE.
© BYU 12 REGISTERS Page 1 ECEn 224 Registers.
Copyright © 2001 Stephen A. Edwards All rights reserved Busses  Wires sometimes used as shared communication medium  Think “party-line telephone”  Bus.
Lecture #16: D Latch ; Flip-Flops
Overview Part 1 – The Design Space
REGISTER TRANSFER LANGUAGE (RTL)
Digital Fundamentals Floyd Chapter 7 Tenth Edition
Instructor: Alexander Stoytchev
Timing issues.
Lecture 8 Combinational Network Design and Issues
D Flip-Flop.
Instructor: Alexander Stoytchev
332:437 Lecture 12 Finite State Machine Design
Chapter 7 Latches, Flip-Flops, and Timers
Elec 2607 Digital Switching Circuits
Instructor: Alexander Stoytchev
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
CSE 370 – Winter Sequential Logic - 1
Instructor: Alexander Stoytchev
Metastability - When Good Flip-Flop Goes Bad: Causes and Cure
1) Latched, initial state Q =1
ECE 352 Digital System Fundamentals
Hazard-free Karnaugh Map Minimisation
Lecture 19 Logistics Last lecture Today
Synchronous Digital Design Methodology and Guidelines
Synchronous Digital Design Methodology and Guidelines
Presentation transcript:

© BYU 18 ASYNCH Page 1 ECEn 224 Handling Asynchronous Inputs

© BYU 18 ASYNCH Page 2 ECEn 224 Asynchronous Signals Definition: A signal that can change at any time with respect to the clock. Examples: –Push buttons –Keystrokes –Digital signals from different clock domain

© BYU 18 ASYNCH Page 3 ECEn 224 Two Problems with Asynchronous Inputs 1.Flip flops could become metastable 2.State machines may transition to incorrect next state These are two independent problems.

© BYU 18 ASYNCH Page 4 ECEn 224 Problem #1 Metastability

© BYU 18 ASYNCH Page 5 ECEn 224 Asynchronous Signals Problem: Asynchronous signals do not always respect setup and hold times –Asynchronous signals may change at any time Clock t setup t hold ok bad

© BYU 18 ASYNCH Page 6 ECEn 224 Metastability S=0 R=0 Q=1 Q’=0 Imagine if R is pulsed high for a very short time then goes back low… –Could it impart just enough energy to get Q halfway between ‘1’ and ‘0’? –Latch might hang at the midway point for some time Could be a short time, could be a long time –This is called metastability

© BYU 18 ASYNCH Page 7 ECEn 224 Metastability Violating t setup for a D flip flop can cause very short pulses on signals Y and Z, and make flip flop metastable D CLK Q Q’ Y Z

© BYU 18 ASYNCH Page 8 ECEn 224 Metastability Once a flip flop goes metastable, it is impossible to bound how long it will remain there Analogy: Roll ball up roof just hard enough to get it to balance on top…

© BYU 18 ASYNCH Page 9 ECEn 224 Metastability Once a flip flop goes metastable, it is impossible to bound how long it will remain there Analogy: Roll ball up roof just hard enough to get it to balance on top… When will it come down?

© BYU 18 ASYNCH Page 10 ECEn 224 Probability of Metastability The probability of an asynchronous signal causing metastability in a given clock cycle is very low However, there are millions or even billions of clock cycles every second Mean Time Between Failure (MTBF) quantifies how often a flip flop with an asynchronous input is likely to go metastable MTBF depends on: –Flip flop’s clock frequency –Frequency of changes on the asynchronous input –Electrical characteristics of the flop flop Typical MTBF numbers can range from minutes for high frequency systems to thousands of years for slower devices

© BYU 18 ASYNCH Page 11 ECEn 224 Metastability Solutions Solution #1: Specially-designed flip flops that are particularly resistant (hardened ) Solution #2: Multiple FF’s in series increases resistance to metastability –At the expense of response time D Q AsynchronousInSynchronizedOut Could also be hardened flip flops

© BYU 18 ASYNCH Page 12 ECEn 224 Problem #2 May Lead to Wrong Next State (No metastability involved here…)

© BYU 18 ASYNCH Page 13 ECEn 224 Wrong Next State Asynchronous inputs might cause the wrong next state to be loaded Two possible causes: –Unequal logic path lengths (Cause A) –False outputs on IFL outputs (Cause B)

© BYU 18 ASYNCH Page 14 ECEn 224 D Q IFL A 11 A A’ 00 N0 N1 C0 C1 5ns10ns clk Cause A: Unequal Path Lengths

© BYU 18 ASYNCH Page 15 ECEn 224 D Q IFL A=0 11 A A’ 00 N0=0 N1=0 Q0=0 Q1=0 5ns10ns clk Time t = 12 ns Cause A: Unequal Path Lengths

© BYU 18 ASYNCH Page 16 ECEn 224 Cause A: Unequal Path Lengths D Q IFL A1A1 11 A A’ 00 5ns10ns Time t = 13 ns N0=0 N1=0 Q0=0 Q1=0 clk

© BYU 18 ASYNCH Page 17 ECEn 224 Cause A: Unequal Path Lengths D Q IFL A1A1 11 A A’ 00 5ns10ns Time t = 18 ns N0=0 N1  1 Q0=0 Q1=0 clk

© BYU 18 ASYNCH Page 18 ECEn 224 Cause A: Unequal Path Lengths D Q IFL A1A1 11 A A’ 00 5ns10ns Time t = 20 ns (clock rises) N0=0 N1  1 Q0=0 Q1  1 clk

© BYU 18 ASYNCH Page 19 ECEn 224 CLK Current State 0010 A N1 N0 5ns 10ns Wrong next state!! Erroneous State Transition 11 A A’

© BYU 18 ASYNCH Page 20 ECEn 224 CLK Current State 0010 A N1 N0 5ns 10ns Erroneous State Transition 11 A A’ Danger period

© BYU 18 ASYNCH Page 21 ECEn 224 Solution #1: Synchronize Signal A D Q IFL A N0 N1 C0 C1 5ns10ns clk D Q clk IFL now sees synchronous input Synchronizing flip flop is still susceptible to metastability due to setup time violations. But that is a different problem with previously-seen solutions.

© BYU 18 ASYNCH Page 22 ECEn 224 Solution #2: Use Gray Codes for States D Q IFL A 11 A A’ 00 N0 N1 C0 C1 5ns10ns clk 11 A A’ 01 Will never have case when both paths transitioning… State change will occur or it won’t…

© BYU 18 ASYNCH Page 23 ECEn 224 Cause B: False Outputs Gray coding state transitions doesn’t always work! We can still have false outputs on our input forming logic These hazards can also lead to incorrect transitions

© BYU 18 ASYNCH Page 24 ECEn 224 F = A’B + AC F A’ B A C Logic Hazards This is the conventional K-map solution Asynchronous input A

© BYU 18 ASYNCH Page 25 ECEn 224 Gates Have Real Timing… A g1 g2 F Called a false output F A’ B=1 A C=1 g1 g2

© BYU 18 ASYNCH Page 26 ECEn 224 Gates Have Real Timing… A g1 g2 F If the clock edge occurs here… you’re toast! F A’ B=1 A C=1 g1 g2

© BYU 18 ASYNCH Page 27 ECEn 224 Hazard-Free Logic Design Make sure all adjacent 1’s are covered by the same prime implicant –Add redundant prime implicants as needed Redundant but will eliminate false output F A’ B A C B C g1 g2 g3 On ABC = ‘111’ to ABC = ‘011’, g3 will hold F high entire time.

© BYU 18 ASYNCH Page 28 ECEn 224 No False Output… A g1 g2 g3 F F A’ B=1 A C=1 B=1 C=1 g1 g2 g3

© BYU 18 ASYNCH Page 29 ECEn 224 Solution #3 Use both gray code states and hazard-free logic minimization –Gray code encoding ensure only one state bit changes Solves the unequal path problem –HFLM ensures no hazards (false outputs) exist on input forming logic 1 S 0101 S’ D Q IFL A N0 N1 C0 C1 5ns 10ns clk

© BYU 18 ASYNCH Page 30 ECEn 224 Asynchronous Input Problem Summary Problem #1: Asynchronous inputs can cause flip flops to enter a metastable state Problem #2: Asynchronous inputs can cause invalid state transitions A) Different propagation delays on IFL paths to different state bits B) False outputs on IFL outputs

© BYU 18 ASYNCH Page 31 ECEn 224 Solutions Summary Metastability –Solution #1: Use hardened flip flops May not be available –Solution #2: Add flip flops in series to decrease susceptibility Latency may cause problems, if we need to react immediately Invalid State Transitions –Solution #1: Synchronize asynchronous inputs with a flip flop Simplest solution Latency may cause problems, if we need to react immediately –Solution #2: gray code state encoding (doesn’t always work) –Solution #3: gray code + hazard-free IFL Takes extra hardware May require additional states to get gray code transitions Use when need to react quickly to input FF’s still susceptible to metastability HFLM only works for single-input changes The same solution!

© BYU 18 ASYNCH Page 32 ECEn 224 Other Asynchronous Input Issues

© BYU 18 ASYNCH Page 33 ECEn 224 Multiple Asynchronous Inputs What if we have a state transition that depends on multiple asynchronous inputs? S1 A’B A’B’ S0 S2 A

© BYU 18 ASYNCH Page 34 ECEn 224 Multiple Asynchronous Inputs Break up the states so that only one transition is dependant on each input S1 A’ S0 S2 A S3 B S1 A’B A’B’ S0 S2 A B’

© BYU 18 ASYNCH Page 35 ECEn 224 Multiple Clock Systems When you make up the rules –You can cheat… In this class we cheat: –One global clock  simplifies our work In the real world: –Systems have multiple clocks

© BYU 18 ASYNCH Page 36 ECEn 224 Multi-clock System This is a PCI Express board that plugs into a computer’s motherboard RAM (DDR SDRAM) FPGA PCI-E Interface (PHY) Video DAC PCI-E Connector

© BYU 18 ASYNCH Page 37 ECEn 224 Multi-clock System This is a PCI Express board that plugs into a computer’s motherboard 100 MHz 200 MHz MHz 250 MHz 2.5 GHz How do they talk to each other?

© BYU 18 ASYNCH Page 38 ECEn 224 Multi-Clock System This is a PCI card, plugs into a PC. Let’s use it to do a PhotoShop Accelerator… Xilinx FPGA RAM PCI Bus Interface Circuit 150MHz 66MHz

© BYU 18 ASYNCH Page 39 ECEn 224 Multi-Clock Systems This system has multiple clock domains Signals that cross domains look like asynchronous signals to the other domain For simple control signals, we can use one of the methods discussed in this lecture –Synchronizing flip flops –Hazard free logic + gray codes When data transfer is involved, the required solutions are more complicated (ECEn 320)