Software Engineering 2DA4. Slides 9: Asynchronous Sequential Circuits

Similar documents
Software Engineering 2DA4. Slides 3: Optimized Implementation of Logic Functions

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic

DIGITAL CIRCUIT LOGIC UNIT 11: SEQUENTIAL CIRCUITS (LATCHES AND FLIP-FLOPS)

Synchronous Sequential Logic

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

Chapter 5 Synchronous Sequential Logic

Unit 11. Latches and Flip-Flops

LAB #4 SEQUENTIAL LOGIC CIRCUIT

RS flip-flop using NOR gate

UNIT IV. Sequential circuit

(CSC-3501) Lecture 7 (07 Feb 2008) Seung-Jong Park (Jay) CSC S.J. Park. Announcement

Final Exam review: chapter 4 and 5. Supplement 3 and 4

Chapter 5: Synchronous Sequential Logic

D Latch (Transparent Latch)

RS flip-flop using NOR gate

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

CS8803: Advanced Digital Design for Embedded Hardware

Sequential Circuit Design: Principle

IT T35 Digital system desigm y - ii /s - iii

Sequential Logic. Analysis and Synthesis. Joseph Cavahagh Santa Clara University. r & Francis. TaylonSi Francis Group. , Boca.Raton London New York \

Sequential Circuits: Latches & Flip-Flops

Figure 1 shows a simple implementation of a clock switch, using an AND-OR type multiplexer logic.

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

MC9211 Computer Organization

UNIT III. Combinational Circuit- Block Diagram. Sequential Circuit- Block Diagram

Unit 9 Latches and Flip-Flops. Dept. of Electrical and Computer Eng., NCTU 1

Synchronous Sequential Logic. Chapter 5

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

SEQUENTIAL LOGIC. Satish Chandra Assistant Professor Department of Physics P P N College, Kanpur

2 Sequential Circuits

Lecture 8: Sequential Logic

Basis of sequential circuits: the R-S latch

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

CPS311 Lecture: Sequential Circuits

Clocks. Sequential Logic. A clock is a free-running signal with a cycle time.

Combinational vs Sequential

Sequential Logic Circuits

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

Logic Design II (17.342) Spring Lecture Outline

2.6 Reset Design Strategy

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

Advanced Digital Logic Design EECS 303


MODULE 3. Combinational & Sequential logic

Logic Design. Flip Flops, Registers and Counters

Combinational / Sequential Logic

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) LATCHES and FLIP-FLOPS

Find the equivalent decimal value for the given value Other number system to decimal ( Sample)

EEE2135 Digital Logic Design Chapter 6. Latches/Flip-Flops and Registers/Counters 서강대학교 전자공학과

Using minterms, m-notation / decimal notation Sum = Cout = Using maxterms, M-notation Sum = Cout =

Chapter. Synchronous Sequential Circuits

A clock is a free-running signal with a cycle time. A clock may be either high or low, and alternates between the two states.

cascading flip-flops for proper operation clock skew Hardware description languages and sequential logic

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Sequential Circuits

Chapter 5 Sequential Circuits

Flip-Flops. Because of this the state of the latch may keep changing in circuits with feedback as long as the clock pulse remains active.

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Sequential Circuits

More on Flip-Flops Digital Design and Computer Architecture: ARM Edition 2015 Chapter 3 <98> 98

CHAPTER 11 LATCHES AND FLIP-FLOPS

Name Of The Experiment: Sequential circuit design Latch, Flip-flop and Registers

Digital Fundamentals: A Systems Approach

Sequential Logic and Clocked Circuits

CHAPTER 4: Logic Circuits

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

COMP sequential logic 1 Jan. 25, 2016

Digital System Design

Sequential Circuits. Output depends only and immediately on the inputs Have no memory (dependence on past values of the inputs)

Flip-Flops and Sequential Circuit Design

Glitches/hazards and how to avoid them. What to do when the state machine doesn t fit!

Part II. Chapter2: Synchronous Sequential Logic

CHAPTER 4: Logic Circuits

Review of digital electronics. Storage units Sequential circuits Counters Shifters

CS8803: Advanced Digital Design for Embedded Hardware

Experiment 8 Introduction to Latches and Flip-Flops and registers

Engr354: Digital Logic Circuits

Momentary Changes in Outputs. State Machine Signaling. Oscillatory Behavior. Hazards/Glitches. Types of Hazards. Static Hazards

Chapter 3. Boolean Algebra and Digital Logic

Chapter 8 Sequential Circuits

First Name Last Name November 10, 2009 CS-343 Exam 2

INTRODUCTION TO SEQUENTIAL CIRCUITS

Chapter 5 Sequential Circuits

Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

Synchronous Sequential Logic

Decade Counters Mod-5 counter: Decade Counter:

COE 202: Digital Logic Design Sequential Circuits Part 1. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

Clock - key to synchronous systems. Topic 7. Clocking Strategies in VLSI Systems. Latch vs Flip-Flop. Clock for timing synchronization

Clock - key to synchronous systems. Lecture 7. Clocking Strategies in VLSI Systems. Latch vs Flip-Flop. Clock for timing synchronization

CHAPTER1: Digital Logic Circuits

ECEN454 Digital Integrated Circuit Design. Sequential Circuits. Sequencing. Output depends on current inputs

1. Convert the decimal number to binary, octal, and hexadecimal.

ELCT201: DIGITAL LOGIC DESIGN

1. What does the signal for a static-zero hazard look like?

Sequencing. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall,

ASYNCHRONOUS SEQUENTIAL CIRCUIT CONCEPTS

CS3350B Computer Architecture Winter 2015

Synchronous Sequential Logic

Computer Architecture and Organization

VeriLab. An introductory lab for using Verilog in digital design (first draft) VeriLab

Synchronous Sequential Logic

Transcription:

Software Engineering 2DA4 Slides 9: Asynchronous Sequential Circuits Dr. Ryan Leduc Department of Computing and Software McMaster University Material based on S. Brown and Z. Vranesic, Fundamentals of Digital Logic with Verilog Design, 3rd Ed. c 1999-2017 R.J. Leduc, M. Lawford 1

Asynchronous Inputs Synchronous sequential circuits use flip-flops to store the current state. State changes occur on the positive or negative clock edge. For synchronous inputs, changes occur shortly after the active clock edge since inputs of one circuit are typically outputs of another synchronous circuit driven by same clock. Asynchronous inputs may change at any time. e.g. pushbutton inputs, outputs from a circuit driven by a different clock. Problems: a) Propagation delays can cause signals to be interpreted as different values in different parts of the circuit. b) Asynchronous inputs may violate the setup and hold times of flip flops. c 1999-2017 R.J. Leduc, M. Lawford 2

Synchronizing Inputs Always put asynchronous inputs into a synchronizer. If the asynchronous input x was connected directly to D1 and D2, propagation delays could cause Q1 and Q2 to latch different values. Asynchronous Synchronous Synchronizer Async Input x Ds Qs D1 Q1... Clocḳ.. D2 Q2... c 1999-2017 R.J. Leduc, M. Lawford 3

Metastability Q: What happens when flip-flop setup and hold times are violated for synchronizer? A: Flip-flop may enter metastable state where logic value is neither 1 nor 0. Flip-flop will eventually resettle to either 1 or 0 after an indeterminate amount of time. If such a synchronizer failure occurs, the only guaranteed way to recover is to reset the entire circuit! While probability of synchronizer failure is usually small, it can never be eliminated. Good design though can reduce the probability of such failures. c 1999-2017 R.J. Leduc, M. Lawford 4

Reducing Metastability Problems Synchronizer failure can be reduced by the following methods: Using faster flip-flops with smaller setup and hold times (reduces size of vulnerable time window). Lengthening the system clock period or, if possible, sampling the input at a lower frequency (reduces number of vulnerable time windows). c 1999-2017 R.J. Leduc, M. Lawford 5

Reducing Metastability Problems - II Another common method uses a 2-bit shift register as synchronizer. If 1st synchronizer flip-flop enters metastable state, it will usually settle to a proper logic value before next active clock edge. This introduces a delay of one clock period on input. Asynchronous Synchronous Synchronizer1 Synchronizer2 Async Input x Ds Qs Ds Qs D1 Q1... Clocḳ.. D2 Q2... c 1999-2017 R.J. Leduc, M. Lawford 6

Asynchronous vs. Synchronous Sequential Circuits For the general model of a sequential circuit, inputs and current state are used by combinational circuits to compute outputs and next state. After a time delay (say ) the next state becomes the current state. For synchronous circuits, = clock period For asynchronous circuits, = total propagation delay c 1999-2017 R.J. Leduc, M. Lawford 7

Asynch vs. Synch Sequential Circuits - II Asynchronous circuits change when inputs change while synchronous circuits change on clock edge. Synchronous circuits assume that inputs do not change too close to active clock edge. Main assumptions for Asynchronous circuits: 1. Only 1 input changes at a time 2. Input changes occur sufficiently far apart to allow the circuit to reach a stable state before the next change. A stable state is a state the asynchronous circuits will stay in once reached, until another input changes. c 1999-2017 R.J. Leduc, M. Lawford 8

Asynch vs. Synch Sequential Circuits - III Asynchronous advantages: Speed: no clock involved; speed only depends upon propagation delays. Flexibility: different parts of an asynchronous system can operate at different speeds (each limited by their propagation delay) while in synchronous systems, clock freqequency has to accommodate slowest part. Power usage: distributing clock signal to all parts of an synchronous system adds to power usage, up to 30-40% for a high performance circuit. Asynchronous disadvantages: Design complexity: difficult to design, and limited tool support. Glitches: race conditions, glitches can cause problems if circuits not carefully designed. c 1999-2017 R.J. Leduc, M. Lawford 9

Asynchronous Terminology For asynchronous circuits we use the following terminology: Flow Table: refers to state table. Excitation Table: refers to state-assigned table. A state in a flow table is stable for particular set of inputs when the Next state = Current state. Otherwise the state is unstable and will change. We denote stable states in a flow table by circling them (e.g. (A)). c 1999-2017 R.J. Leduc, M. Lawford 10

SR-latch as Asynchronous Sequential Circuit To obtain state variables, we use the natural gate delay of circuit. We cut the feedback loop and insert a delay element. Creates a delay of time, equal to the combined propagation delay of the two NOR gates. We then treat the NOR gates as ideal gates with zero delay. We take y (output of delay element) to be the present state, and Y to be our next state variable (input to delay element). After time delay, y is assigned the value of Y. c 1999-2017 R.J. Leduc, M. Lawford 11

SR-latch as Asynch Sequential Circuit - II We take Q to be our output variable, where Q = y. We now derive an equation for Y in terms of S, R. and y. Taking point A as output of leftmost NOR gate, we have: A = (S +y) Thus: Y = R+(S +y) = R (S +y) Using this equation, we can construct the excitation table below. c 1999-2017 R.J. Leduc, M. Lawford 12

SR-latch as Asynch Sequential Circuit - III If we take y = 0 to be state A, and y = 1 to be state B, we can convert the excitation table to the flow diagram below. From the flow table, we can easily derive the state diagram below. Note that asynchronous circuits have no RESET state. Their initial state is random. c 1999-2017 R.J. Leduc, M. Lawford 13

Analysis of Asynchronous Sequential Circuits An asynchronous sequential circuit can be analyzed by the following steps: 1. Cut each feedback path and insert a delay. 2. Determine Next State and Output expressions from circuit. 3. Derive excitation table (async state assignment table) from Next State and Output equations. 4. Obtain a flow table (async state table) by assigning state labels to each of the state encodings. 5. Draw FSM from flow table. c 1999-2017 R.J. Leduc, M. Lawford 14

Analysis of Gated D Latch Derive equations for output Q and next state Y for gated D latch and use to derive excitation, flow and state diagram. c 1999-2017 R.J. Leduc, M. Lawford 15

Analysis of Master-Slave D Flip-flop Derive equations for output Q and next state variables Y m and Y s for master-slave D flip-flop, and use them to derive excitation, flow and state diagram. We will use y m and y s as our current state variables, and use the next state equations from gated D latch as our starting point (see discussion in class). NOTE: input C is the clock in a synchronous setting, but here it is just another input. c 1999-2017 R.J. Leduc, M. Lawford 16

Analysis of Master-Slave D Flip-flop - II Using derived equations, we can fill in the tables below. c 1999-2017 R.J. Leduc, M. Lawford 17

Analysis of Master-Slave D Flip-flop - III Using flow table, we can construct state diagram below. Read example 9.3 in text on own. c 1999-2017 R.J. Leduc, M. Lawford 18

Unspecified Entries For synthesis, can simplify by adding unspecified states when a particular input combination can t occur at a given state. Consider present state S2, and input combination CD = 01. This combination will never occur in normal operation, as S2 is only stable for CD = 10 and CD = 01 requires two input changes, both of which are not stable. For i.e., if we have path CD = 10 to CD = 00, this would take us to state S1, before we got change CD = 01 both stable for S1. c 1999-2017 R.J. Leduc, M. Lawford 19

Synthesis of Asynchronous Sequential Circuits 1. Derive state diagram. 2. Derive flow table (reduce states: we won t cover this). 3. Perform state assignments and derive excitation table. Ensure state variables do not contain race conditions. 4. Obtain next state and output expressions and ensure that they do not contain hazards (Section 9.6). 5. Construct circuit that implements these expressions. c 1999-2017 R.J. Leduc, M. Lawford 20

Asynchronous Design Example: Serial Parity Generator Problem: Design an asynchronous sequential circuit that implements a FSM that acts as an even serial parity generator. Circuit receives series of pulses on input w. When odd number of pulses have been received, output z is 1. When even number of pulses received, output z is 0. NOTE: in an ansynchronous circuit, we have no timing information. To detect a pulse, we need to detect when input goes from 0 to 1 (start of pulse), and then when it goes from 1 to 0 (end of pulse). See design of state diagram in class on board. c 1999-2017 R.J. Leduc, M. Lawford 21

Serial Parity Generator: tables From state diagram on board, we can write out flow diagram below. We will see on next slide why first state assignment is bad. c 1999-2017 R.J. Leduc, M. Lawford 22

State Assignments for Asynchronous FSMs Figure below contains two different possible state assignments for serial parity FSM. Problem: table (a) requires transition y 2 y 1 = 11 w=0 y 2 y 1 = 00 This requires y 1 and y 2 to change at exactly the same time! Since the circuit is not ideal, y 1 and y 2 will not change at the same time. c 1999-2017 R.J. Leduc, M. Lawford 23

State Assignments for Asynchronous FSMs - II Case 1: y 1 changes 1st. Circuit changes to y 2 y 1 = 10 corresponding to state C and then stays in C producing wrong output. Case 2: y 2 changes first. Circuit changes to y 2 y 1 = 01 = state B. Then tries to change to state C = 10. This requires 01 10, another simultaneous change. This means that y 2 must change again. Since we are assuming y 2 changed first, y 1 should complete its change to 0 first (before y 2 can change again), bringing the state to 00. c 1999-2017 R.J. Leduc, M. Lawford 24

State Assignments for Asynchronous FSMs - III As state 00 = A is correct and stable for w = 0, we arrive at the correct answer. The correct outcome depends on which variable changes first. This is referred to as a race condition. c 1999-2017 R.J. Leduc, M. Lawford 25

Eliminating Race Conditions Treat state variables like inputs to circuit: Only allow one variable to change at a time (grey code!). Want state change pattern: A B C D 00 --> 01 --> 11 --> 10 ^ --------------------- Table (b) uses this state assignment. c 1999-2017 R.J. Leduc, M. Lawford 26

Implementing FSM From excitation table (b), we can derive our output and next state equations. For our output, we have: z = y 1. For our next state equations we have: Y 1 = wy 2 +wy 1 + y 1 y 2 Y 2 = wy 2 +wy 1 }{{} k maps + y 1 y 2 }{{} stop hazards c 1999-2017 R.J. Leduc, M. Lawford 27

Implementing FSM - II Below is circuit for FSM. On the right is the synchronous equivalent. c 1999-2017 R.J. Leduc, M. Lawford 28

Hazards In an asynchronous sequential circuit, want to avoid glitches on signals. A glitch is when a signal temporary takes on the wrong value: should always be zero. Glitches caused by structure of circuit and propagation delays are called hazards. c 1999-2017 R.J. Leduc, M. Lawford 29

Types of Hazards There are two types: Static Hazards: When signal is not suppose to change its value in response to a specific change in an input, but instead momentarily does change. Dynamic Hazards: This is when a signal is suppose to change value, but there is a small oscillation. c 1999-2017 R.J. Leduc, M. Lawford 30

Static Hazards A change to a primary input often has more than one path of propagation to an output. When one path has a longer propagation delay than the others, we may find a static hazard. This can be eliminated by examining the k-map of the output. A potential hazard exists whenever two ajacent ones (or 0 s if we are doing a product-of-sum implementation) are not covered by a common product term (sum term for product-of-sum). To guarantee no static hazards, obtain a cover such that each pair of adjacent one s (zero s) is covered by a common product term (sum term). c 1999-2017 R.J. Leduc, M. Lawford 31

Static Hazard Example Top circuit is the minimal k-map version and it contains a static hazard as shown on next slide. Minimal circuit (black groupings) have two adjacent 1 terms (x 1 x 2 goes from 01 to 11), thus could have static hazard. In k-map, the blue grouping is added to ensure no hazards. Bottom circuit contains all three terms, thus no static hazards. c 1999-2017 R.J. Leduc, M. Lawford 32

Static Hazard Example - II Using a k-map, we can see if a circuit might have static hazards, and how to ensure they don t. The kmap also indicates where to look for a static hazard (input combinations that goes between two adjacent one terms that are not covered by a common product term.) For the hazard to exist, we need two paths with different propagation delays. We can use a timing diagram to show the existence of a hazard as below. c 1999-2017 R.J. Leduc, M. Lawford 33

Checking State Variables for Static Hazards This means checking the next state variables (ie. Y 1, not y 1 ). Ignore ouput logic. Ignore feedback path. Treat present state variables as just another input to your circuit. Derive equations for each next state variable and write down its k-map. Analyze each k-map for potential static hazards. c 1999-2017 R.J. Leduc, M. Lawford 34

Checking State Variables for Static Hazards - II c 1999-2017 R.J. Leduc, M. Lawford 35

Dynamic Hazards Figure shows an example of a dynamic hazard. A dynamic hazard is caused by the structure of a circuit. It s caused by a circuit with more than two levels, in which changes to an input have more than one path to propagate along. In Figure, there are three paths. A circuit with a dynamic hazard must also contain a static hazard. The figure has a static hazard at point b. To avoid dynamic hazards, design two-level circuits with no static hazards. c 1999-2017 R.J. Leduc, M. Lawford 36