FSM Word Problems Today:

Slides:



Advertisements
Similar presentations
Chapter #8: Finite State Machine Design Contemporary Logic Design
Advertisements

Chapter #8: Finite State Machine Design 8
Sequential logic examples
Chapter #10: Finite State Machine Implementation
Implementation Strategies
Finite State Machines (FSMs)
COE 202: Digital Logic Design Sequential Circuits Part 3
Sequential Circuits1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Lecture 22: Sequential Circuits Today’s topic –Clocks and sequential circuits –Finite state machines 1.
Finite State Machine Chapter 10 RTL Hardware Design by P. Chu.
No. 9-1 Chapter #9: Finite State Machine Optimization.
Modern VLSI Design 2e: Chapter 5 Copyright  1998 Prentice Hall PTR Topics n Sequential machine implementation: –clocking. n Sequential machine design.
ECE C03 Lecture 111 Lecture 11 Finite State Machine Optimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE C03 Lecture 131 Lecture 13 Finite State Machine Optimization Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design 8.5 Finite State Machine.
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
1 COMP541 State Machines Montek Singh Feb 6, 2007.
ECE C03 Lecture 121 Lecture 12 Finite State Machine Design Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
Spring 2002EECS150 - Lec0-intro Page 1 EECS150 - Digital Design Lecture 9 - Finite State Machines 1 February 19, 2002 John Wawrzynek.
1 Synchronous Sequential Circuit Design. 2 Sequential circuit design In sequential circuit design, we turn some description into a working circuit – We.
9/15/09 - L22 Sequential Circuit Design Copyright Joanne DeGroat, ECE, OSU1 Sequential Circuit Design Creating a sequential circuit to address a.
Lecture #5 In this lecture we will introduce the sequential circuits.
Lecture 23 Design example: Traffic light controller.
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Verilog for sequential machines.
11/10/ :53:59 AMweek12-3.ppt1 Intelligent Traffic Controller We want to use a finite state machine to control the traffic lights at an intersection.
ELEC 1041 Digital Electronics Tutorial: Word Problems

1 COMP541 State Machines Montek Singh Feb 8, 2012.
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Topics n Verilog styles for sequential machines. n Flip-flops and latches.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Elevator Controller We’re hired to design a digital elevator controller for a four-floor building st try: Design a counter that counts up.
EE434 ASIC & Digital Systems
1 Computer Organization Today: First Hour: Computer Organization –Section 11.3 of Katz’s Textbook –In-class Activity #1 Second Hour: Test Review.
Chapter #8: Finite State Machine Design
Chapter #8: Finite State Machine Design
ECNG1014 Digital Electronics
Chapter 10 State Machine Design. 2 State Machine Definitions State Machine: A synchronous sequential circuit consisting of a sequential logic section.
Implementing software in IEC Languages in IEC IEC uses the following languages Instruction List – Assembly level programming using.
9-1 Introduction Chapter #9: Finite State Machine Optimization.
1 Computer Organization Notes: Test 2 on Thursday TA office hours moved from Fri to Wed this week: Wed 9-11 (Mehul); Wed 12-3 (Vivek) in JEC 6119 Today:
Modern VLSI Design 4e: Chapter 5 Copyright  2008 Wayne Wolf Topics n Sequential machine implementation: –clocking. n Sequential machine design.
IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Sequential logic implementation Implementation  random logic.
IX - Sequential Logic TechnologyContemporary Logic Design1 Ch 9. Sequential Logic Technologies.
1 ENGG 1015 Tutorial Three Examples of Finite State Machines Supplementary notes Learning Objectives  Learn about Design of Finite State Machines Ack.:
Digital System Design using VHDL
Learning to Design Counters
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
ECE DIGITAL LOGIC LECTURE 21: FINITE STATE MACHINE Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/24/2015.
Finite State Machine. Clock Clock cycle Sequential circuit Digital logic systems can be classified as combinational or sequential. – Combinational circuits.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
1 Lecture 13: Sequential Circuits, FSM Today’s topics:  Sequential circuits  Finite state machines  Single-cycle CPU Reminder: midterm on Tue 10/20.
Finite state machine optimization
Chapter #8: Finite State Machine Design Contemporary Logic Design Randy H. Katz University of California, Berkeley.
© Copyright 2004, Gaetano Borriello and Randy H. Katz
COMP541 Sequential Logic – 2: Finite State Machines
ECEN 248 Lab 9: Design of a Traffic Light Controller
Synchronous Sequential Circuit Design
ELEC 1041 Digital Electronics Tutorial: Word Problems
Sequential logic examples
Lecture 13: Sequential Circuits, FSM
Introduction to Sequential Circuits
Implement FSM with fewest possible states • Least number of flip flops
Finite State Machines (FSMs)
Lecture #5 In this lecture we will introduce the sequential circuits.
Topics Verilog styles for sequential machines. Flip-flops and latches.
Sequential logic implementation
Lecture 24 Logistics Last lecture Today HW7 back today
EGR 2131 Unit 12 Synchronous Sequential Circuits
Implementation Strategies
Presentation transcript:

FSM Word Problems Today: Notes: Review for Test #2 – Monday Studio #8: Reading assignment is required & due next week Today: First Hour: Finite string recognizer, Complex counter Section 8.5 of Katz’s Textbook In-class Activity #1 Second Hour: Traffic signal controller, Digital combination lock In-class Activity #2

Katz Material not Covered CoCO doesn't cover everything in Katz. Omitted material includes: ASM charts The ABEL language all of Chapter 9 is skipped

Word Problems One of the most difficult problems is making an imprecise description of a finite state machine into a precise one. Have you covered all the states? Omissions can cause failures, crashes, death and destruction, etc. This is the Hardware equivalent of a Software programming error.

Finite String Recognizer Serial Finite State Machine One input: X One output: Z Description: Z is 1 if the 3 previous input bits are 010, and 100 has never been seen. Unstated assumptions: RESET starts the FSM at the "reset" state Z is asserted when the following bit is seen. A Moore Machine implementation.

Example Serial Behavior X: 0 0 1 0 1 0 1 0 0 1 0 Z: - 0 0 0 1 0 1 0 1 0 0 0 Z is 0 even though the three previous inputs are 010, because 100 was seen earlier.

State Transition Diagram Formal Design State Transition Diagram Reset S0 [0] Create sequences of states for the strings that the machine recognizes: 010 and 100. Note we reset to S0. Consider the unlabelled transitions. 1 S1 S4 [0] [0] 1 S2 S5 [0] [0] 0,1 S3 S6 [1] [0]

State S3 Diagram Development 1 1 01? 1 0,1 010 100 Reset S0 [0] S1 S4 1 Where do we go from S3? A 1 means the last 3 bits are 101, so go to S2. A 0 means we’ve seen 100, so go to S6. S1 S4 [0] [0] 1 S2 S5 01? [0] [0] 1 0,1 S3 S6 010 [1] [0] 100

States S1 and S4 Diagram Development 1 1? 1 0? 1 01? 1 0,1 010 100 Reset S0 Loop in S1 until we see our first 1. Loop in S4 until we see our first 0. [0] 1 S1 1? S4 1 [0] [0] 0? 1 S2 S5 01? [0] [0] 1 0,1 S3 S6 010 [1] [0] 100

States S2 and S5 Diagram Development 1? 1 0? 01? 10? 0,1 010 100 S0 [0] S1 S2 S3 [1] S4 S5 S6 Reset 1 0,1 10? 1? 0? 01? 100 010 S2 means the last 2 bits are 01, which may be a prefix of 010. If the next bit is 1, the last 2 bits are now 11, maybe a prefix of 100. That’s S4. S5: Last 2 bits are 10. If next bit is 1, maybe that’s a prefix for 010. Go to S2.

Review of Design Steps Katz's Method Write sample inputs and outputs to understand it. Write sequences of states and transitions for the strings that the FSM is to recognize. Add missing transitions, using existing states when possible. Verify that the state diagram matches the FSM.

Complex Counter Design a 3-bit counter, with one input bit, a mode, M. If M = 0, step to the next binary number in the sequence 000, 001, 010, 011, 100, 101, 110, 111, … If M = 1, step to the next Gray code number in the sequence 000, 001, 011, 010, 110, 111, 101, 100, ...

Try Some Sample Inputs Note that we can switch modes at any time. Mode Input M 1 Current State 0 0 0 0 0 1 0 1 0 1 1 0 1 1 1 1 0 1 Next State (Z2 Z1 Z0)

Formal Representation Reset S0 [000] S1 [001] S2 [010] S3 [011] S4 [100] S5 [101] S6 [110] S7 [111] 1 One state for each output combination Add appropriate arcs for the mode control

Do Activity #1 Now Reset S0 [000] S1 [001] S2 [010] S3 [011] S4 [100] S5 [101] S6 [110] S7 [111] 1 Reset S0 [0] 1 S1 1? S4 1 [0] [0] 1 0? 1 1 S2 S5 01? [0] [0] 10? 1 S3 S6 0,1 010 [1] [0] 100 FSM String Recognizer, Z=1 if 010 is seen, but 100 not seen before Complex Counter

Diagram of Intersection Highway Farmroad HL FL C

Traffic Light Controller A busy highway is intersected by a little-used farm road. Detectors C sense the presence of cars waiting on the farm road. With no car is on farm road, the lights remain Green in the highway direction. If vehicle is on the farm road, highway lights go from Green to Yellow to Red, allowing the farm road lights to become Green. These stay Green only as long as a farm road car is detected but never longer than a set time interval. When these are met, farm lights transition from Green to Yellow to Red, allowing highway to return to Green. Even if farm road vehicles are waiting, the highway gets at least a set interval as Green.

Available Timers Assume you have an interval timer that generates a short time pulse (TS) and a long time pulse (TL) in response to a start timer (ST) signal. TS is to be used for timing Yellow lights and TL for Green lights

Tabulate Inputs & Outputs Input Signal reset C TS TL Output Signal HG, HY, HR FG, FY, FR ST Description place FSM in initial state detect vehicle on farm road short time interval expired long time interval expired assert green/yellow/red highway lights assert green/yellow/red farm road lights start timing a short or long interval

Tabulate Unique States Some light configurations imply others. State S0 S1 S2 S3 Description Highway green (farmroad red) Highway yellow (farmroad red) Farmroad green (highway red) Farmroad yellow (highway red)

List Assumptions Reset places timer in S0, highway green and farm road red. Reset also starts the timer. Stay in S0 as long as no one is on the farm road. Even if there is a farm road vehicle, the highway stays green at least long as the long time interval. (Unstated in Katz) There will never be a bicycle or pedestrian on the farm road.

Traffic Signal State Diagram TL + C Reset S0 S0: HG S1: HY S2: FG S3: FY TL•C/ST S1 S3 TL: long time interval expired S2 C: detect vehicle on farmroad

Traffic Signal State Diagram TL + C Reset S0 S0: HG S1: HY S2: FG S3: FY TL•C/ST TS S1 S3 TS/ST TS: short time interval expired S2 ST: start timing a short or long interval

Traffic Signal State Diagram TL + C Reset S0 S0: HG S1: HY S2: FG S3: FY TL•C/ST TS S1 S3 TS/ST TL + C/ST S2 TL: long time interval expired C: detect vehicle on farm road TL • C ST: start timing a short or long interval

Traffic Signal State Diagram TL + C Reset S0 S0: HG S1: HY S2: FG S3: FY TL•C/ST TS/ST TS S1 S3 TS TS/ST TL + C/ST S2 TS: short time interval expired ST: start timing a short or long interval TL • C

Combination Lock 3 bit serial lock controls entry to locked room. Inputs are RESET, ENTER, 2 position switch for bit of KEY data. Locks generates an UNLOCK signal when KEY matches internal combination. ERROR light illuminated if KEY does not match combination. Sequence is: (1) Press ENTER, (2) enter KEY bit, (3) Press ENTER, (4) repeat (2) & (3) two more times. In the last round, it is not necessary to press ENTER.

Incomplete Specification Problem specification is incomplete: how do you set the internal combination? exactly when is the ERROR light asserted?

Make Assumptions Make reasonable assumptions, decide whether combination is hardwired into logic or stored in a register? error is asserted as soon as an error is detected or waits until the full combination has been entered? Our design: combination is stored in a register and error is asserted after the full combination has been entered Why is it just possibly a bad idea to indicate an error immediately on seeing the first bad bit ?

Block Diagram of Lock Operator Data Internal Combination Inputs: Reset, Enter, Key-In, L0, L1, L2 Outputs: Unlock, Error

Enumerate the States What sequences lead to opening the door? Do error conditions on a second pass …

State Diagram of Lock Enter Enter Comp1 Error1 KI  L1 KI = L1 Enter Idle1 Idle1' Reset + Enter Reset Enter Enter Start Comp2 Error2 Reset • Enter KI  L2 KI = L2 Comp0 Reset Reset Error3 KI = L0 KI  L0 Done [Error] [Unlock] Enter Enter Reset Idle0 Idle0' Reset Start Start

Do Activity #2 Now For Next Class: Due: End of Class Today. RETAIN THE LAST PAGE(S) (#3 onwards)!! For Next Class: Bring Randy Katz Textbook, & TTL Data Book Required Reading: Sec 11.1-11.3, skim 11.2 of Katz, omit the ABEL and ASM descriptions This reading is necessary for getting points in the Studio Activity!