Flip-Flops. Outline: 2. Timing noise

Similar documents
CHAPTER 11 LATCHES AND FLIP-FLOPS

Wiki Lab Book. This week is practice for wiki usage during the project.

Lesson 12 Sequential Circuits: Flip-Flops

Memory Elements. Combinational logic cannot remember

Module 3: Floyd, Digital Fundamental

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

Master/Slave Flip Flops

ECE380 Digital Logic

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Chapter 9 Latches, Flip-Flops, and Timers

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

SEQUENTIAL CIRCUITS. Block diagram. Flip Flop. S-R Flip Flop. Block Diagram. Circuit Diagram

Sequential Logic: Clocks, Registers, etc.

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

Lecture 8: Synchronous Digital Systems

Sequential Logic Design Principles.Latches and Flip-Flops

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

Contents COUNTER. Unit III- Counters

BINARY CODED DECIMAL: B.C.D.

Theory of Logic Circuits. Laboratory manual. Exercise 3

EXPERIMENT 8. Flip-Flops and Sequential Circuits

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Counters and Decoders

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

So far we have investigated combinational logic for which the output of the logic devices/circuits depends only on the present state of the inputs.

CHAPTER 11: Flip Flops

Chapter 8. Sequential Circuits for Registers and Counters

Asynchronous Counters. Asynchronous Counters

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Lecture-3 MEMORY: Development of Memory:

CS311 Lecture: Sequential Circuits

Engr354: Digital Logic Circuits

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems

Counters & Shift Registers Chapter 8 of R.P Jain

ASYNCHRONOUS COUNTERS

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

Asynchronous counters, except for the first block, work independently from a system clock.

Digital Controller for Pedestrian Crossing and Traffic Lights

Lecture 7: Clocking of VLSI Systems

Upon completion of unit 1.1, students will be able to

CSE140: Components and Design Techniques for Digital Systems

Chapter 5. Sequential Logic

Combinational Logic Design Process

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

Fig1-1 2-bit asynchronous counter

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Digital Logic Design Sequential circuits

Digital Fundamentals

7. Latches and Flip-Flops

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

Flip-Flops, Registers, Counters, and a Simple Processor

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

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute 5. LECTURE: REGISTERS AND RELATED

A New Paradigm for Synchronous State Machine Design in Verilog

Counters. Present State Next State A B A B

DATA SHEETS DE COMPONENTES DA FAMÍLIA LÓGICA TTL GATES AND INVERTERS POSITIVES NAND GATES AND INVERTERS DESCRIÇÃO

Digital Electronics Detailed Outline

Modeling Latches and Flip-flops

Clocking. Figure by MIT OCW Spring /18/05 L06 Clocks 1

Layout of Multiple Cells

The 104 Duke_ACC Machine

The components. E3: Digital electronics. Goals:

2 : BISTABLES. In this Chapter, you will find out about bistables which are the fundamental building blocks of electronic counting circuits.

DEPARTMENT OF INFORMATION TECHNLOGY

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Traffic Light Controller. Digital Systems Design. Dr. Ted Shaneyfelt

Registers & Counters

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

Gates, Circuits, and Boolean Algebra

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

Design: a mod-8 Counter

CHAPTER 3 Boolean Algebra and Digital Logic

Cascaded Counters. Page 1 BYU

Digital Logic Elements, Clock, and Memory Elements

Decimal Number (base 10) Binary Number (base 2)

Advanced Logic Design Techniques in Asynchronous Sequential Circuit Synthesis

IE1204 Digital Design F12: Asynchronous Sequential Circuits (Part 1)

Lecture 10 Sequential Circuit Design Zhuo Feng. Z. Feng MTU EE4800 CMOS Digital IC Design & Analysis 2010

Design Verification & Testing Design for Testability and Scan

RETRIEVING DATA FROM THE DDC112

PURDUE UNIVERSITY NORTH CENTRAL

Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell

Lab 1: Study of Gates & Flip-flops

Latch Timing Parameters. Flip-flop Timing Parameters. Typical Clock System. Clocking Overhead

Chapter 2 Logic Gates and Introduction to Computer Architecture

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Set-Reset (SR) Latch

Systems I: Computer Organization and Architecture

Sequential Circuit Design

State Machines in VHDL

Transcription:

Outline: 2. Timing noise Flip-Flops Signal races, glitches FPGA example ( assign bad) Synchronous circuits and memory Logic gate example 4. Flip-Flop memory RS-latch example D and JK flip-flops Flip-flops in FPGAs Synchronous circuit design with FPGAs FPGA example ( always good). Parallel circuit design with FPGAs.

Timing noise Amplitude Noise A digital circuit is very immune to amplitude noise, since it can only have two values (Low or High, True or False, 0 or 1). Digital electronics circuits typically have error rates smaller than 1 part in 10 9 (no error correction). Timing Noise Just like an analog circuit, a digital circuit can experience timing noise. Fortunately, good clocks are cheap and easily available, and a good design will eliminate the effects of timing noise. Timing issues/errors can easily produce amplitude noise (bit errors).

Signal Race The timing delays produced by wires and logic gates can produce unwanted (illogical) outputs. Example: 3-input NAND gate A B AB C Y A B C Time ideal Y

Signal Race The timing delays produced by wires and logic gates can produce unwanted (illogical) outputs. Example: 3-input NAND gate A B AB C Y A B C AB resulting Y 2x gate delay Time If gate delays are too long output pulse could disappear

Signal Race The timing delays produced by wires and logic gates can produce unwanted (illogical) outputs. Example: 3-input NAND gate A B AB C Y A B C AB 2x gate delay Time actual Y Pulse is shorter than expected and delayed

A Signal Race with Glitch AB XOR B A Y A L L B L H Y L H B AB [diagram courtesy of Altera Inc.] H H L H H L resulting resulting A B A B AB AB Inverter delay Inverter delay + component differences Time resulting Y [Figure adapted from Principles of Electronics: Analog & Digital by L. R. Fortney]

A Signal Race with Glitch AB XOR B A Y A L L B L H Y L H B AB [diagram courtesy of Altera Inc.] H H L H H L A B A B Time real real real AB AB Y [Figure adapted from Principles of Electronics: Analog & Digital by L. R. Fortney]

Glitches with FPGAs Quartus II will simulate glitches glitches

Asynchronous Design Asynchronous design requires very careful attention to signal delays to avoid producing glitches and other spurious signals. Glitches will produce false data and can produce very wrong results e.g. a glitch on the most-significant-bit will produce a factor of 2 error. Asynchronous design can produce very fast digital circuits, but is generally avoided due to more difficult design.

Synchronous Design The use of memory and a clock can eliminate signal races and glitches. A B AB flip flop clock C in flip flop out Y Basic flip-flop operation clock The flip-flop will record and output the value at the input if the clock is HIGH. If the clock goes LOW, then the flip-flop does not change its value or output. Glitches are eliminated if 1. The clock HIGH and LOW times are longer than any gate delays. 2. The inputs are synchronized to the clock.

A B C Synchronous Timing AB flip flop flip flop clock Y clock clock A B C Flip-flop AB Flip-flop C resulting Y 2x gate delay Time Guaranteed minimum signal pulse

D-type Edge-Triggered Flip-Flop Generally, the flip-flop changes state on a clock signal edge, not the level. The flip-flop takes the value just before the clock edge. clock D t s t h S or PRE Q input D Q output For 74LS74: minimum t s = 20 ns minimum t h = 5 ns clock Q R or CLR [Texas Instruments 74LS74 flip-flop datasheet] Note: A flip-flop saves information (i.e. 1 bit); it does not modify it.

D-type Edge-Triggered Flip-Flop Generally, the flip-flop changes state on a clock signal edge, not the level. The flip-flop takes the value just before the clock edge. clock D t s t h rising-edge trigger S or PRE Q input D Q output For 74LS74: minimum t s = 20 ns minimum t h = 5 ns clock Q R or CLR [Texas Instruments 74LS74 flip-flop datasheet] Note: A flip-flop saves information (i.e. 1 bit); it does not modify it.

A B C clock A B Synchronous Timing (revisited) AB flip flop flip flop clock clock Y C Flip-flop AB Time Flip-flop C resulting Y

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 0 & S = 0: S = 0 & assume Q = 0 Q = 1. S = 0 & assume Q = 1 Q = 1. R = 0 & assume Q = 0 Q = 1. R = 0 & assume Q = 1 Q = 1.

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 0 & S = 0: S = 0 & assume Q = 0 Q = 1. S = 0 & assume Q = 1 Q = 1. R = 0 & assume Q = 0 Q = 1. consistent R=0 & S=0 Q=1 & Q=1 R = 0 & assume Q = 1 Q = 1.

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 0 & S = 1: S = 1 & assume Q = 0 Q = 1. S = 1 & assume Q = 1 Q = 0. R = 0 & assume Q = 0 Q = 1. R = 0 & assume Q = 1 Q = 1.

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 0 & S = 1: S = 1 & assume Q = 0 Q = 1. S = 1 & assume Q = 1 Q = 0. R = 0 & assume Q = 0 Q = 1. consistent R=0 & S=1 Q=0 & Q=1 R = 0 & assume Q = 1 Q = 1.

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 1 & S = 0: The opposite of R = 0 & S = 1 by symmetry.

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 1 & S = 1: S = 1 & assume Q = 0 Q = 1. S = 1 & assume Q = 1 Q = 0. R = 1 & assume Q = 0 Q = 1. R = 1 & assume Q = 1 Q = 0.

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 1 & S = 1: S = 1 & assume Q = 0 Q = 1. S = 1 & assume Q = 1 Q = 0. R = 1 & assume Q = 0 Q = 1. consistent R=1 & S=1 Q=1 & Q=0 consistent R=1 & S=1 Q=0 & Q=1 R = 1 & assume Q = 1 Q = 0.

How does a flip-flop work? Basic flip-flop: the SR latch Logic table Q 0 = value before S&R changes R = 1 & S = 1: S = 1 & assume Q = 0 Q = 1. S = 1 & assume Q = 1 Q = 0. R = 1 & assume Q = 0 Q = 1. R = 1 & assume Q = 1 Q = 0. consistent R=1 & S=1 Q=1 & Q=0 consistent R=1 & S=1 Q=0 & Q=1 Two settings are possible i.e. flip-flop keeps its state.

SR Latch Switch Debouncer SR latch flip-flops are not used much for memory, but they are used for debouncing switches. Switch Bounce: When a switch is toggled it will not go smoothly from HIGH to LOW, or vice versa. Volts bouncing switch Volts debounced switch time time R +5V R

Clocked D-type Latch S Logic table R Clock Circuit Analysis: C = 1 & D = 1 S = 0 & R = 1. C = 1 & D = 0 S = 1 & R = 0. C = 0 & D = 1 S = 1 & R = 1. C = 0 & D = 0 S = 1 & R = 1.

Clocked D-type Latch S Logic table R Clock Circuit Analysis: C = 1 & D = 1 S = 0 & R = 1. C = 1 & D = 0 S = 1 & R = 0. C = 0 & D = 1 S = 1 & R = 1. C = 0 & D = 0 S = 1 & R = 1. Clock HIGH: D sets the flip-flop state Clock LOW: flip-flop state is locked

Clocked D-type Latch input D Q output Logic table clock Q Clock Circuit Analysis: C = 1 & D = 1 S = 0 & R = 1. C = 1 & D = 0 S = 1 & R = 0. C = 0 & D = 1 S = 1 & R = 1. C = 0 & D = 0 S = 1 & R = 1. Clock HIGH: D sets the flip-flop state Clock LOW: flip-flop state is locked

Master-Slave D-type Flip-Flop Note: The flip-flop triggers on a the falling edge of the clock.

74LS74 D-type edge-triggered flip-flop [Texas Instruments 74LS74 flip-flop datasheet] Both PRE and CLR behave like S and R inputs, respectively, on the SR latch. IMPORTANT: Both PRE and CLR must be high for normal D-type operation. Note: The flip-flop triggers on the rising edge of the clock.

74LS74 D-type edge-triggered flip-flop input D PRE Q output [Texas Instruments 74LS74 flip-flop datasheet] clock CLR Q Both PRE and CLR behave like S and R inputs, respectively, on the SR latch. IMPORTANT: Both PRE and CLR must be high for normal D-type operation. Note: The flip-flop triggers on the rising edge of the clock.

JK-type flip-flop Logic table for clock falling edge input J Q output J K Q n+1 clock input K C Q 0 1 0 1 0 0 1 1 Q n 0 1 Q n JK-type flip-flops are used in counters.

Flip-flops in FPGAs Architecture of a single Logic Element inputs clock signals LUT CLOCK triggers Memory (a few bits) global local outputs feedback Frequently a D-type Flip-Flop FPGAs are already set-up for synchronous circuit designs

Flip-flops in FPGAs Architecture of a single Logic Element inputs clock signals LUT CLOCK triggers Memory (a few bits) global local outputs feedback Frequently a D-type Flip-Flop FPGAs are already set-up for synchronous circuit designs

Synchronous programming in Verilog (I)

Synchronous programming in Verilog (I) Clock variable output register (i.e. flip-flop memory )

Synchronous programming in Verilog (I) Clock variable output register (i.e. flip-flop memory ) Read as always at the positive clock edge do the following always is the core command for synchronous programming, it should be used as frequently as possible. assign should be used as little as possible. It is only useful for DC- type signals (signals that don t change).

Synchronous programming in Verilog (II) Quartus II circuit simulation

Synchronous programming in Verilog (II) Quartus II circuit simulation Clock Line No more glitches

How did the FPGA implement the circuit? Tools > Netlists > Technology Map Viewer

How did the FPGA implement the circuit? Tools > Netlists > Technology Map Viewer D-type edge-triggered flip-flops

Always use always _ A. Stummer, U. of Toronto.

Parallel programming in Verilog The always structure is used for exploiting the parallel processing features of the FPGA. Parallel processing must almost always be synchronous if several processes exchange data. Parallel and Sequential processing examples: Sequential always@ (negedge clock) begin a = b; c = a; end Parallel always@ (negedge clock) begin a <= b; c <= a; end

Parallel programming in Verilog The always structure is used for exploiting the parallel processing features of the FPGA. Parallel processing must almost always be synchronous if several processes exchange data. Parallel and Sequential processing examples: Sequential always@ (negedge clock) begin a = b; c = a; end Parallel always@ (negedge clock) begin a <= b; c <= a; end executed simultaneously c = b a = b c = a (previous value)