Design Example: 4-bit Sequence Detector

Similar documents
FSM model for sequential circuits

L10 State Machine Design Topics

15.1 Elimination of Redundant States

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.

Synchronous Sequential Circuit Design

Counters. We ll look at different kinds of counters and discuss how to build them

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Lecture 8: Sequential Networks and Finite State Machines

CSE370 HW6 Solutions (Winter 2010)

Analysis of Clocked Sequential Circuits

Week-5. Sequential Circuit Design. Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.

12. Finite State Machine Design

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

EECS150 - Digital Design Lecture 23 - FSMs & Counters

CprE 281: Digital Logic

Introduction to Karnaugh Maps

Lecture 10: Synchronous Sequential Circuits Design

Finite State Machine (FSM)

IE1204 Digital Design. L10: State Machines (Part 2) Masoumeh (Azin) Ebrahimi Elena Dubrova

Sequential logic and design

Lecture 13: Sequential Circuits, FSM

Lecture 14 Finite state machines

ELE2120 Digital Circuits and Systems. Tutorial Note 10

Digital Logic Design - Chapter 5

Chapter 6. Synchronous Sequential Circuits

You separate binary numbers into columns in a similar fashion. 2 5 = 32

ELCT201: DIGITAL LOGIC DESIGN

Different encodings generate different circuits

Lecture 13: Sequential Circuits, FSM

Design at the Register Transfer Level

Sequential Circuit Design

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Clocked Synchronous State-machine Analysis

Finite State Machine. By : Ali Mustafa

EGR224 F 18 Assignment #4

Present Next state Output state w = 0 w = 1 z A A B 0 B A C 0 C A C 1

6 Synchronous State Machine Design

Timing Constraints in Sequential Designs. 63 Sources: TSR, Katz, Boriello & Vahid

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

Latches. October 13, 2003 Latches 1

Models for representing sequential circuits

Unit 8: Sequ. ential Circuits

Chapter 1 Review of Equations and Inequalities

Introduction to Digital Logic

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

Lab 5 The Green House Effect Pre-lab

Synchronous Sequential Circuit

Getting Started with Communications Engineering

Clocked Sequential Circuits UNIT 13 ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS. Analysis of Clocked Sequential Circuits. Signal Tracing and Timing Charts

or 0101 Machine

Logical design of digital systems

Conceptual Explanations: Radicals

Module 10: Sequential Circuit Design

14:332:231 DIGITAL LOGIC DESIGN

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

Menu. EEL3701 Classical Design

CSE 140: Components and Design Techniques for Digital Systems. Lecture 9: Sequential Networks: Implementation

CS 124 Math Review Section January 29, 2018

Analysis and Design of Sequential Circuits: Examples

Sequential Circuit Analysis

FSM Optimization. Counter Logic Diagram Q1 Q2 Q3. Counter Implementation using RS FF 10/13/2015

State Graphs FSMs. Page 1

Computational Boolean Algebra. Pingqiang Zhou ShanghaiTech University

Sequential Logic Optimization. Optimization in Context. Algorithmic Approach to State Minimization. Finite State Machine Optimization

CS/EE 181a 2008/09 Lecture 4

Digital Circuit Engineering

EECS 270 Midterm 2 Exam Answer Key Winter 2017

Logic Design II (17.342) Spring Lecture Outline

[Disclaimer: This is not a complete list of everything you need to know, just some of the topics that gave people difficulty.]

Adders allow computers to add numbers 2-bit ripple-carry adder

Written exam with solutions IE1204/5 Digital Design Friday 13/

The Geometry of Consciousness

Synchronous Sequential Circuit Design. Digital Computer Design

Lecture (08) Synchronous Sequential Logic

CPSC 340: Machine Learning and Data Mining

Mealy & Moore Machines

University of Guelph School of Engineering ENG 2410 Digital Design Fall There are 7 questions, answer all questions.

Chapter 3. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 3 <1>

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

Chapter 7. Synchronous Sequential Networks. Excitation for

Getting Started with Communications Engineering. Rows first, columns second. Remember that. R then C. 1

Digital Circuit Engineering

Lesson 3-2: Solving Linear Systems Algebraically

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

ECE20B Final Exam, 200 Point Exam Closed Book, Closed Notes, Calculators Not Allowed June 12th, Name

CARLETON UNIVERSITY Final rev EXAMINATION Fri, April 22, 2005, 14:00

Vectors for Zero Robotics students

CS/EE 181a 2010/11 Lecture 4

8. TRANSFORMING TOOL #1 (the Addition Property of Equality)

Final Exam. ECE 25, Spring 2008 Thursday, June 12, Problem Points Score Total 90

Calculus II. Calculus II tends to be a very difficult course for many students. There are many reasons for this.

Algebra Exam. Solutions and Grading Guide

6. Finite State Machines

ECE380 Digital Logic. Synchronous sequential circuits

Time Allowed 3:00 hrs. April, pages

Lecture 10: Sequential Networks: Timing and Retiming

Fundamentals of Digital Design

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring

Digital Design. Sequential Logic

A tricky node-voltage situation

Transcription:

Design Example: 4-bit Sequence Detector We are asked to design a 4-bit sequence detector. For each 4 bits that are input, we need to see whether they match one of two given sequences: 1010 or 0110. The bits are input one at a time, so we can t see all 4 bits at once. This sort of situation might arise for a simple code lock, where the user must enter the correct 4 bits to open the lock. If the user doesn t input the correct 4 bits, they must start over. Or, it might be used in a simple communication system which receives bits off a line one at a time, and the word size is 4 bits. In this case, the patterns might be start and stop signals, or some other communication protocol-related information. The input is defined as X. Thus, the value of X is the value of the input line in a given clock cycle. The output, Y, goes high for 1 clock cycle as soon as it receives the 4 th bit that matches a pattern. We have only one input and only one output, so we don t need to use ASM charts. We can use a simple state diagram. Note that because the output must go high as soon as the 4 th matching bit is received, we need this to be a Mealy machine. Also, note that in this example, when we are looking for 1010, we assume the most significant bit is the first bit received, so the order of the inputs would be 1-0-1-0, not 0-1-0-1. Our state machine starts in a state in which we have received no bits. We will call this state START. The state transitions will be depending on whether the input X is a 0 or 1 we can essentially use the states to record which values have been received. If the input is 0, we transition to a state called S0; if X is 1, we transition to S1. These states are named after the value received in the previous clock cycle. From each of S0 and S1, we can likewise go to new states based on the value of X. If in S0, and X is 0, we go to state S00; if X is 1, we go to state S01. Similarly, if in S1, and X is 0, we go to state S10; if X is 1, we go to state S11. Again, the states are named after the two previously received values. Now, each of those four states can again go to one of two possible states, based on the value of X. The states are S000, S001, S010, S011, S100, S101, S110, S111. At this point, the state machine knows we have received 3 bits, and knows what those 3 bits are. When it receives the next bit, it can determine whether a matching sequence was input, or whether we need to restart. Copyright 2003 by Andrew W. H. House Page 1 of 6

So, S000, S001, S010, S100, S110, and S111 all transition back to START and output 0, no matter what the input, because none of those states correspond to having received the first 3 bits of sequences 0110 or 1010. States S011 and S101, however, do depend on the input. They both still transition back to START, but if the input is 0, the output is 1. Otherwise, the output remains 0. Thus the state machine meets our design requirements. We can see the transitions in the following table. Current State Input X Output Y Next State START 0 0 S0 1 0 S1 S0 0 0 S00 1 0 S01 S1 0 0 S10 1 0 S11 S00 0 0 S000 1 0 S001 S01 0 0 S010 1 0 S011 Copyright 2003 by Andrew W. H. House Page 2 of 6

S10 0 0 S100 1 0 S101 S11 0 0 S110 1 0 S111 S000 x (don t care) 0 START S001 x (don t care) 0 START S010 x (don t care) 0 START S011 0 1 START 1 0 START S100 x (don t care) 0 START S101 0 1 START 1 0 START S110 x (don t care) 0 START S111 x (don t care) 0 START So we have a state machine that has 15 states. 15 states is quite a lot. This requires at least 4 state variables (i.e. 4 flip-flops). If using one-hot design, there will be 15 flip-flops! Maybe we can reduce the number of states. We try to apply state reduction look for redundancy or unnecessary repetition in the diagram or state table. We don t necessarily care that the system knows what it has received exactly, so long as it sets the output appropriately to indicate a matching sequence has been detected. First, we notice that everything from S00 down and S11 down is identical. That is, the state machine behaves exactly the same after this point, with respect to receiving 0 and 1. So why not combine S00 and S11 and thus we can get rid of 3 states that way. So we combine them into S00_11, and the 2 states after become S110_000 and S111_001. We can see this in the diagram below. Copyright 2003 by Andrew W. H. House Page 3 of 6

Now, we can also see that S01 and S10 are followed by the exact same structure. This is because the last 2 bits of the sequences we re looking for are the same 0110 and 1010. So we can combine this states, too, getting S01_10 which leads to S100_010 and S101_011. This gets rid of another 3 states. See the diagram below. Copyright 2003 by Andrew W. H. House Page 4 of 6

So now we have only 9 states. Can we reduce more? Notice that now we have two branches of states, those which might be leading to a possible sequence match, and those which are definitely wrong. For the branches that are definitely wrong, we don t need to bother with going to different states depending on whether 1 or 0 is input we just need to go to another state in the wrong path. Combining all the wrong states into a single wrong path can save us a few more states, as seen below. Now we have only 7 states. That is less than half of what we started with, and we now only need 3 flip-flops instead of 4. The state table is simpler, as is the implementation. We can now write out our state table and excitation table. We ll use 3 D-type flip-flops (C k, B k, and A k ) and assign START = 000, S0 = 001, S1 = 010, S10_01 = 011, S11_00 = 100, S101_011 = 101, and SREST = 110. Current State C k B k A k Input X Output Y Next State C k+1 B k+1 A k+1 START 000 0 0 S0 001 1 0 S1 010 Copyright 2003 by Andrew W. H. House Page 5 of 6

S0 001 0 0 S11_00 100 1 0 S10_01 011 S1 010 0 0 S10_01 011 1 0 S11_00 100 S10_01 011 0 0 SREST 110 1 0 S101_011 101 S11_00 100 x (don t care) 0 SREST 110 S101_011 101 0 1 START 000 1 0 START 000 SREST 110 x (don t care) 0 START 000 From the table we get our equations. C k+1 = S10_01 + S11_00 + S0@X = C k @B k @A k + C k @B k @A k + C k @B k @A k @X B k+1 = S10_01@X + S11_00 + S0@X + S1@X + START@X = C k @B k @A k @X + C k @B k @A k + C k @B k @A k @X + C k @B k @A k @X + C k @B k @A k @X A k+1 = S10_01@X + S0@X + S1@X + START@X = C k @B k @A k @X + C k @B k @A k @X + C k @B k @A k @X + C k @B k @A k @X We can probably simplify the above. Also, our output is simple. Y = S101_011@X = C k @B k @A k @X And so we have completed design of our sequence detector and used state reduction. Class notes by Andrew W. H. House, 02 December 2003. Copyright 2003 by Andrew W. H. House Page 6 of 6