CSCI 2150 Intro to State Machines

Similar documents
Chapter 5 Synchronous Sequential Logic

Learning Objectives:

Sequential Circuit Analysis

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Lecture 14 Finite state machines

Design of Sequential Circuits

Q: Examine the relationship between X and the Next state. How would you describe this circuit? A: An inverter which is synched with a clock signal.

Lecture 10: Synchronous Sequential Circuits Design

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

WORKBOOK. Try Yourself Questions. Electrical Engineering Digital Electronics. Detailed Explanations of

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

Read this before starting!

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

Time Allowed 3:00 hrs. April, pages

Read this before starting!

Computers also need devices capable of Storing data and information Performing mathematical operations on such data

Lecture 17: Designing Sequential Systems Using Flip Flops

Sequential Circuits Sequential circuits combinational circuits state gate delay

Latches. October 13, 2003 Latches 1

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

Exam for Physics 4051, October 31, 2008

Read this before starting!

Total time is: 1 setup, 2 AND, 3 XOR, 1 delay = (1*1) + (2*2) + (3*3) + (1*1) = 15ns

Philadelphia University Student Name: Student Number:

14.1. Unit 14. State Machine Design

Finite State Machine. By : Ali Mustafa

CSE370 HW6 Solutions (Winter 2010)

ELE2120 Digital Circuits and Systems. Tutorial Note 9

Lecture 13: Sequential Circuits, FSM

Design at the Register Transfer Level

Roger L. Tokheim. Chapter 8 Counters Glencoe/McGraw-Hill

6 Synchronous State Machine Design

The Karnaugh Map COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

Memory Elements I. CS31 Pascal Van Hentenryck. CS031 Lecture 6 Page 1

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

Section 001. Read this before starting!

Fundamentals of Digital Design

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

CS/COE1541: Introduction to Computer Architecture. Logic Design Review. Sangyeun Cho. Computer Science Department University of Pittsburgh

Chapter 3 Digital Logic Structures

Logic Design II (17.342) Spring Lecture Outline

Read this before starting!

Synchronous Sequential Logic

DE58/DC58 LOGIC DESIGN DEC 2014

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

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

Lecture 13: Sequential Circuits, FSM

Logic design? Transistor as a switch. Layered design approach. CS/COE1541: Introduction to Computer Architecture. Logic Design Review.

Synchronous Sequential Circuit Design. Digital Computer Design

1.10 (a) Function of AND, OR, NOT, NAND & NOR Logic gates and their input/output.

Digital Circuits and Systems

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

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

ELCT201: DIGITAL LOGIC DESIGN

SYNCHRONOUS SEQUENTIAL CIRCUITS

Review for B33DV2-Digital Design. Digital Design

CprE 281: Digital Logic

Simplifying Logic Circuits with Karnaugh Maps

Lecture (08) Synchronous Sequential Logic

MA 3260 Lecture 10 - Boolean Algebras (cont.) Friday, October 19, 2018.

Digital Logic Design. Midterm #2

Practice Final Exam Solutions

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

Philadelphia University Student Name: Student Number:

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

T02 Tutorial Slides for Week 6

CS/COE0447: Computer Organization

PAST EXAM PAPER & MEMO N3 ABOUT THE QUESTION PAPERS:

Sequential Logic Circuits

Analysis of clocked sequential networks

Sequential Logic (3.1 and is a long difficult section you really should read!)

Vidyalankar S.E. Sem. III [ETRX] Digital Circuits and Design Prelim Question Paper Solution

Digital Electronics Sequential Logic

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

Lecture 8: Sequential Networks and Finite State Machines

1 Boolean Algebra Simplification

Sequential Logic. Rab Nawaz Khan Jadoon DCS. Lecturer COMSATS Lahore Pakistan. Department of Computer Science

CSC9R6 Computer Design. Practical Digital Logic

Lecture 13: Sequential Circuits

10/12/2016. An FSM with No Inputs Moves from State to State. ECE 120: Introduction to Computing. Eventually, the States Form a Loop

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

ECE 341. Lecture # 3

CPE100: Digital Logic Design I

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Outcomes. Unit 14. Review of State Machines STATE MACHINES OVERVIEW. State Machine Design

CS221: Digital Design. Dr. A. Sahu. Indian Institute of Technology Guwahati

State Machines ELCTEC-131

Arithme(c logic units and memory

EET 310 Flip-Flops 11/17/2011 1

CSC258: Computer Organization. Digital Logic: Transistors and Gates

EE 209 Spiral 1 Exam Solutions Name:

CS/COE0447: Computer Organization

Topics for Lecture #9. Button input processor

Chapter 7 Logic Circuits

Chapter 4. Sequential Logic Circuits

Digital Circuit Engineering

Gates and Flip-Flops

Transcription:

CSCI 2150 Intro to State Machines Topic: Now that we've created flip-flops, let's make stuff with them Reading: igital Fundamentals sections 6.11 and 9.4 (ignore the JK flip-flop stuff) States Up until now we have been making logic circuits that rely only on binary inputs and create binary outputs. The inputs might be switches or some other external signal, but they have always been external to our circuit. With the introduction of flip-flops, we are going to add an additional input to the system: the internal. I don't know if the figure below helps, but basically we will be adding memory to our logic circuits. There will be logic that will set the memory, and the memory will be used as an additional input to the logic. Previous New Logic Circuit Gates Logic Circuit Gates Current So what is a? A defines the current condition of the system. For example, when we talked about the traffic signal system having two directions, North-South and East-West, and that there are certain combinations of lights (on or off) that describe the intersection's "condition", we were talking about s. N-S E-W N-S E-W N-S E-W N-S E-W State 0 State 1 State 2 State 3 It might be as simple as a light bulb. The light bulb can have two s: on and off. The light switch moves the condition of the bulb from one to another. Switch goes on OFF Switch goes off Any logic circuit possessing s (conditions held in a memory) with inputs that can move the system from one to the next is called a machine. ON

CSCI 2150 -- Intro to State Machines Page 2 State iagrams So how will we represent these s and the inputs that move the logic from one to another? We use a diagram. A diagram models the machine using a circle to represent the and arrows to represent transitions between the s. For example, our light bulb machine from the previous example would look like: OFF ON Actually, this diagram is still hiding some information. For example, what input values change the system from one to the other? Second, although the words ON and OFF mean something to you, they don't mean much to a computer. We need to include the boolean output associated with each of the s. Let's try this diagram again. OFF 0 Switch = 1 Switch = 0 ON 1 The upper half of each circle indicates our "name" for the. The lower half indicates an output, in our case a 0 for the light bulb off and a 1 for the light bulb on. The arrows along with the input value say, when we are in "OFF" and the switch input goes to a 1, move to "ON". When we are in "ON" and the switch input goes to a 0, move to "OFF". Let's do a slightly more complicated example. There is a simple device used in many digital circuits called a counter. Its output is simply a number, and as time goes on, the number is incremented (counting up) or decremented (counting down). clock direction Binary Counter binary number The inputs are clock and direction. Clock drives the counting. Every time a pulse occurs, it increments or decrements the counter. irection tells the system whether the binary number is to be incremented or decremented. The binary number is the. For example, if the output from the counter is the binary number 0110 and a clock pulse occurs, the binary number changes to 0101 if direction=0 and 0111 if the direction=1. Let's design the diagram for a two-bit up-down counter. This counter has an output that is a two-bit number, (00, 01, 10, or 11). Just like for our generic description, every time a clock pulse occurs, the counter will change to either increment or decrement the output depending on the value of direction. For example, if direction is 1, then each clock pulse will increment the output through the series 00, 01, 10, 11, 00, 01, etc. If direction is 0, then the output will decrement once for each clock pulse, i.e., 00, 11, 10, 01, 00, 11, etc. So what are our inputs? irection of course. Some might say that the clock is also an input, and they would be correct. We will leave clock out for now since the clock will simply be used to tell us when to transition s. (Hopefully this will make more sense later on.)

CSCI 2150 -- Intro to State Machines Page 3 So what are our outputs? The two bit binary number, right? So what are all the possible s? For this system, it seems relatively straightforward. Each possible two-bit value that can be output from the circuit represents one of the conditions of the circuit. Therefore, there are four s: State 0 -- outputting 00 and waiting to increment to 01 or decrement to 11 State 1 -- outputting 01 and waiting to increment to 10 or decrement to 00 State 2 -- outputting 10 and waiting to increment to 11 or decrement to 01 State 3 -- outputting 11 and waiting to increment to 00 or decrement to 10 So we can begin with our basic diagram without the transistions. 0 00 1 01 3 11 2 10 Next, we need to connect them with each possible transition. Remember, from 0 we can go to either 1 or 3 depending on the value of direction. So we can add those transitions to our diagram. Note that direction has been replaced with so that the diagram doesn't become so cluttered. 0 00 1 01 3 11 2 10 Now, let's fill in all the rest of the transitions. 0 00 1 01 3 11 2 10

CSCI 2150 -- Intro to State Machines Page 4 If the input, then the counter will increment once for each clock pulse thereby going clockwise through the s of the diagram. If the input, then the counter will decrement counterclockwise through the s. Therefore, to create a diagram, you must completely define the system to be designed. This involves defining all of the following: inputs outputs s transitions between s based on inputs Representing States With Flip-Flops So what is it that the machine must remember? Its! Therefore, we need to have two things: some way of representing the system's using binary values, and some way to hold those values with flip-flops. Let's start with the representation part. I'm going to use the two-bit up-down counter and create a table with a list of those s. Then, I'm going to number those s with a binary number. State's States assigned number name Number MSB LSB State 0 0 0 0 State 1 1 0 1 State 2 2 1 0 State 3 3 1 1 From this table you can see that there are four s. How many bits does it take to represent 4 s? 2 (Remember that 2 n is the number of possible combinations of n bits? Therefore, if n=2, then that is 4 possible combinations.) I'm going to interrupt here briefly to revisit the block diagram of the machine. Below is a more detailed drawing of the machine showing exactly how the current is contained in flip-flops, logic determines the next from the current and the external inputs, and additional logic determines the output from the current. Next Current External inputs Logic (etermines next ) Flip-flops output-ting the current Logic (etermines output from ) Outputs So if it takes two bits to represent the of the machine, then we need to have 2 flip-flops to remember that. Therefore, our system is going to look something like this:

CSCI 2150 -- Intro to State Machines Page 5 irection Next MSB MSB of Counter output Logic Next LSB LSB of Clock Creating a Next State Truth Table The first step in implementing a machine is to create the logic for the "next ". In otherwords, the combination of the current and the current inputs sends the system to what? We begin with a truth table. What are the inputs to the system? In the case of the up-down counter, they are the direction and the current. The table below uses those inputs as the truth table for determining the next of the system. Current irection 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Next S1' S0' Note that MSB has been replaced with S1 and LSB has been replaced with S0. The next of these bits is now represented with a "prime" notation (e.g., next of S0 is S0'). So, for the current of 00 ( 0) and a direction of 0 (counting down), what is the next? Reviewing the diagram, we see that the next would be 11. Therefore, fill in the truth table to reflect that.

CSCI 2150 -- Intro to State Machines Page 6 Current irection Next S0 S1 S0' S1' 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 oing this for the rest of the rows, each time relying on the original diagram to guide us, we should be able to fill out the rest of the truth table. Current irection Next S1' S0' 0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 1 0 1 0 1 1 1 0 0 We can then break this truth table into a single truth table for each of the outputs (next s S1' and S0'). Current irection S1' Current irection S0' 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 0 0 0 1 0 0 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 1 1 1 0 1 1 1 0 Wow, we have truth tables. And these truth tables hopefully represent the next of our two flipflops. Now what? Well, from truth tables, we can always create Karnaugh maps in order to move to the logic design. S 1 ' S 0 ' 1 0 00 1 0 S S 0 1 01 0 1 11 1 0 10 0 1 S 1 S 0 0 1 00 1 1 01 0 0 11 0 0 10 1 1

CSCI 2150 -- Intro to State Machines Page 7 Next, we need to draw the rectangles. S 1 ' 1 0 00 1 0 S S 0 1 01 0 1 11 1 0 10 0 1 S 0 ' 0 1 S 1 S 0 00 1 1 01 0 0 11 0 0 10 1 1 S1' looks pretty ugly. (We've seen this horrible rectangle combination before. You can try, but I don't think you'll find a more complex arrangement of rectangles to create more terms in the SOP expression.) From these rectangles, we can derive the minimum sum of products expressions. S 1 ' = S 1 S 0 + S 1 S 0 + S 1 S 0 + S 1 S 0 S 0 ' = S 0 And from these equations, we can draw the following logic diagram. irection () S 1 ' S 1 S 0 ' S 0 Clock