FPGA Implementation of Sequential Logic

Similar documents
EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

ECE 301 Digital Electronics

WEEK 10. Sequential Circuits: Analysis and Design. Page 1

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

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

Performance Evolution of 16 Bit Processor in FPGA using State Encoding Techniques

Universidad Carlos III de Madrid Digital Electronics Exercises

Chapter 5 Synchronous Sequential Logic

Lecture 11: Synchronous Sequential Logic

Synchronous Sequential Logic. Chapter 5

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

2 Sequential Circuits

ELCT201: DIGITAL LOGIC DESIGN

D Latch (Transparent Latch)

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

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

Digital Logic Design I

Asynchronous (Ripple) Counters

Chapter 5: Synchronous Sequential Logic

Sequential Logic Circuits

Synchronous Sequential Logic

Combinational / Sequential Logic

Digital Fundamentals: A Systems Approach

Problems with D-Latch

Introduction to Computer Engineering EECS dickrp/eecs203/

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

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

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

Synchronous Sequential Logic

Digital Circuit Engineering

More design examples, state assignment and reduction. Page 1

Chapter 5 Synchronous Sequential Logic

CS 261 Fall Mike Lam, Professor. Sequential Circuits

L5 Sequential Circuit Design

Fall 2000 Chapter 5 Part 1

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

Unit 11. Latches and Flip-Flops

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

Faculty of Electrical & Electronics Engineering BEE3233 Electronics System Design. Laboratory 3: Finite State Machine (FSM)

Experiment 8 Introduction to Latches and Flip-Flops and registers

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

P U Q Q*

CHAPTER 6 COUNTERS & REGISTERS

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

CSC258: Computer Organization. Combinational Logic

Practice Homework Problems for Module 3

Flip-Flops and Sequential Circuit Design

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Chapter 3. Boolean Algebra and Digital Logic

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.

Introduction to Microprocessor & Digital Logic

Chapter 5. Introduction

CS8803: Advanced Digital Design for Embedded Hardware

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

Principles of Computer Architecture. Appendix A: Digital Logic

Synchronous Sequential Logic

The reduction in the number of flip-flops in a sequential circuit is referred to as the state-reduction problem.

L11/12: Reconfigurable Logic Architectures

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


Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

Analysis of Clocked Sequential Circuits

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Why FPGAs? FPGA Overview. Why FPGAs?

Registers and Counters


Microprocessor Design

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

ENGG 1203 Tutorial. D Flip Flop. D Flip Flop. Q changes when CLK is in Rising edge PGT NGT

Previous Lecture Sequential Circuits. Slide Summary of contents covered in this lecture. (Refer Slide Time: 01:55)

Advanced Digital Logic Design EECS 303

ASYNCHRONOUS COUNTER CIRCUITS

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

In this lecture we will work through a design example from problem statement to digital circuits.

Chapter 3 Unit Combinational

ENGN3213 Digital Systems and Microprocessors Sequential Circuits

Synchronous Sequential Logic

CHAPTER 4: Logic Circuits

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

Dr.Mohamed Elmahdy Winter 2015 Eng.Yasmin Mohamed. Problem Set 6. Analysis and Design of Clocked Sequential Circuits. Discussion: 7/11/ /11/2015

CHAPTER 4: Logic Circuits

LAB #4 SEQUENTIAL LOGIC CIRCUIT

Digital Electronics II 2016 Imperial College London Page 1 of 8

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

Introduction to Digital Logic Missouri S&T University CPE 2210 Exam 2 Logistics

EECS 270 Midterm 2 Exam Closed book portion Fall 2014

Modeling Latches and Flip-flops

Course Administration

Chapter 5 Sequential Systems. Introduction

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

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

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

Computer Architecture and Organization

Logic Design II (17.342) Spring Lecture Outline

Outline. Introduction to number systems: sign/magnitude, ones complement, twos complement Review of latches, flip flops, counters

MODEL QUESTIONS WITH ANSWERS THIRD SEMESTER B.TECH DEGREE EXAMINATION DECEMBER CS 203: Switching Theory and Logic Design. Time: 3 Hrs Marks: 100

Combinational vs Sequential

Introduction to Sequential Circuits

`COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

Switching Circuits & Logic Design, Fall Final Examination (1/13/2012, 3:30pm~5:20pm)

Transcription:

ECE 428 Programmable ASIC Design FPGA Implementation of Sequential Logic Haibo Wang ECE Department Southern Illinois University Carbondale, IL 62901 8-1

Sequential Circuit Model Combinational Circuit: the circuit outputs are a logic combination of the current inputs signals. Sequential Circuit: the circuit outputs depend on not only the current values of inputs but also previous input values. Circuit inputs Combinational Circuits Circuit outputs clock Storage elements A model for sequential circuits 8-2

Storage Elements in Xilinx CLB Each CLB contains two edge-triggered D flip-flops. They can be configured as positive-edge-triggered or negative-edge-triggered. Each D flip-flop has clock enable signal E, which is active high. Each D flip-flop can be set or reset by SR signal. A global reset or reset signal is also available for set or reset all D flip-flops once the device is powered up. 8-3

Circuit Techniques to Avoid Clock Glitches If possible, try to avoid connecting the output of combinational logic to D flip-flop clock input. Enable Clock D E Q Clock Enable Output 8-4

FPGA Implementation of Finite State Machines Example of Finite State Machine xx S3 Current States Inputs: xy 0x 10 11 Outputs a b c d e 10 S0 0x 11 0x S0 S3 S1 S2 0 0 1 1 1 S1 S2 S2 S2 0 1 0 1 1 S2 S3 S1 S2 1 0 0 1 0 S3 S3 S3 S3 0 0 0 0 0 S1 xx S2 11 State Table 10 State transition diagram Note: this is a Moore-type machine. The design procedure for mealy-type machine is similar. 8-5

State Encoding Binary encoding: minimum number of D flip-flops Q1Q0 S0 : 0 0 S1 : 0 1 S2 : 1 0 S3 : 1 1 It needs two D flip-flps One-hot encoding: one D flip-flop for each state Q3Q2Q1Q0 S0 : 0 0 0 1 S1 : 0 0 1 0 S2 : 0 1 0 0 S3 : 1 0 0 0 It needs four D flip-flps 8-6

Implementation Using Binary Encoding Excitation table Inputs Current States Next States Outputs x y Q1 Q0 D1 D0 a b c d e 0 x 0 0 1 1 0 0 1 1 1 0 x 0 1 1 0 0 1 0 1 1 0 x 1 0 1 1 1 0 0 1 0 0 x 1 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 1 1 0 0 1 1 0 0 1 0 1 1 1 0 1 0 0 1 1 0 0 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 0 0 0 0 0 8-7

Implementation Using Binary Encoding Combinational functions needed to be implemented D1 = x + y + Q0 (F1) D0 = Q1 Q0 + y Q0 + x Q0 (F2) a = Q1 Q0 (F3) b = Q1 Q0 (F4) c = Q1 Q0 (F5) d = Q0 + Q1 (F6) e = Q1 (F7) 8-8

Implementation Using Binary Encoding FPGA implementation Reset y 1 x CLB LUT F1 D Q Q1 e CLB F3, F4 b a y x LUT F2 D Q Q0 CLB F5, F6 c d Clk It needs three CLBs 8-9

Implementation Using One-Hot Encoding The next state and output functions have a simple, systematic form Next state function D Output function i = Q j ( I j, 1 + I j,2 + + I j, n) D i is the input of the D flip-flop that represents state S i Q j is the output of the D flip-flop that represent state S j I j,1, I j,2,.. and I j,n denote all input combinations that cause a state transition from S j to S i z k = Qk, 1 + Qk,2 + + Qk, m z i is an FSM output Q k,1, Q k,2,.. and Q k,m denote all states (D flip-flip outputs) that cause output z k to be 1 8-10

Implementation Using One-Hot Encoding Combinational functions needed to be implemented D0 = 0 (F1) D1 = Q0 x y + Q2 x y (F2) D2 = Q0 x y + Q1 + Q2 x y (F3) D3 = Q0 x + Q2 x + Q3 (F4) a = Q2 b = Q1 c = Q0 d = Q0+Q1+Q2 (F5) e = Q0+Q1 (F6) 8-11

Implementation Using One-Hot Encoding FPGA implementation CLB Reset 0 D Q Q0 c Q0 x y Q2 LUT F2 D Q Q1 F5, F6 b d Q0 x y Q1 Q2 Q0 x Q2 Q3 LUT LUT F4 LUT CLB F3 D D Q Q Q2 Q3 CLB It needs three CLBs e a Clock 8-12

Selecting FSM Coding in Xilinx ISE 8-13

Comparison of Binary Encoding and One-Hot Encoding Binary encoding Fewer flip-flops It normally needs complicated combinational logic to determine next state and output signals. The complicated logic may decrease circuit performance. May have glitches One-hot encoding More flip-flops It normally has simple combinational logic for next state transitions and output signals. It is suitable for high performance system design. It is unlikely to have glitches. FPGAs have plenty of flip-flops. Thus, it is preferred to use one-hot encoding in FPGA FSM implementations. 8-14

Possible Glitches in Binary-Encoded FSMs Desired transition 10 10 01 10 11 Actual transition 01 11 10 If 11 is a legal state and certain operations are associated with state 11, the glitch may cause unwanted circuit operation In one-hot encoding, 11 is not a legal state and, hence, it will not trigger unwanted circuit operations. D Q D Q Q1 Q0 O Glitch CLK delay 8-15

Possible Lock-up States in Binary-Encoded FSMs When unused states exist in a binary-encoded FSM, make sure there are no lock-up states. Example: for a three state FSM, it needs two D flip-flops to implement binary encoding scheme. Assume 01, 10, 11 are the three used states. 00 is the unused state, make sure that FSM will not be trapped in 00 state. 01 10 11 00 Lock-up state 01 10 11 00 Not a lock-up state Used states Unused state Used states Unused state To avoid lock-up states, make sure the FSM will eventually move from any unused state to an used state. Another method is to use reset (or set) signals to reset (or set) FSM to an used state (initial state) after power-up. 8-16

Implement Complex FSM using embedded Memories Latest FPGAs often contain embedded memories. Complicated FSMs can be implemented by using the embedded memories. memory FSM inputs DFF Previous inputs Previous states decoder Current state FSM outputs clock FSM outputs It is similar to the microprogram mechanism used in CISC computers. 8-17

Example: memory-based FSM implementation Example FSM on slide 8-5 Use the state encoding shown on slide 8-7 Circuit hardware (for clocked memory, the DFFs are not needed) FSM inputs DFF x A3 y A2 A1 Mem. Size: 16 x 7 A0 clock decoder memory d6 d5 d4 d3 d2 d1 d0 Q1 Q0 a b c d e FSM outputs 8-18

Example: memory-based FSM implementation Date stored in memory (note the difference from the table on slide 8-7) Address Memory Content A3(x) A2(y) A1(Q1) A0(Q0) d6(q1) d5(q0) d4(a) d3(b) d2(c) d1(d) d0(e) 0 x 0 0 1 1 0 0 0 0 0 0 x 0 1 1 0 1 0 0 1 0 0 x 1 0 1 1 0 0 0 0 0 0 x 1 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 0 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 0 0 0 0 0 8-19