Finite state machines. Finite State Machines (FSMs) Widely used specification technique Used to specify system behavior in response to events Both output.

Slides:



Advertisements
Similar presentations
State Machines An approach to assembler coding. Intro State Machines are an integral part of software programming. State machines make code more efficient,
Advertisements

ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 23 Finite State Machine.
Modeling Computation Chapter 13.
Finite State Machines (FSM)
Use Case Diagrams Damian Gordon.
Lecture 20 Finite State Machines CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Finite State Machines (FSMs)
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
Network Protocols Dr. Eng Amr T. Abdel-Hamid NETW 703 Winter 2006 Finite State Machines (FSMs)
Circuits require memory to store intermediate data
State Machines. What are they? Sometimes called a “Finite State Machine” Depicted as a “state diagram” It’s a tool for specifying a system’s behavior.
Finite state machines.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
CSC 402 Requirements Engineering 1 Requirements Techniques, cont. Formal requirements analysis techniques include: – DFD (covered) – ERD (covered) – Finite.
Mainly OK & ready FSMs: 1. Discuss good examples and bad examples of state names: (bad preparing 1, preparing 2, …)
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design 8.5 Finite State Machine.
Give qualifications of instructors: DAP
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
Finite State Machines Control Circuits Example: Vending Machine Takes only quarters and dollar bills Won't hold more than $1.00 Sodas cost $.75 Possible.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
Lecture 17 General finite state machine (FSM) design
Requirements Engineering Southern Methodist University CSE 7316.
Chapter 5 – System Modeling
1 841f06parnas13 Evaluation of Safety Critical Software David L. Parnas, C ACM, June 1990.
Sequential Networks Two major classes of Sequential Circuits 1.Fundamental Mode – A sequential circuit where: Only one input is allowed to change at any.
Finite State Machines – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Graphs and Finite State Machines Reading: Kolman, Sections.
Elevator Controller We’re hired to design a digital elevator controller for a four-floor building st try: Design a counter that counts up.
Lecture 5 Key Locker using FPGA 2007/10/05 Prof. C.M. Kyung.
1 Statecharts by David Harel, 1987 State machines ⊆ statecharts A state machine consists of  Named states  Transitions between states  Events as labels.
Finite-State Machines with Output
Deterministic Finite State Machines Chapter 5. Languages and Machines 2.
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
Recall The Team Skills 1. Analyzing the Problem (with 5 steps) 2. Understanding User and Stakeholder Needs 3. Defining the System 4. Managing Scope 5.
Introduction to State Machine
The Unified Modeling Language Part II Omar Meqdadi SE 2730 Lecture 9 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 CSE370, Lecture 18 Lecture 20 u Logistics n HW6 due Wednesday n Lab 7 this week (Tuesday exception) n Midterm 2 Friday (covers material up to simple.
Lesson 5-2 Domain and Range.
Lecture 5. Sequential Logic 2 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
FINITE STATE MACHINES (FSMs)
CSIE.NCTU, DL-6-1 Basic Design Approach of FSM Six Step Process 1. Understand the statement of the Specification 2. Obtain an abstract specification of.
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.
Dynamic Models. Outline Dynamic Models Statecharts –States –Transitions –Composite states Interaction Diagrams –Sequence Diagrams The time order of interactions.
1 ENGG 1203 Tutorial Combinational Logic (II) and Sequential Logic (I) 8 Feb Learning Objectives  Apply Karnaugh map for logic simplification  Design.
CSCI1600: Embedded and Real Time Software Lecture 7: Modeling II: Discrete Systems Steven Reiss, Fall 2015.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
School of Computer Science & Software Engineering
Digital System Design using VHDL

§12.2 – Finite State Machines with Output
Dynamic Models - Page L M.E. Fayad Lesson 30: Dynamic Models Object- Oriented Modeling & Application s.
Govt. Engineering College- Gandhinagar. It is all about……  STATE MACHINE.
Requirements Techniques, cont.
Dr. Eng Amr T. Abdel-Hamid
Discrete Mathematics and its Applications
State Transition Diagram for A System
Evaluation in Engineering Design Process Modeling and FSM
Finite State Machines.
Discrete Mathematics and its Applications
§11.2 – Finite State Machines with Output
Electronics II Physics 3620 / 6620
Discrete Mathematics and its Applications
Dynamic Modeling Lecture # 37.
2.1: Represent Relations and Functions HW: p.76 (4-20 even, all)
Lecture 20 Logistics Last lecture Today HW6 due Wednesday
Discrete Mathematics and its Applications
Lecture 18 Logistics Last lecture Today HW5 due today (with extra 10%)
§11.2 – Finite State Machines with Output
Finite State Machine Continued
Discrete Mathematics and its Applications
Presentation transcript:

Finite state machines

Finite State Machines (FSMs) Widely used specification technique Used to specify system behavior in response to events Both output and next state can be determined solely on the basis of understanding the current state and the event that caused the transition H/W engineers have been using FSM for years

Can I interest you in our new long distance service?

No thanks.

Can I interest you in our new long distance service?

Get Lost!!

Can I interest you in our new long distance service? Get Lost!! Same stimulus event Different response

State Machines Models how a system responds differently to events over time

State Machines Models how a system responds differently to events over time button switch

States ON OFF

States ON OFF Press

Finite State Machines State –the memory of previous events Events –inputs to a system Actions –output in some form mechanical, electrical or software event

Finite State Machines State –the memory of previous events Events –inputs to a system Actions –output in some form mechanical, electrical or software event

Coke Machine Events –coin insertion Actions –coke delivery –coins returned State –the memory of how much money has been deposited

FSM Diagram State 1 State 2 Event-1 Action-k

FSM State 1 State 2 Event-1 Action-k Event-1 Not all state transitions have actions associated with them

Scenario Quarters Only, 75 cents Customer –enter quarter Customer –enter quarter Customer –enter quarter Coke Machine –deliver coke

Enumerate Events & Actions Events: E1:Deposit 25 cents Actions: A1:Deliver coke

Define States A B C Start State E1 E1/A1 States: A:No money B:25 cents entered C:50 cents entered Events: E1:Deposit 25 cents Actions: A1:Deliver coke

State Transition Table

Coke Machine Scenario 2 Coin Return Customer –enter quarter Customer –enter quarter Customer –press coin return (CR) Coke Machine –return coins

Enumerate Events & Actions Events: E1:Deposit 25 cents E2:Coin Return (CR) Actions: A1:Deliver coke A2: Return coins

Define States A B C Start State E1 E1/A1 States: A:No money B:25 cents entered C:50 cents entered Events: E1:Deposit 25 cents E2:Coin Return (CR) Actions: A1:Deliver coke A2: Return coins E2/A2

Define States A B C Start State E1 E1/A1 States: A:No money B:25 cents entered C:50 cents entered Events: E1:Deposit 25 cents E2:Coin Return (CR) Actions: A1:Deliver coke A2: Return coins E2/A2

Transition Table StateE1E2 AB BCA/coin return CA/cokeA/coin return

Transition Table l StateE1E2 l AB l BCA/coin return l CA/cokeA/coin return No Blanks Allowed !!

Transition Table StateE1E2 ABA BCA/coin return CA/cokeA/coin return

Telephone System FSM Local 4-digit exchange Events d:digit dialed h:hang up Actions c1:connect to caller

Telephone System FSM Local 4-digit exchange ABCDE dddd/c1 States A:start B:1 digit dialed C:2 digits dialed D:3 digits dialed E:call in progress Events d:digit dialed h:hang up Actions c1:connect to caller

Telephone System FSM Local 4-digit exchange ABCDE dddd/c1 h States A:start B:1 digit dialed C:2 digits dialed D:3 digits dialed E:call in progress Events d:digit dialed h:hang up Actions c1:connect to caller

Telephone System FSM Local 4-digit exchange ABCDE dddd/c1 h States A:start B:1 digit dialed C:2 digits dialed D:3 digits dialed E:call in progress Events d:digit dialed h:hang up Actions c1:connect to caller

Problems with FSMs The state explosion problem Confusing when too many states Requirements: –“in all airborne states, when the yellow handle is pulled, the seat will be ejected” maps event to large collection of states –“when the selection button is pressed, enter the selected mode” implies a clustering or grouping of states

Harel’s State Charts Allows grouping or clustering of states a b c b c A C B a b c c A C B D Clustering into new superstate D - really an abstraction. To be in D really means to be in either A or C

Coke Machine E D F 10 A B 5 C /coke 5/coke 5

Coke Machine A B E D F 5 10 C /coke 5/coke 5 CR ouch!

No Money (A) Money Entered

No Money (A) Money Entered 5 10 CR

No Money (A) Money Entered 5 10 CR B 510 C 5