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

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

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

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

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

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

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

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

Logic Design. Flip Flops, Registers and Counters

Experiment 8 Introduction to Latches and Flip-Flops and registers

Basis of sequential circuits: the R-S latch

ELCT201: DIGITAL LOGIC DESIGN

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

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

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

6. Sequential Logic Flip-Flops

Unit 11. Latches and Flip-Flops

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

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

UNIT 11 LATCHES AND FLIP-FLOPS

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

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.

Switching Circuits & Logic Design

Chapter 4. Logic Design

Lecture 8: Sequential Logic

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

Switching Circuits & Logic Design

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

Combinational vs Sequential

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

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

CHAPTER 4: Logic Circuits

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

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

CHAPTER 4: Logic Circuits

Advanced Digital Logic Design EECS 303

MC9211 Computer Organization

Asynchronous (Ripple) Counters

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

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

D Latch (Transparent Latch)

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

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

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

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

Registers and Counters

Digital Fundamentals: A Systems Approach

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

ECE 263 Digital Systems, Fall 2015

Engr354: Digital Logic Circuits

INTRODUCTION TO SEQUENTIAL CIRCUITS

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

CHAPTER1: Digital Logic Circuits

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

UNIT IV. Sequential circuit

Sequential Circuits: Latches & Flip-Flops

Registers and Counters

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

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

ELCT201: DIGITAL LOGIC DESIGN

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

CHAPTER 11 LATCHES AND FLIP-FLOPS

Counter dan Register

RS flip-flop using NOR gate

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

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

RS flip-flop using NOR gate

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

Fundamentals of Computer Systems

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

Flip-Flops and Sequential Circuit Design

Unit-5 Sequential Circuits - 1

UNIT-3: SEQUENTIAL LOGIC CIRCUITS

Synchronous Sequential Logic

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

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

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

Sequential circuits. Same input can produce different output. Logic circuit. William Sandqvist

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

Digital Circuit And Logic Design I. Lecture 8

Digital Circuit And Logic Design I

Vignana Bharathi Institute of Technology UNIT 4 DLD

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

DIGITAL ELECTRONICS MCQs

Review of digital electronics. Storage units Sequential circuits Counters Shifters

Sri Vidya College of Engineering And Technology. Virudhunagar Department of Electrical and Electronics Engineering

Counters

Digital Logic Design ENEE x. Lecture 19

11. Sequential Elements

Chapter 11 Latches and Flip-Flops

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

Registers and Counters

Introduction to Sequential Circuits

Modeling Latches and Flip-flops

LATCHES & FLIP-FLOP. Chapter 7

Sequential Logic Basics

Digital Fundamentals: A Systems Approach

Transcription:

equential logic equential circuits simple circuits with feedback latches edge-triggered flip-flops Timing methodologies cascading flip-flops for proper operation clock skew Basic registers shift registers simple counters Hardware description languages and sequential logic Autumn 26 CE37 -IV -equential Logic Circuits with feedback How to control feedback? what stops values from cycling around endlessly X X2 Xn switching network Z Z2 Zn Autumn 26 CE37 -IV -equential Logic 2

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? selectively break feedback path load new value into cell "remember" "data" "load" "stored value" Autumn 26 CE37 -IV -equential Logic 3 Memory with cross-coupled gates Cross-coupled NO gates similar to inverter pair, with capability to force output to (reset=) or (set=) ' Cross-coupled NAND gates similar to inverter pair, with capability to force output to (reset=) or (set=) ' ' ' ' ' Autumn 26 CE37 -IV -equential Logic 4

Timing behavior ' eset Hold et eset et ace \ Autumn 26 CE37 -IV -equential Logic 5 tate behavior or - latch Truth table of - latch behavior ' ' ' hold unstable ' ' Autumn 26 CE37 -IV -equential Logic 6

Theoretical - latch behavior ' = = = ' ' tate diagram states: possible values transitions: changes based on inputs = ' ' Autumn 26 CE37 -IV -equential Logic 7 Theoretical - latch behavior ' = = = ' = ' = = tate diagram states: possible values transitions: changes based on inputs = ' = ' Autumn 26 CE37 -IV -equential Logic 8

Theoretical - latch behavior ' = = = ' = = = ' = = tate diagram states: possible values transitions: changes based on inputs = = = ' = ' Autumn 26 CE37 -IV -equential Logic 9 Theoretical - latch behavior ' = = = ' = = = ' = = tate diagram states: possible values transitions: changes based on inputs possible oscillation between states and = = = = ' ' = = = = Autumn 26 CE37 -IV -equential Logic

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 ' = = ' = = = = ' = = = = = ' = = Autumn 26 CE37 -IV -equential Logic - latch analysis Break feedback path (t) ' (t+ ) (t) (t+ ) X X hold reset set not allowed (t) X X characteristic equation (t+ ) = + (t) Autumn 26 CE37 -IV -equential Logic 2

Activity: - latch using NAND gates ' (t) (t+ ) (t) characteristic equation (t+ ) = Autumn 26 CE37 -IV -equential Logic 3 Activity: - latch using NAND gates ' (t) (t) (t+ ) X X hold reset set not allowed (t) X X characteristic equation (t+ ) = + (t) Autumn 26 CE37 -IV -equential Logic 4

Gated - latch Control when and inputs matter otherwise, the slightest glitch on or while enable is low could cause change in value stored et ' enable' ' eset ' ' ' enable' ' Autumn 26 CE37 -IV -equential Logic 5 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) duty-cycle (time clock is high between ticks - expressed as % of period) duty cycle (in this case, 5%) period Autumn 26 CE37 -IV -equential Logic 6

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 signals must be stable for the other half of clock period clock and stable changing stable changing stable clock Autumn 26 CE37 -IV -equential Logic 7 Cascading latches Connect output of one latch to input of another How to stop changes from racing through chain? need to be able to control flow of data from one latch to the next move one latch per clock period have to worry about logic between latches (arrows) that is too fast clock Autumn 26 CE37 -IV -equential Logic 8

Master-slave structure 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 Autumn 26 CE37 -IV -equential Logic 9 D 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 D just before clock goes low is what is stored in flip-flop can make - flip-flop by adding logic to make D = + master stage slave stage P D P gates Autumn 26 CE37 -IV-equential Logic 2

Edge-triggered flip-flops using gates Only 6 gates sensitive to inputs only near edge of clock signal (not while high) D D holds D when clock goes low negative edge-triggered D flip-flop (D-FF) Clk= 4-5 gate delays must respect setup and hold time constraints to successfully capture input D D D holds D when clock goes low characteristic equation (t+) = D Autumn 26 CE37 -IV -equential Logic 2 Edge-triggered flip-flops using transistors Only 8 transistors clk clk D clk clk clk clk D clk clk D D Autumn 26 CE37 -IV -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 D pos pos neg neg positive edge-triggered FF negative edge-triggered FF Autumn 26 CE37 -IV -equential Logic 23 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 we'll 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 flipflops (2) no flip-flop changes state more than once per clocking event Autumn 26 CE37 -IV -equential Logic 24

Timing methodologies (cont d) Definition of terms clock: periodic event, causes state of memory element to change can be rising edge or falling edge or high level 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 D D clock clock there is a timing "window" stable changing around the clocking event data during which the input must remain stable and unchanged clock in order to be recognized Autumn 26 CE37 -IV-equential Logic 25 Comparison of latches and flip-flops D positive edge-triggered flip-flop D edge D G transparent (level-sensitive) latch latch behavior is the same unless input changes while the clock is high Autumn 26 CE37 -IV -equential Logic 26

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 hi-to-lo transition 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) Autumn 26 CE37 -IV -equential Logic 27 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) T su T h.8.5 ns ns D T su.8 ns T h.5 ns Clk T w 3.3 ns T w 3.3 ns T pd 3.6 ns. ns T pd 3.6 ns. ns all measurements are made from the clocking event (the rising edge of the clock) Autumn 26 CE37 -IV-equential Logic 28

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 D D OUT IN Autumn 26 CE37 -IV -equential Logic 29 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.8ns T p.-3.6ns T su.8ns T p.-3.6ns timing constraints guarantee proper operation of cascaded components assumes infinitely fast distribution of the clock T h.5ns T h.5ns Autumn 26 CE37 -IV -equential Logic 3

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: In is a delayed version of original state: IN =, =, = due to skew, next state becomes: =, =, and not =, = Autumn 26 CE37 -IV -equential Logic 3 ummary of latches and flip-flops Development of D-FF level-sensitive used in custom integrated circuits can be made with 8 switches edge-triggered used in modern programmable logic devices good choice for data storage register Historically J-K FF was popular but now never used similar to - but with - being used to toggle output (complement state) good in days of TTL/I (more complex input function: D = J + K 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 Autumn 26 CE37 -IV -equential Logic 32

Flip-flop features eset (set state to ) synchronous: Dnew = ' Dold (when next clock edge arrives) asynchronous: doesn't wait for clock, quick but dangerous Preset or set (set state to ) (or sometimes P) synchronous: Dnew = Dold + (when next clock edge arrives) asynchronous: doesn't wait for clock, quick but dangerous Both reset and preset Dnew = ' Dold + (set-dominant) Dnew = ' Dold + ' (reset-dominant) elective input capability (input enable or load) LD or EN multiplexor at input: Dnew = LD' + LD Dold load may or may not override reset/set (usually / have priority) Complementary outputs and ' Autumn 26 CE37 -IV -equential Logic 33 egisters Collections of flip-flops with similar controls and logic stored values somehow related (for example, form binary value) share clock, reset, and set lines similar logic at each stage Examples shift registers counters OUT OUT2 OUT3 OUT4 "" D D D D IN IN2 IN3 IN4 Autumn 26 CE37 -IV -equential Logic 34

hift register Holds samples of input store last 4 input values in sequence 4-bit shift register: OUT OUT2 OUT3 OUT4 IN D D D D Autumn 26 CE37 -IV -equential Logic 35 Universal shift register Holds 4 values serial or parallel inputs serial or parallel outputs permits shift left or right shift 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 Autumn 26 CE37 -IV -equential Logic 36

Design of universal shift register Consider one of the four flip-flops new value at next clock cycle: clear s s new value output output value of FF to left (shift right) output value of FF to right (shift left) input Nth cell to N-th cell D to N+th cell CLEA s and s 2 3 control mux [N-] [N+] (left) (right) Input[N] Autumn 26 CE37 -IV-equential Logic 37 hift register application Parallel-to-serial conversion for serial transmission parallel outputs parallel inputs serial transmission Autumn 26 CE37 -IV -equential Logic 38

Pattern recognizer Combinational function of input samples in this case, recognizing the pattern on the single input signal OUT OUT OUT2 OUT3 OUT4 IN D D D D Autumn 26 CE37 -IV -equential Logic 39 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 D D D D Autumn 26 CE37 -IV -equential Logic 4

Activity How does this counter work? OUT OUT2 OUT3 OUT4 IN D D D D Autumn 26 CE37 -IV -equential Logic 4 Activity How does this counter work? OUT OUT2 OUT3 OUT4 IN D D D D Counts through the sequence:,,,,,,, Known as Mobius (or Johnson) counter Autumn 26 CE37 -IV -equential Logic 42

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 D D D D "" Autumn 26 CE37 -IV -equential Logic 43 Four-bit binary synchronous up-counter tandard component with many applications positive edge-triggered FFs w/ synchronous load and clear inputs parallel load data from D, 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 AND gate (2) CO goes high (3) High order 4-bits are incremented EN D C CO B A D C LOAD B A CL () Low order 4-bits = Autumn 26 CE37 -IV -equential Logic 44

Offset counters tarting offset counters use of synchronous load e.g.,,,,,,,,,,,... "" "" "" "" "" "" EN CO D D C C B B A A LOAD CL Ending offset counter comparator for ending value e.g.,,,,...,,, Combinations of the above (start and stop value) "" "" "" "" "" EN CO D D C C B B A A LOAD CL Autumn 26 CE37 -IV -equential Logic 45 Hardware Description Languages and equential Logic Flip-flops representation of clocks - timing of state changes asynchronous vs. synchronous hift registers imple counters Autumn 26 CE37 -IV -equential Logic 46

Flip-flop in Verilog Use always block's sensitivity list to wait for clock edge module dff (clk, d, q); input clk, d; output q; reg q; always @(posedge clk) q = d; endmodule Autumn 26 CE37 -IV -equential Logic 47 More Flip-flops ynchronous/asynchronous reset/set single thread that waits for the clock three parallel threads only one of which waits for the clock module dff (clk, s, r, d, q); input clk, s, r, d; output q; reg q; always @(posedge clk) if (r) q = 'b; else if (s) q = 'b; else q = d; endmodule ynchronous Asynchronous module dff (clk, s, r, d, q); input clk, s, r, d; output q; reg q; always @(posedge r) q = 'b; always @(posedge s) q = 'b; always @(posedge clk) q = d; endmodule Autumn 26 CE37 -IV -equential Logic 48

Incorrect Flip-flop in Verilog Use always block's sensitivity list to wait for clock to change module dff (clk, d, q); input clk, d; output q; reg q; always @(clk) q = d; Not correct! will change whenever the clock changes, not just on an edge. endmodule Autumn 26 CE37 -IV -equential Logic 49 Blocking and Non-Blocking Assignments Blocking assignments (X=A) completes the assignment before continuing on to next statement Non-blocking assignments (X<=A) completes in zero time and doesn t change the value of the target until a blocking point (delay/wait) is encountered Example: swap always @(posedge ) begin temp = B; B = A; A = temp; end always @(posedge ) begin A <= B; B <= A; end Autumn 26 CE37 -IV -equential Logic 5

egister-transfer-level (TL) Assignment Non-blocking assignment is also known as an TL assignment if used in an always block triggered by a clock edge all flip-flops change together // B,C,D all get the value of A always @(posedge clk) begin B = A; C = B; D = C; end // implements a shift register always @(posedge clk) begin B <= A; C <= B; D <= C; end Autumn 26 CE37 -IV -equential Logic 5 hift register in Verilog module shift_register (clk, in, out); input clk; input in; output [:3] out; reg [:3] out; initial begin out = ; // out[:3] = {,,, }; end always @(posedge clk) begin out = {in, out [:2]}; end endmodule Autumn 26 CE37 -IV -equential Logic 52

Activity: express in Verilog OUT OUT2 OUT3 OUT4 IN D D D D always @(posedge clk) begin end Autumn 26 CE37 -IV -equential Logic 53 Mobius Counter in Verilog OUT OUT2 OUT3 OUT4 IN D D D D initial begin A = b; B = b; C = b; D = b; end always @(posedge clk) begin A <= ~D; B <= A; C <= B; D <= C; end {A, B, C, D} <= {~D, A, B, C}; Autumn 26 CE37 -IV -equential Logic 54

Binary Counter in Verilog module binary_counter (clk, c8, c4, c2, c); input clk; output c8, c4, c2, c; reg [3:] count; initial begin count = ; end always @(posedge clk) begin count = count + 4 b; end assign c8 = count[3]; assign c4 = count[2]; assign c2 = count[]; assign c = count[]; endmodule module binary_counter (clk, c8, c4, c2, c, rco); input clk; output c8, c4, c2, c, rco; reg [3:] count; reg rco; initial begin... end always @(posedge clk) begin... end assign c8 = count[3]; assign c4 = count[2]; assign c2 = count[]; assign c = count[]; assign rco = (count == 4b ); endmodule Autumn 26 CE37 -IV -equential Logic 55 equential logic summary Fundamental building block of circuits with state latch and flip-flop - latch, - master/slave, D master/slave, edge-triggered D flip-flop Timing methodologies use of clocks cascaded FFs work because propagation delays exceed hold times beware of clock skew Basic registers shift registers counters Hardware description languages and sequential logic Autumn 26 CE37 -IV -equential Logic 56