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

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

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

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

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

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

Chapter 6. sequential logic design. This is the beginning of the second part of this course, sequential logic.

Chapter 6. sequential logic design. This is the beginning of the second part of this course, sequential logic.

Traversing Digital Design. EECS Components and Design Techniques for Digital Systems. Lec 22 Sequential Logic - Advanced

Lec 24 Sequential Logic Revisited Sequential Circuit Design and Timing

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

Collections of flip-flops with similar controls and logic

6. Sequential Logic Flip-Flops

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

UNIT 11 LATCHES AND FLIP-FLOPS

Basis of sequential circuits: the R-S latch

Switching Circuits & Logic Design

3 Flip-Flops. The latch is a logic block that has 2 stable states (0) or (1). The RS latch can be forced to hold a 1 when the Set line is asserted.

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

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

Unit 11. Latches and Flip-Flops

Overview of Chapter 4

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

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

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

12/31/2010. Overview. 12-Latches and Flip Flops Text: Unit 11. Sequential Circuits. Sequential Circuits. Feedback. Feedback

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

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

ELCT201: DIGITAL LOGIC DESIGN

Unit-5 Sequential Circuits - 1

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

COSC 243. Sequential Logic. COSC 243 (Computer Architecture) Lecture 5 - Sequential Logic 1

Logic Design. Flip Flops, Registers and Counters

Fundamentals of Computer Systems

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

Experiment 8 Introduction to Latches and Flip-Flops and registers

Lecture 8: Sequential Logic

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

Sequential Circuit Design: Part 1

Advanced Digital Logic Design EECS 303

Combinational vs Sequential

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

Engr354: Digital Logic Circuits

Chapter 11 Latches and Flip-Flops

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

Page 1. Some Definitions. Chapter 3: Sequential Logic. Sequential Logic. The Combinational Logic Unit. A NOR Gate with a Lumped Delay

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

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

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

CHAPTER 4: Logic Circuits

Digital Circuits ECS 371

ECE321 Electronics I

CHAPTER 4: Logic Circuits

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

INTRODUCTION TO SEQUENTIAL CIRCUITS

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

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Synchronous Sequential Logic

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

D Latch (Transparent Latch)

Fundamentals of Computer Systems

Sequential Circuit Design: Part 1

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

Switching Circuits & Logic Design

Digital Fundamentals: A Systems Approach

Fundamentals of Computer Systems

Sequential Circuits. Introduction to Digital Logic. Course Outline. Overview. Introduction to Digital Logic. Introduction to Sequential Circuits

Modeling Latches and Flip-flops

Universal Asynchronous Receiver- Transmitter (UART)

Digital Logic Design ENEE x. Lecture 19

Digital Fundamentals

Review of digital electronics. Storage units Sequential circuits Counters Shifters

SEQUENTIAL CIRCUITS SEQUENTIAL CIRCUITS

Lecture 11: Sequential Circuit Design

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

Multiplexor (aka MUX) An example, yet VERY useful circuit!

RS flip-flop using NOR gate

Sequentielle Schaltelemente

Part 4: Introduction to Sequential Logic. Basic Sequential structure. Positive-edge-triggered D flip-flop. Flip-flops classified by inputs

Registers and Counters

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

MC9211 Computer Organization

ENGN3213 Digital Systems and Microprocessors Sequential Circuits

DEPARTMENT OF ELECTRICAL &ELECTRONICS ENGINEERING DIGITAL DESIGN

Chapter 3 Unit Combinational

Registers & Counters. BME208 Logic Circuits Yalçın İŞLER

Sequential Circuits: Latches & Flip-Flops

Chapter 4. Logic Design

Chapter 4: One-Shots, Counters, and Clocks

RS flip-flop using NOR gate

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

Asynchronous (Ripple) Counters

CHAPTER 1 LATCHES & FLIP-FLOPS

Chapter 5: Synchronous Sequential Logic

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

UNIT IV. Sequential circuit

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

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.

ELCT201: DIGITAL LOGIC DESIGN

Flip-Flops and Related Devices. Wen-Hung Liao, Ph.D. 4/11/2001

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

Transcription:

equential Logic! equential Circuits " imple circuits with feedback " Latches " Edge-triggered flip-flops! Timing Methodologies " Cascading flip-flops for proper operation " Clock skew! Basic egisters " hift registers " Counters C 5 - pring 27 Lec. #5 equential Logic - equential Circuits! Circuits with Feedback " Outputs = f(inputs, past inputs, past outputs) " Basis for building "memory" into logic circuits " oor combination lock is an example of a sequential circuit # tate is memory # tate is an "output" and an "input" to combinational logic # Combination storage elements are also memory value C C2 C3 multiplexer comparator mux control new equal reset comb. logic state clock equal open/closed C 5 - pring 27 Lec. #5 equential Logic - 2

Circuits with Feedback! How to control feedback? " What stops values from cycling around endlessly X X2 Xn switching network Z Z2 Zn C 5 - pring 27 Lec. #5 equential Logic - 3 implest Circuits with Feedback! Two inverters form a static memory cell " Will hold value as long as it has power applied "" "" "stored value"! How to get a new value into the memory cell? " electively break feedback path " Load new value into cell "remember" "data" "load" "stored value" C 5 - pring 27 Lec. #5 equential Logic - 4

Memory with Cross-coupled Gates! Cross-coupled NO gates " imilar to inverter pair, with capability to force output to (reset=) or (set=)! Cross-coupled NAN gates " imilar to inverter pair, with capability to force output to (reset=) or (set=) ' ' ' ' ' ' C 5 - pring 27 Lec. #5 equential Logic - 5 Timing Behavior ' eset Hold et eset et ace \ C 5 - pring 27 Lec. #5 equential Logic - 6

tate Behavior of - latch! Truth table of - latch behavior hold unstable ' ' ' ' C 5 - pring 27 Lec. #5 equential Logic - 7 Theoretical - Latch Behavior = =! tate iagram " tates: possible values " Transitions: changes based on inputs possible oscillation between states and ' = = = = = = = ' ' = = = = ' = = = C 5 - pring 27 Lec. #5 equential Logic - 8

Observed - Latch Behavior! Very difficult to observe - latch in the - state " One of or usually changes first! Ambiguously returns to state - or - " A so-called "race condition" " Or non-deterministic transition = = ' = = = = ' = = = = = ' = = C 5 - pring 27 Lec. #5 equential Logic - 9 - Latch Analysis! Break feedback path (t) ' (t+!) (t) (t+!) X X hold reset set not allowed (t) X X characteristic equation (t+!) = + (t) C 5 - pring 27 Lec. #5 equential Logic -

Gated - Latch! Control when and inputs matter " Otherwise, the slightest glitch on or while enable is low could cause change in value stored ' enable' ' ' et eset ' ' enable' ' C 5 - pring 27 Lec. #5 equential Logic - Clocks! Used to keep time " Wait long enough for inputs (' and ') to settle " Then allow to have effect on value stored! Clocks are regular periodic signals " Period (time between ticks) " uty-cycle (time clock is high between ticks - expressed as % of period) duty cycle (in this case, 5%) period C 5 - pring 27 Lec. #5 equential Logic - 2

Clocks (cont d)! Controlling an - latch with a clock " Can't let and change while clock is active (allowing and to pass) " Only have half of clock period for signal changes to propagate " ignals must be stable for the other half of clock period ' clock' ' ' stable changing stable changing stable ' and ' clock C 5 - pring 27 Lec. #5 equential Logic - 3 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 ' ' clock C 5 - pring 27 Lec. #5 equential Logic - 4

Master-lave tructure! Break flow by alternating clocks (like an air-lock) " Use positive clock to latch inputs into one - latch " Use negative clock to change outputs with another - 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 C 5 - pring 27 Lec. #5 equential Logic - 5 The s Catching Problem! In first - stage of master-slave FF " -- glitch on or while clock is high "caught" by master stage " Leads to constraints on logic to be hazard-free master stage P' ' slave stage ' P P' ' et eset s catch Master Outputs lave Outputs P C 5 - pring 27 Lec. #5 equential Logic - 6

Flip-Flop! Make and complements of each other " Eliminates s catching problem " Can't just hold previous value (must have new value ready every clock period) " Value of just before clock goes low is what is stored in flipflop " Can make - flip-flop by adding logic to make = + ' master stage slave stage ' P' ' ' P gates C 5 - pring 27 Lec. #5 equential Logic - 7 Edge-Triggered Flip-Flops! More efficient solution: only 6 gates " sensitive to inputs only near edge of clock signal (not while high) Clk= holds ' when clock goes low C 5 - pring 27 Lec. #5 equential Logic - 8 holds when clock goes low negative edge-triggered flip-flop (-FF) 4-5 gate delays must respect setup and hold time constraints to successfully capture input characteristic equation (t+) =

Edge-Triggered Flip-Flops (cont d)! tep-by-step analysis Clk= Clk= when clock goes high-to-low data is latched new new " old C 5 - pring 27 Lec. #5 equential Logic - 9 when clock is low data is held Edge-Triggered Flip-Flops (cont d)! =, Clk High Act as inverters Clk= Hold state C 5 - pring 27 Lec. #5 equential Logic - 2

Edge-Triggered Flip-Flops (cont d)! =, Clk High # # Clk= # C 5 - pring 27 Lec. #5 equential Logic - 2 # Edge-Triggered Flip-Flops (cont d)! =, Clk LOW Act as inverters Clk= # # # C 5 - pring 27 Lec. #5 equential Logic - 22

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 pos pos' neg neg' positive edge-triggered FF negative edge-triggered FF C 5 - pring 27 Lec. #5 equential Logic - 23 Negative Edge Trigger FF in Verilog module d_ff (q, q_bar, data, clk); input data, clk; output q, q_bar; reg q; assign q_bar = ~q; always @(negedge clk) begin q <= data; end endmodule C 5 - pring 27 Lec. #5 equential Logic - 24

Announcements! Cancel Lab ection Tu -2 PM starting next week " Young assigned to Th 5-8 PM lab " Allen assigned to W 5-8 PM lab (3 TAs!)! Homework #2 Bug " Problem 7(b) revised and posted to the web! tarting Thursday, lecture meets in 59 Mulford C 5 - pring 27 Lec. #5 equential Logic - 25 Timing Methodologies! ules 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: " () Correct inputs, with respect to time, are provided to the flip-flops " (2) No flip-flop changes state more than once per clocking event C 5 - pring 27 Lec. #5 equential Logic - 26

Timing Methodologies (cont d)! efinition 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 T su T h data clock there is a timing "window" around the clocking event during which the input must remain stable and unchanged in order to be recognized clock data clock stable changing C 5 - pring 27 Lec. #5 equential Logic - 27 Comparison of Latches and Flip-Flops positive edge-triggered flip-flop edge G transparent (level-sensitive) latch latch behavior is the same unless input changes while the clock is high C 5 - pring 27 Lec. #5 equential Logic - 28

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) C 5 - pring 27 Lec. #5 equential Logic - 29 Typical Timing pecifications! Positive edge-triggered flip-flop " etup and hold times " Minimum clock width " Propagation delays (low to high, high to low, max and typical) Tsu 2ns Th 5ns Tsu 2ns Th 5ns Tw 25ns Tplh 25ns 3ns Tphl 4ns 25ns all measurements are made from the clocking event that is, the rising edge of the clock C 5 - pring 27 Lec. #5 equential Logic - 3

Cascading Edge-triggered Flip-Flops! hift 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) IN OUT IN C 5 - pring 27 Lec. #5 equential Logic - 3 Cascading Edge-triggered Flip-Flops! hift 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) IN OUT elay Clk IN Clk C 5 - pring 27 Lec. #5 equential Logic - 32

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 T su 4ns T p 3ns T su 4ns T p 3ns timing constraints guarantee proper operation of cascaded components assumes infinitely fast distribution of the clock T h 2ns T h 2ns C 5 - pring 27 Lec. #5 equential Logic - 33 Clock kew! The problem " Correct behavior assumes next state of all storage elements determined by all storage elements at the same time " ifficult in high-performance systems because time for clock to arrive at flip-flop is comparable to delays through logic (and will soon become greater than logic delay) " Effect of skew on cascaded flip-flops: In is a delayed version of original state: IN =, =, = due to skew, next state becomes: =, =, and not =, = C 5 - pring 27 Lec. #5 equential Logic - 34

ummary of Latches and Flip-Flops! evelopment of -FF " Level-sensitive used in custom integrated circuits # can be made with 4 switches " Edge-triggered used in programmable logic devices " Good choice for data storage register! Historically J-K FF was popular but now never used " imilar to - but with - being used to toggle output (complement state) " Good in days of TTL/I (more complex input function: = J' + K' " Not a good choice for PLAs as it requires two inputs " Can always be implemented using -FF! Preset and clear inputs are highly desirable on flip-flops " Used at start-up or to reset system to a known state C 5 - pring 27 Lec. #5 equential Logic - 35 Flip-Flop Features! eset (set state to ): " ynchronous: new = ' old (when next clock edge arrives) " Asynchronous: doesn't wait for clock, quick but dangerous! Preset or set (set state to : (or sometimes P) " ynchronous: new = old + (when next clock edge arrives) " Asynchronous: doesn't wait for clock, quick but dangerous! Both reset and preset " new = ' old + (set-dominant) " new = ' old + ' (reset-dominant)! elective input capability (input enable/load): L or EN " Multiplexer at input: new = L' + L old " Load may/may not override reset/set (usually / have priority)! Complementary outputs:! and ' C 5 - pring 27 Lec. #5 equential Logic - 36

egisters! Collections of flip-flops with similar controls and logic " tored values somehow related (e.g., form binary value) " hare clock, reset, and set lines " imilar logic at each stage! Examples " hift registers " Counters OUT OUT2 OUT3 OUT4 "" IN IN2 IN3 IN4 C 5 - pring 27 Lec. #5 equential Logic - 37 hift egister! Holds samples of input " tore last 4 input values in sequence " 4-bit shift register: OUT OUT2 OUT3 OUT4 IN C 5 - pring 27 Lec. #5 equential Logic - 38

hift egister Verilog module shift_reg (out4, out3, out2, out, in, clk); output out4, out3, out2, out; input in, clk; reg out4, out3, out2, out; always @(posedge clk) begin out4 <= out3; out3 <= out2; out2 <= out; out <= in; end endmodule C 5 - pring 27 Lec. #5 equential Logic - 39 hift egister Verilog module shift_reg (out, in, clk); output [4:] out; input in, clk; reg [4:] out; always @(posedge clk) begin out <= {out[3:], in}; end endmodule C 5 - pring 27 Lec. #5 equential Logic - 4

Universal hift egister! Holds 4 values " erial or parallel inputs " erial or parallel outputs " Permits shift left or right " hift in new values from left or right output left_in left_out clear s s input right_out right_in clock clear sets the register contents and output to s and s determine the shift function s s function hold state shift right shift left load new input C 5 - pring 27 Lec. #5 equential Logic - 4 esign of Universal hift egister! Consider one of the four flip-flops " New value at next clock cycle: Nth cell to N-th cell to N+th cell clear s s new value output output value of FF to left (shift right) output value of FF to right (shift left) input [N-] (left) CLEA s and s 2 3 control mux Input[N] [N+] (right) C 5 - pring 27 Lec. #5 equential Logic - 42

Universal hift egister Verilog module univ_shift (out, lo, ro, in, li, ri, s, clr, clk); output [3:] out; output lo, ro; input [3:] in; input [:] s; input li, ri, clr, clk; reg [3:] out; assign lo = out[3]; assign ro = out[]; always @(posedge clk or clr) begin if (clr) out <= ; else case (s) 3: out <= in; 2: out <= {out[2:], ri}; : out <= {li, out[3:]}; : out <= out; endcase end endmodule C 5 - pring 27 Lec. #5 equential Logic - 43 hift egister Application! Parallel-to-serial conversion for serial transmission parallel outputs parallel inputs serial transmission C 5 - pring 27 Lec. #5 equential Logic - 44

Pattern ecognizer! Combinational function of input samples " In this case, recognizing the pattern on the single input signal OUT OUT OUT2 OUT3 OUT4 IN C 5 - pring 27 Lec. #5 equential Logic - 45 Counters! equences through a fixed set of patterns " In this case,,,, " If one of the patterns is its initial state (by loading or set/reset) OUT OUT2 OUT3 OUT4 IN! Mobius (or Johnson) counter " In this case,,,,,,,, OUT OUT2 OUT3 OUT4 IN C 5 - pring 27 Lec. #5 equential Logic - 46

Binary Counter! Logic between registers (not just multiplexer) " XO decides when bit should be toggled " Always for low-order bit, only when first bit is true for second bit, and so on OUT OUT2 OUT3 OUT4 "" C 5 - pring 27 Lec. #5 equential Logic - 47 Binary Counter Verilog module shift_reg (out4, out3, out2, out, clk); output out4, out3, out2, out; input in, clk; reg out4, out3, out2, out; always @(posedge clk) begin out4 <= (out & out2 & out3) ^ out4; out3 <= (out & out2) ^ out3; out2 <= out ^ out2; out <= out ^ b ; end endmodule C 5 - pring 27 Lec. #5 equential Logic - 48

Binary Counter Verilog module shift_reg (out4, out3, out2, out, clk); output [4:] out; input in, clk; reg [4:] out; always @(posedge clk) out <= out + ; endmodule C 5 - pring 27 Lec. #5 equential Logic - 49 Four-bit Binary ynchronous Up-Counter! tandard component with many applications " Positive edge-triggered FFs w/ sync load and clear inputs " Parallel load data from, C, B, A " Enable inputs: must be asserted to enable counting " CO: ripple-carry out used for cascading counters # high when counter is in its highest state # implemented using an AN gate (2) CO goes high (3) High order 4-bits are incremented () Low order 4-bits = EN C B A LOA CL CO C B A C 5 - pring 27 Lec. #5 equential Logic - 5

Offset Counters! tarting offset counters use of synchronous load " e.g.,,,,,,,,,,,...! Ending offset counter comparator for ending value " e.g.,,,,...,,,! Combinations of the above (start and stop value) C 5 - pring 27 Lec. #5 equential Logic - 5 "" "" "" "" "" "" "" "" "" "" "" EN CO C C B B A A LOA CL EN CO C C B B A A LOA CL equential Logic ummary! Fundamental building block of circuits with state " Latch and flip-flop " - latch, - master/slave, master/slave, edge-triggered FF! Timing methodologies " Use of clocks " Cascaded FFs work because prop delays exceed hold times " Beware of clock skew! Basic registers " hift registers " Pattern detectors " Counters C 5 - pring 27 Lec. #5 equential Logic - 52