Digital Logic & Computer Design CS Professor Dan Moldovan Spring Chapter 3 :: Sequential Logic Design

Similar documents
give sequence to events have memory (short-term) use feedback from output to input to store information

Give sequence to events Have memory y( (short-term) Use feedback from output to input to store information

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

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

Exercises. 162 CHAPTER THREE Sequential Logic Design

Fundamentals of Computer Systems

Fundamentals of Computer Systems

ENGR 303 Introduction to Logic Design Lecture 10. Dr. Chuck Brown Engineering and Computer Information Science Folsom Lake College

Lecture 11: Sequential Circuit Design

CPE/EE 427, CPE 527 VLSI Design I Sequential Circuits. Sequencing

Fundamentals of Computer Systems

11. Sequential Elements

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

CPS311 Lecture: Sequential Circuits

Lecture 8: Sequential Logic

Chapter 7 Sequential Circuits

Problems with D-Latch

Sequential Circuit Design: Part 1

Lecture 10: Sequential Circuits

ECE 25 Introduction to Digital Design. Chapter 5 Sequential Circuits ( ) Part 1 Storage Elements and Sequential Circuit Analysis

Sequential Circuit Design: Part 1

Chapter 5 Synchronous Sequential Logic

EE 447/547 VLSI Design. Lecture 9: Sequential Circuits. VLSI Design EE 447/547 Sequential circuits 1

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

Combinational vs Sequential

Lecture 7: Sequential Networks

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

CS8803: Advanced Digital Design for Embedded Hardware

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

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Software Engineering 2DA4. Slides 9: Asynchronous Sequential Circuits

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

Engr354: Digital Logic Circuits

LATCHES & FLIP-FLOP. Chapter 7

CS8803: Advanced Digital Design for Embedded Hardware

Chapter 5: Synchronous Sequential Logic

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

Basis of sequential circuits: the R-S latch

CS 110 Computer Architecture. Finite State Machines, Functional Units. Instructor: Sören Schwertfeger.

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).

Memory elements. Topics. Memory element terminology. Variations in memory elements. Clock terminology. Memory element parameters. clock.

Synchronous Sequential Logic

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

Slide Set 7. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

6. Sequential Logic Flip-Flops

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

2 Sequential Circuits

Chapter 5 Sequential Circuits

Lec 24 Sequential Logic Revisited Sequential Circuit Design and Timing

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

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

More Digital Circuits

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

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

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

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

Sequential Circuit Design: Principle

Chapter 3 Unit Combinational

Chapter 4. Logic Design

EE 121 June 4, 2002 Digital Design Laboratory Handout #34 CLK

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

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

ALGORITHMS IN HW EECS150 ALGORITHMS IN HW. COMBINATIONAL vs. SEQUENTIAL. Sequential Circuits ALGORITHMS IN HW

6.S084 Tutorial Problems L05 Sequential Circuits

Flip-Flops and Sequential Circuit Design

! Two inverters form a static memory cell " Will hold value as long as it has power applied

Sequential Logic. Sequential Circuits. ! Timing Methodologies " Cascading flip-flops for proper operation " Clock skew

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

Administrative issues. Sequential logic

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

INTEGRATED CIRCUITS. AN219 A metastability primer Nov 15

Switching Circuits & Logic Design

Introduction. NAND Gate Latch. Digital Logic Design 1 FLIP-FLOP. Digital Logic Design 1

Rangkaian Sekuensial. Flip-flop

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

Sequential Circuits. Sequential Logic. Circuits with Feedback. Simplest Circuits with Feedback. Memory with Cross-coupled Gates.

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

Combinational / Sequential Logic

Logic Design ( Part 3) Sequential Logic (Chapter 3)

CHAPTER 1 LATCHES & FLIP-FLOPS

ESE 570 STATIC SEQUENTIAL CMOS LOGIC CELLS. Kenneth R. Laker, University of Pennsylvania, updated 25Mar15

CHAPTER 4: Logic Circuits

Digital Circuit And Logic Design I. Lecture 8

Digital Circuit And Logic Design I

CSE140: Components and Design Techniques for Digital Systems. More D-Flip-Flops. Tajana Simunic Rosing. Sources: TSR, Katz, Boriello & Vahid

Digital Fundamentals: A Systems Approach

CprE 281: Digital Logic

Principles of Computer Architecture. Appendix A: Digital Logic

P U Q Q*

Unit 11. Latches and Flip-Flops

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Chapter 3. Boolean Algebra and Digital Logic

Chapter 1: Switching Algebra Chapter 2: Logical Levels, Timing & Delays. Introduction to latches Chapter 9: Binary Arithmetic

Clocking Spring /18/05

Digital Fundamentals 11/2/2017. Summary. Summary. Floyd. Chapter 7. Latches

Digital Fundamentals

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Chapter 11 Latches and Flip-Flops

Note that none of the above MAY be a VALID ANSWER.

Transcription:

igital Logic & Computer esign CS 4341 Professor an Moldovan Spring 21 Copyright 27 Elsevier 3-<1> Chapter 3 :: Sequential Logic esign igital esign and Computer Architecture avid Money Harris and Sarah L. Harris Copyright 27 Elsevier 3-<2> 1

Chapter 3 :: Topics Introduction Latches and Flip-Flops Synchronous Logic esign Finite State Machines Timing of Sequential Logic Parallelism Copyright 27 Elsevier 3-<3> Introduction Outputs of sequential logic depend on current and prior input values it has memory. Some definitions: State: all the information about a circuit necessary to explain its future behavior Latches and flip-flops: state elements that store one bit of state Synchronous sequential circuits: combinational logic followed by a bank of flip-flops Copyright 27 Elsevier 3-<4> 2

Sequential Circuits Give sequence to events Have memory (short-term) Use feedback from output to input to store information Copyright 27 Elsevier 3-<5> State Elements The state of a circuit influences its future behavior State elements store state Bistable circuit S Latch Latch Flip-flop Copyright 27 Elsevier 3-<6> 3

Bistable Circuit Fundamental building block of other state elements Two outputs:, No inputs I2 I1 I1 I2 Copyright 27 Elsevier 3-<7> Bistable Circuit Analysis Consider the two possible cases: = : then = 1 and = (consistent) 1 I1 I2 1 = 1: then = and = 1 (consistent) I1 1 1 I2 Bistable circuit stores 1 bit of state in the state variable, (or ) But there are no inputs to control the state Copyright 27 Elsevier 3-<8> 4

S (Set/eset) Latch S Latch N1 S N2 Consider the four possible cases: S = 1, = S =, = 1 S =, = S = 1, = 1 Copyright 27 Elsevier 3-<9> S Latch Analysis S = 1, = : then = 1 and = N1 S 1 N2 S =, = 1: then = and = 1 1 N1 S N2 Copyright 27 Elsevier 3-<1> 5

S Latch Analysis S = 1, = : then = 1 and = N1 1 S 1 N2 S =, = 1: then = and = 1 1 1 N1 S N2 1 Copyright 27 Elsevier 3-<11> S Latch Analysis S =, = : then = prev prev = prev = 1 N1 N1 S N2 S N2 S = 1, = 1: then = and = 1 N1 1 N2 S Copyright 27 Elsevier 3-<12> 6

S Latch Analysis S =, = : then = prev and = prev (memory!) prev = prev = 1 1 N1 N1 1 S N2 1 1 S N2 S = 1, = 1: then = and = (invalid state: NOT ) 1 N1 1 N2 S Copyright 27 Elsevier 3-<13> S Latch Symbol S stands for Set/eset Latch Stores one bit of state () Control what value is being stored with S, inputs Set: Make the output 1 (S = 1, =, = 1) eset: Make the output (S =, = 1, = ) S Latch Symbol Must do something to avoid invalid state (when S = = 1) S Copyright 27 Elsevier 3-<14> 7

Latch Two inputs:, : controls when the output changes (the data input): controls what the output changes to Function When = 1, passes through to (the latch is transparent) When =, holds its previous value (the latch is opaque) Avoids invalid case when NOT Latch Symbol Copyright 27 Elsevier 3-<15> Latch Internal Circuit S S X 1 1 1 S Copyright 27 Elsevier 3-<16> 8

Latch Internal Circuit S S X 1 1 1 X 1 S prev 1 1 1 prev 1 Copyright 27 Elsevier 3-<17> Flip-Flop Two inputs:, Function The flip-flop samples on the rising edge of When rises from to 1, passes through to Otherwise, holds its previous value changes only on the rising edge of A flip-flop is called an edge-triggered device because it is activated on the clock edge Flip-Flop Symbols Copyright 27 Elsevier 3-<18> 9

Flip-Flop Internal Circuit Two back-to-back latches (L1 and L2) controlled by complementary clocks When = L1 is transparent L2 is opaque passes through to N1 When = 1 L2 is transparent L1 is opaque N1 passes through to Thus, on the edge of the clock (when rises from 1) passes through to L1 N1 L2 Copyright 27 Elsevier 3-<19> Flip-Flop vs. Latch (latch) (flop) Copyright 27 Elsevier 3-<2> 1

Flip-Flop vs. Latch (latch) (flop) Copyright 27 Elsevier 3-<21> egisters 1 1 3: 4 4 3: 2 2 3 3 Copyright 27 Elsevier 3-<22> 11

Enabled Flip-Flops Inputs:,, EN The enable input (EN) controls when new data () is stored Function EN = 1 passes through to on the clock edge EN = the flip-flop retains its previous state Internal Circuit Symbol EN 1 EN Copyright 27 Elsevier 3-<23> esettable Flip-Flops Inputs:,, eset Function: eset = 1 is forced to eset = the flip-flop behaves like an ordinary flip-flop Symbols eset r Copyright 27 Elsevier 3-<24> 12

esettable Flip-Flops Two types: Synchronous: resets at the clock edge only Asynchronous: resets immediately when eset = 1 Asynchronously resettable flip-flop requires changing the internal circuitry of the flip-flop (see Exercise 3.1) Synchronously resettable flip-flop? Copyright 27 Elsevier 3-<25> esettable Flip-Flops Two types: Synchronous: resets at the clock edge only Asynchronous: resets immediately when eset = 1 Asynchronously resettable flip-flop requires changing the internal circuitry of the flip-flop (see Exercise 3.1) Synchronously resettable flip-flop? Internal Circuit eset Copyright 27 Elsevier 3-<26> 13

Settable Flip-Flops Inputs:,, Set Funtion: Set = 1 is set to 1 Set = the flip-flop behaves like an ordinary flip-flop Symbols Set s Copyright 27 Elsevier 3-<27> Sequential Logic Sequential circuits: all circuits that aren t combinational A problematic circuit: X Y Z X Y Z 1 2 3 4 5 6 7 8 time (ns) This circuit has no inputs and 1-3 outputs Copyright 27 Elsevier 3-<28> 14

Sequential Logic Sequential circuits: all circuits that aren t combinational A problematic circuit: X Y Z X Y Z 1 2 3 4 5 6 7 8 time (ns) This circuit has no inputs and 1-3 outputs It is an astable circuit that oscillates Its period depends on the delay of the inverters which depends on the manufacturing process, temperature, etc The circuit has a cyclic path: output fed back to input Copyright 27 Elsevier 3-<29> Synchronous Sequential Logic esign Breaks cyclic paths by inserting registers These registers contain the state of the system The state changes at the clock edge, so we say the system is synchronized to the clock ules of synchronous sequential circuit composition: Every circuit element is either a register or a combinational circuit At least one circuit element is a register All registers receive the same clock signal Every cyclic path contains at least one register Two common synchronous sequential circuits Finite State Machines (FSMs) Pipelines Copyright 27 Elsevier 3-<3> 15

Finite State Machine (FSM) Consists of: State register that Store the current state and Load the next state at the clock edge S S Next State Current State Combinational logic that Computes the next state Computes the outputs Next State Logic C L Output Logic C L Next State Outputs Copyright 27 Elsevier 3-<31> Finite State Machines (FSMs) Next state is determined by the current state and the inputs Two types of finite state machines differ in the output logic: Moore FSM: outputs depend only on the current state Mealy FSM: outputs depend on the current state and the inputs Moore FSM inputs M next state logic k next state k state output logic N outputs Mealy FSM M inputs next state logic k next state k output logic N outputs Copyright 27 Elsevier 3-<32> state 16

Finite State Machine Example Traffic light controller Traffic sensors: T A, T B (TUE when there s traffic) Lights: L A, L B Academic Labs L A T A Bravado Blvd. T B T B ining Hall L B L A T A L B Fields Ave. orms Copyright 27 Elsevier 3-<33> FSM Black Box Inputs:, eset, T A, T B Outputs: L A, L B T A T B Traffic Light Controller L A L B eset Copyright 27 Elsevier 3-<34> 17

FSM State Transition iagram Moore FSM: outputs labeled in each state States: Circles Transitions: Arcs eset S L A : green L B : red Copyright 27 Elsevier 3-<35> FSM State Transition iagram Moore FSM: outputs labeled in each state States: Circles Transitions: Arcs eset S L A : green L B : red T A TA S1 L A : yellow L B : red S3 L A : red L B : yellow T B S2 L A : red L B : green T B Copyright 27 Elsevier 3-<36> 18

FSM State Transition Table Current State Inputs Next State S T A T B S' S X S 1 X S1 X X S2 X S2 X 1 S3 X X Copyright 27 Elsevier 3-<37> FSM State Transition Table Current State Inputs Next State S T A T B S' S X S1 S 1 X S S1 X X S2 S2 X S3 S2 X 1 S2 S3 X X S Copyright 27 Elsevier 3-<38> 19

FSM Encoded State Transition Table Current State Inputs Next State S 1 S T A T B S' 1 S' X 1 X 1 X X 1 X 1 X 1 1 1 X X State Encoding S S1 1 S2 1 S3 11 Copyright 27 Elsevier 3-<39> FSM Encoded State Transition Table Current State Inputs Next State S 1 S T A T B S' 1 S' X 1 1 X 1 X X 1 1 X 1 1 1 X 1 1 1 1 X X State Encoding S S1 1 S2 1 S3 11 S' 1 = S 1 S S' = S 1 S T A + S 1 S T B Copyright 27 Elsevier 3-<4> 2

FSM Output Table Current State Outputs S 1 S L A1 L A L B1 L B 1 1 1 1 Output Encoding green yellow 1 red 1 Copyright 27 Elsevier 3-<41> FSM Output Table Current State Outputs S 1 S L A1 L A L B1 L B 1 1 1 1 1 1 1 1 1 1 Output Encoding green yellow 1 red 1 L A1 = S 1 L A = S 1 S L B1 = S 1 L B = S 1 S Copyright 27 Elsevier 3-<42> 21

FSM Schematic: State egister S' 1 S 1 S' r eset S state register Copyright 27 Elsevier 3-<43> FSM Schematic: Next State Logic S' 1 S 1 T A T B S 1 S S' r eset S inputs next state logic state register Copyright 27 Elsevier 3-<44> 22

FSM Schematic: Output Logic L A1 S' 1 S 1 L A T A S' r S L B1 T B eset S 1 S L B inputs next state logic state register output logic outputs Copyright 27 Elsevier 3-<45> FSM Timing iagram Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle 1 C LK es et T A T B S ' 1:?? S () S1 ( 1) S2 (1 ) S3 (1 1) S ( ) S1 (1 ) S 1 :?? S ( ) S1 ( 1) S2 (1 ) S3 (1 1) S () L A 1 :?? Green () Yellow (1 ) ed (1 ) Green ( ) L B 1 :?? ed (1) Green ( ) Yellow (1) ed (1) 5 1 15 2 2 5 3 35 4 45 eset S L A : green L B : red T A TA S1 L A : yellow L B : red t (se c) S3 S2 Copyright 27 Elsevier L A : red L A : red 3-<46> L B : yellow T B L B : green T B 23

FSM State Encoding Binary encoding: i.e., for four states,, 1, 1, 11 One-hot encoding One state bit per state Only one state bit is HIGH at once I.e., for four states, 1, 1, 1, 1 equires more flip-flops Often next state and output logic is simpler Copyright 27 Elsevier 3-<47> Moore vs. Mealy FSM Alyssa P. Hacker has a snail that crawls down a paper tape with 1 s and s on it. The snail smiles whenever the last four digits it has crawled over are 111. esign Moore and Mealy FSMs of the snail s brain. Copyright 27 Elsevier 3-<48> 24

State Transition iagrams reset Moore FSM 1 1 1 1 S S1 S2 S3 1 S4 1 Mealy FSM: arcs indicate input/output Mealy FSM reset 1/ 1/ / 1/1 S S1 S2 S3 / 1/ / / Copyright 27 Elsevier 3-<49> Moore FSM State Transition Table Current State Inputs Next State S 2 S 1 S A S' 2 S' 1 S' 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 State Encoding S S1 1 S2 1 S3 11 S4 1 Copyright 27 Elsevier 3-<5> 25

Moore FSM State Transition Table Current State Inputs Next State S 2 S 1 S A S' 2 S' 1 S' 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 State Encoding S S1 1 S2 1 S3 11 S4 1 1 1 1 1 Copyright 27 Elsevier 3-<51> Moore FSM Output Table Current State Output S 2 S 1 S Y 1 1 1 1 1 Copyright 27 Elsevier 3-<52> 26

Moore FSM Output Table Current State Output S 2 S 1 S Y 1 1 1 1 1 1 Y = S 2 Copyright 27 Elsevier 3-<53> Mealy FSM State Transition and Output Table Current State Input Next State Output S 1 S A S' 1 S' Y 1 1 1 1 1 1 1 1 1 State Encoding S S1 1 S2 1 S3 11 1 1 1 Copyright 27 Elsevier 3-<54> 27

Mealy FSM State Transition and Output Table Current State Input Next State Output S 1 S A S' 1 S' Y 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 State Encoding S S1 1 S2 1 S3 11 Copyright 27 Elsevier 3-<55> Moore FSM Schematic A S' 2 S 2 Y S' 1 S 1 S' S eset S 2 S 1 S Copyright 27 Elsevier 3-<56> 28

Mealy FSM Schematic A S' 1 S 1 Y S' eset S S S 1 Copyright 27 Elsevier 3-<57> Moore and Mealy Timing iagram Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle 1 eset A S Y S 1 1 1 1 1 1 Moore Machine?? S S1 S2 S2 S3 S4 S2 S3 S4 S Mealy Machine?? S S1 S2 S2 S3 S1 S2 S3 S1 S Y Copyright 27 Elsevier 3-<58> 29

Factoring State Machines Break complex FSMs into smaller interacting FSMs Example: Modify the traffic light controller to have a Parade Mode. The FSM receives two more inputs: P, When P = 1, it enters Parade Mode and the Bravado Blvd. light stays green. When = 1, it leaves Parade Mode Copyright 27 Elsevier 3-<59> Parade FSM Unfactored FSM P T A T B Controller FSM L A L B Factored FSM P Mode FSM M T A T B Lights FSM L A L B Controller FSM Copyright 27 Elsevier 3-<6> 3

Unfactored FSM State Transition iagram PT A eset S L A : green L B : red P P S3 L A : red L B : yellow T A P P T A P P T B T A P T B S1 L A : yellow L B : red P S2 L A : red L B : green P T A T A S4 L A : green L B : red S7 L A : red L B : yellow T A T A S5 L A : yellow L B : red S6 L A : red L B : green P T B T B Copyright 27 Elsevier 3-<61> Factored FSM State Transition iagram eset S L A : green L B : red T A TA S1 L A : yellow L B : red S3 L A : red L B : yellow MT B S2 L A : red L B : green eset S M: P P S1 M: 1 M + T B Lights FSM Mode FSM Copyright 27 Elsevier 3-<62> 31

FSM esign Procedure Identify the inputs and outputs Sketch a state transition diagram Write a state transition table Select state encodings For a Moore machine: ewrite the state transition table with the selected state encodings Write the output table For a Mealy machine: ewrite the combined state transition and output table with the selected state encodings Write Boolean equations for the next state and output logic Sketch the circuit schematic Copyright 27 Elsevier 3-<63> Timing Flip-flop samples at clock edge must be stable when it is sampled Similar to a photograph, must be stable around the clock edge If is changing when it is sampled, metastability can occur Copyright 27 Elsevier 3-<64> 32

Input Timing Constraints Setup time: t setup = time before the clock edge that data must be stable (i.e. not changing) Hold time: t hold = time after the clock edge that data must be stable Aperture time: t a = time around clock edge that data must be stable (t a = t setup + t hold ) t setup t hold t Copyright 27 Elsevier a 3-<65> Output Timing Constraints Propagation delay: t pcq = time after clock edge that the output is guaranteed to be stable (i.e., to stop changing) Contamination delay: t ccq = time after clock edge that might be unstable (i.e., start changing) t ccq t pcq Copyright 27 Elsevier 3-<66> 33

ynamic iscipline The input to a synchronous sequential circuit must be stable during the aperture (setup and hold) time around the clock edge. Specifically, the input must be stable at least t setup before the clock edge at least until t hold after the clock edge Copyright 27 Elsevier 3-<67> ynamic iscipline The delay between registers has a minimum and maximum delay, dependent on the delays of the circuit elements 1 CL 2 (a) 1 2 T c 1 2 (b) Copyright 27 Elsevier 3-<68> 34

Setup Time Constraint The setup time constraint depends on the maximum delay from register 1 through the combinational logic. The input to register 2 must be stable at least t setup before the clock edge. 1 2 1 C L T c 2 t pcq t pd t setup 1 2 T c Copyright 27 Elsevier 3-<69> Setup Time Constraint The setup time constraint depends on the maximum delay from register 1 through the combinational logic. The input to register 2 must be stable at least t setup before the clock edge. 1 C L 2 1 2 T c t pcq + t pd + t setup T c t pd 1 2 t pcq t pd t setup Copyright 27 Elsevier 3-<7> 35

Setup Time Constraint The setup time constraint depends on the maximum delay from register 1 through the combinational logic. The input to register 2 must be stable at least t setup before the clock edge. 1 C L 2 1 2 T c t pcq + t pd + t setup T c t pd T c (t pcq + t setup ) 1 2 t pcq t pd t setup Copyright 27 Elsevier 3-<71> Hold Time Constraint The hold time constraint depends on the minimum delay from register 1 through the combinational logic. The input to register 2 must be stable for at least t hold after the clock edge. 1 C L 2 1 1 2 2 t hold < t ccq t cd t hold Copyright 27 Elsevier 3-<72> 36

Hold Time Constraint The hold time constraint depends on the minimum delay from register 1 through the combinational logic. The input to register 2 must be stable for at least t hold after the clock edge. 1 C L 2 1 1 2 2 t hold < t ccq + t cd t cd > t ccq t cd t hold Copyright 27 Elsevier 3-<73> Hold Time Constraint The hold time constraint depends on the minimum delay from register 1 through the combinational logic. The input to register 2 must be stable for at least t hold after the clock edge. 1 C L 2 1 1 2 2 t hold < t ccq + t cd t cd > t hold - t ccq t ccq t cd t hold Copyright 27 Elsevier 3-<74> 37

Timing Analysis A B C X' X Timing Characteristics t ccq = 3 ps t pcq = 5 ps t setup = 6 ps t hold = 7 ps t pd = t cd = Setup time constraint: T c f c = 1/T c = Y' Y per gate t pd = 35 ps t cd = 25 ps Hold time constraint: t ccq + t pd > t hold? Copyright 27 Elsevier 3-<75> Timing Analysis A B C X' X Timing Characteristics t ccq = 3 ps t pcq = 5 ps t setup = 6 ps t hold = 7 ps Y' t pd = 3 x 35 ps = 15 ps t cd = 25 ps Setup time constraint: T c (5 + 15 + 6) ps = 215 ps f c = 1/T c = 4.65 GHz Y per gate t pd = 35 ps t cd = 25 ps Hold time constraint: t ccq + t pd > t hold? (3 + 25) ps > 7 ps? No! Copyright 27 Elsevier 3-<76> 38

Fixing Hold Time Violation Add buffers to the short paths: A B C X' X Timing Characteristics t ccq = 3 ps t pcq = 5 ps t setup = 6 ps t hold = 7 ps t pd = Y' Y per gate t pd = 35 ps t cd = 25 ps t cd = Setup time constraint: Hold time constraint: T c t ccq + t pd > t hold? f c = Copyright 27 Elsevier 3-<77> Fixing Hold Time Violation Add buffers to the short paths: A B C X' X Timing Characteristics t ccq = 3 ps t pcq = 5 ps t setup = 6 ps t hold = 7 ps Y' Y t pd = 3 x 35 ps = 15 ps t cd = 2 x 25 ps = 5 ps Setup time constraint: T c (5 + 15 + 6) ps = 215 ps f c = 1/T c = 4.65 GHz per gate t pd = 35 ps t cd = 25 ps Hold time constraint: t ccq + t pd > t hold? (3 + 5) ps > 7 ps? Yes! Copyright 27 Elsevier 3-<78> 39

Clock Skew The clock doesn t arrive at all registers at the same time Skew is the difference between two clock edges Examine the worst case to guarantee that the dynamic discipline is not violated for any register many registers in a system! 1 1 1 delay C L 2 2 2 t skew 1 2 Copyright 27 Elsevier 3-<79> Setup Time Constraint with Clock Skew In the worst case, the 2 is earlier than 1 1 1 1 CL T c 2 2 2 1 2 T c 1 2 t pcq t pd t setup t skew Copyright 27 Elsevier 3-<8> 4

Setup Time Constraint with Clock Skew In the worst case, the 2 is earlier than 1 1 1 1 CL T c 2 2 2 1 2 1 T c t pcq + t pd + t setup + t skew t pd 2 t pcq t pd t setup t skew Copyright 27 Elsevier 3-<81> Setup Time Constraint with Clock Skew In the worst case, the 2 is earlier than 1 1 1 1 CL T c 2 2 2 1 2 1 T c t pcq + t pd + t setup + t skew t pd T c (t pcq + t setup + t skew ) 2 t pcq t pd t setup t skew Copyright 27 Elsevier 3-<82> 41

Hold Time Constraint with Clock Skew In the worst case, 2 is later than 1 1 1 1 C L 2 2 2 1 2 1 t ccq + t cd > t cd > 2 t ccq t cd t skew t hold Copyright 27 Elsevier 3-<83> Hold Time Constraint with Clock Skew In the worst case, 2 is later than 1 1 1 1 C L 2 2 2 1 2 1 t ccq + t cd > t hold + t skew t cd > 2 t ccq t cd t skew t hold Copyright 27 Elsevier 3-<84> 42

Hold Time Constraint with Clock Skew In the worst case, 2 is later than 1 1 1 1 C L 2 2 2 1 2 1 t ccq + t cd > t hold + t skew t cd > t hold + t skew t ccq 2 t ccq t cd t skew t hold Copyright 27 Elsevier 3-<85> Violating the ynamic iscipline Asynchronous (for example, user) inputs might violate the dynamic discipline t setup t hold button t aperture Case I Case II Copyright 27 Elsevier 3-<86>??? Case III 43

Metastability Any bistable device has two stable states and a metastable state between them A flip-flop has two stable states (1 and ) and one metastable state If a flip-flop lands in the metastable state, it could stay there for an undetermined amount of time metastable stable stable Copyright 27 Elsevier 3-<87> Flip-flop Internals Because the flip-flop has feedback, if is somewhere between 1 and, the cross-coupled gates will eventually drive the output to either rail (1 or, depending on which one it is closer to). N1 S N2 A signal is considered metastable if it hasn t resolved to 1 or If a flip-flop input changes at a random time, the probability that the output is metastable after waiting some time, t, is: P(t res > t) = (T /T c ) e -t/τ t res : time to resolve to 1 or T, τ : properties of the circuit Copyright 27 Elsevier 3-<88> 44

Metastability Intuitively: T /T c describes the probability that the input changes at a bad time, i.e., during the aperture time P(t res > t) = (T /T c ) e -t/τ τ is a time constant indicating how fast the flip-flop moves away from the metastable state; it is related to the delay through the cross-coupled gates in the flip-flop P(t res > t) = (T /T c ) e -t/τ In short, if a flip-flop samples a metastable input, if you wait long enough (t), the output will have resolved to 1 or with high probability. Copyright 27 Elsevier 3-<89> Synchronizers Asynchronous inputs () are inevitable (user interfaces, systems with different clocks interacting, etc.). The goal of a synchronizer is to make the probability of failure (the output still being metastable) low. A synchronizer cannot make the probability of failure. SYNC Copyright 27 Elsevier 3-<9> 45

Synchronizer Internals A synchronizer can be built with two back-to-back flip-flops. Suppose the input is transitioning when it is sampled by flip-flop 1, F1. The amount of time the internal signal 2 can resolve to a 1 or is (T c - t setup ). F1 2 T c F2 2 metastable Copyright 27 Elsevier t t 3-<91> res setup t pcq Synchronizer Probability of Failure For each sample, the probability of failure of this synchronizer is: P(failure) = (T /T c ) e -(T c - t setup )/τ 2 F1 T c F2 2 metastable Copyright 27 Elsevier t t 3-<92> res setup t pcq 46

Synchronizer Mean Time Before Failure If the asynchronous input changes once per second, the probability of failure per second of the synchronizer is simply P(failure). In general, if the input changes N times per second, the probability of failure per second of the synchronizer is: P(failure)/second = (NT /T c ) e -(T c - t setup )/τ Thus, the synchronizer fails, on average, 1/[P(failure)/second] This is called the mean time between failures, MTBF: MTBF = 1/[P(failure)/second] = (T c /NT ) e (T c - t setup )/τ Copyright 27 Elsevier 3-<93> Example Synchronizer F1 2 F2 Suppose: T c = 1/5 MHz = 2 ns τ = 2 ps T = 15 ps t setup = 1 ps N = 1 events per second What is the probability of failure? MTBF? P(failure) = P(failure)/second = MTBF = Copyright 27 Elsevier 3-<94> 47

Example Synchronizer F1 2 F2 Suppose: T c = 1/5 MHz = 2 ns τ = 2 ps T = 15 ps t setup = 1 ps N = 1 events per second What is the probability of failure? MTBF? P(failure) = (15 ps/2 ns) e-(1.9 ns)/2 ps = 5.6 1-6 P(failure)/second = 1 (5.6 1-6 ) = 5.6 1-5 / second MTBF = 1/[P(failure)/second] 5 hours Copyright 27 Elsevier 3-<95> Parallelism Two types of parallelism: Spatial parallelism duplicate hardware performs multiple tasks at once Temporal parallelism task is broken into multiple stages also called pipelining for example, an assembly line Copyright 27 Elsevier 3-<96> 48

Parallelism efinitions Some definitions: Token: A group of inputs processed to produce a group of outputs Latency: Time for one token to pass from start to end Throughput: The number of tokens that can be produced per unit time Parallelism increases throughput. Copyright 27 Elsevier 3-<97> Parallelism Example Ben Bitdiddle is baking cookies to celebrate the installation of his traffic light controller. It takes 5 minutes to roll the cookies and 15 minutes to bake them. After finishing one batch he immediately starts the next batch. What is the latency and throughput if Ben doesn t use parallelism? Latency = Throughput = Copyright 27 Elsevier 3-<98> 49

Parallelism Example Ben Bitdiddle is baking cookies to celebrate the installation of his traffic light controller. It takes 5 minutes to roll the cookies and 15 minutes to bake them. After finishing one batch he immediately starts the next batch. What is the latency and throughput if Ben doesn t use parallelism? Latency = 5 + 15 = 2 minutes = 1/3 hour Throughput = 1 tray/ 1/3 hour = 3 trays/hour Copyright 27 Elsevier 3-<99> Parallelism Example What is the latency and throughput if Ben uses parallelism? Spatial parallelism: Ben asks Allysa P. Hacker to help, using her own oven Temporal parallelism: Ben breaks the task into two stages: roll and baking. He uses two trays. While the first batch is baking he rolls the second batch, and so on. Copyright 27 Elsevier 3-<1> 5

Spatial Parallelism Latency: time to first tray 5 1 15 2 25 3 35 4 45 5 Spatial Parallelism Tray 1 Tray 2 Tray 3 Tray 4 Ben 1 Ben 1 Alyssa 1 Alyssa 1 Ben 2 Ben 2 Alyssa 2 Alyssa 2 Time oll Bake Legend Latency = Throughput = Copyright 27 Elsevier 3-<11> Spatial Parallelism Latency: time to first tray 5 1 15 2 25 3 35 4 45 5 Spatial Parallelism Tray 1 Tray 2 Tray 3 Tray 4 Ben 1 Ben 1 Alyssa 1 Alyssa 1 Ben 2 Ben 2 Alyssa 2 Alyssa 2 Time oll Bake Legend Latency = 5 + 15 = 2 minutes = 1/3 hour Throughput = 2 trays/ 1/3 hour = 6 trays/hour Copyright 27 Elsevier 3-<12> 51

Temporal Parallelism Latency: time to first tray 5 1 15 2 25 3 35 4 45 5 Temporal Parallelism Tray 1 Tray 2 Tray 3 Ben 1 Ben 1 Ben 2 Ben 2 Ben 3 Ben 3 Time Latency = Throughput = Copyright 27 Elsevier 3-<13> Temporal Parallelism Latency: time to first tray 5 1 15 2 25 3 35 4 45 5 Temporal Parallelism Tray 1 Tray 2 Tray 3 Ben 1 Ben 1 Ben 2 Ben 2 Ben 3 Ben 3 Time Latency = 5 + 15 = 2 minutes = 1/3 hour Throughput = 1 trays/ 1/4 hour = 4 trays/hour Using both techniques, the throughput would be 8 trays/hour Copyright 27 Elsevier 3-<14> 52