44 views

Uploaded by Mehmet Kadir Kalkan

save

You are on page 1of 14

Real-Time and Embedded System Design

Lecture 3-A

1

Finite State Machines

Asst. Prof. Tolga Ayav, Ph.D.

**Department of Computer Engineering
**

İzmir Institute of Technology

mapping states and inputs to states. y1. An FSM is a 6-tuple. z1.... is a next-state function (i.e. Finite State Machines Finite state machines (FSMs) are powerful design elements used to implement algorithms in hardware. .. yn}... zl}.. . X is a set of inputs {x0. (Z x X → Y) is an output function. <Z. where: Z is a set of states {z0. xm}. . Y. mapping current states to outputs (Z → Y). İzmir Institute of Technology Real-Time and Embedded System Design . x1. and z0 is an initial state. z0>.. X. . .. Y is a set of outputs {y0. transitions).

Moore and Mealy FSMs İzmir Institute of Technology Real-Time and Embedded System Design .

: (Z → Y) İzmir Institute of Technology Real-Time and Embedded System Design . FSM Model: Moore Outputs depends on states.

FSM Model: Mealy Outputs depends on states and inputs. : (X x Z → Y) İzmir Institute of Technology Real-Time and Embedded System Design .

Y. ⧫ is a next-state function (i. V. ⧫ Y is a set of outputs {y0.e.. FSMD (Finite-state machines with datapaths) When using an FSM for embedded system design. ⧫ V is a set of variables {v0. where: ⧫ Z is a set of states {z0.. two new features would be helpful: more complex data types (such as integers or floating point numbers).. ⧫ X is a set of inputs {x0. z0>. . mapping current states to outputs (Z → Y). This model is sufficient for purely control systems that do not input or output data.. (Z x X → Y) ⧫ is an output function.. and variables to store data. X.. xm}. However. and the functions therefore represent boolean functions with boolean operations. and ⧫ z0 is an initial state. <Z... . when we must deal with data. . . zl}. y1. vn}.. mapping states and inputs to states. An FSMD is a 7-tuple. İzmir Institute of Technology Real-Time and Embedded System Design .. yn}. v1. the inputs and outputs represent boolean data types. . x1. . z1.. transitions)..

not only boolean operations. FSMD (Finite-state machines with datapaths) Various data types are allowed (like the ones in a typical programming language) During execution of the model. the complete system state consists not only of the current state. but also the values of all variables and includes arithmetic operations. İzmir Institute of Technology Real-Time and Embedded System Design . also includes variable updates.

3. to other states. 4. ensure that exiting transition conditions are exclusive (no two conditions could be true simultaneously) and complete (one of the conditions is true at any time). giving each a descriptive name. Describing a system as a state machine 1. For each state and/or transition. with associated conditions. Declare all variables. 2. İzmir Institute of Technology Real-Time and Embedded System Design . list the possible transitions. For each state. list the associated actions 5. For each state. List all possible states.

The inputs are a sensor for the seat to know when a person has sat down. a seat belt sensor that tells when the belt is fastened. The output is the buzzer seat 1: person sat down timer_on 0: no person Seat belt controller belt 1: seat belt fastened buzzer 0: not fastened timer 1: expired 0: not expired İzmir Institute of Technology Real-Time and Embedded System Design . This system has three inputs and one output. State Machine in C Design a Simple Seat Belt Controller: The controller's job is to turn on a buzzer if a person sits in a seat and does not fasten the seat belt within a fixed amount of time. and a timer that goes off when the required time interval has elapsed.

State Diagram for the Seat Belt Controller İzmir Institute of Technology Real-Time and Embedded System Design .

else if(!seat) state=IDLE. case BUZZER: while(1) FSM().} break. if(belt) state=BELTED. } break. timer_on=1. else if(timer) state=BUZZER. State diagram case SEATED: if(belt) state=BELTED. C Code: #define IDLE 0 #define SEATED 1 #define BELTED 2 #define BUZZER 3 void FSM() { switch(state) { case IDLE: if(seat) {state=SEATED. case BELTED: if(!seat) state=IDLE. } } İzmir Institute of Technology Real-Time and Embedded System Design . void main() else if(!belt) state=SEATED. break. { break.

must be run in concurrency. This requires many transitions in the diagram. (b) same example with hierarchy. (a) three-state example without hierarchy. (c) concurrency. İzmir Institute of Technology Real-Time and Embedded System Design . Seatbelt controller. assume that any state goes to a newly defined state when a pust button is pressed. cruise controller etc. Adding Hierarchy/Concurrency:HCFSM In the seatbelt controller example.

as well as including the hierarchy and concurrency extensions of HCFSM. İzmir Institute of Technology Real-Time and Embedded System Design . Program State Machine (PSM) The program-state machine (PSM) model extends state machines to allow use of sequential program code to define a state’s actions (including extensions for complex data types and variables).

G. Assignment 2 1. V={SA. 2. 3. Write a C program running this FSMD and the seatbelt controller FSM concurrently. K} etc.) and draw the diagram. Write a C program implementing this FSMD. Construct an FSMD model of automobile cruise controller. İzmir Institute of Technology Real-Time and Embedded System Design . SD. Define the sets of FSMD (For example.

- Minimization of Finite State Automata Through Partition AggregationUploaded byAlex Dinca
- Job & Project Management SoftwareUploaded byapi-27097233
- pdf (5)Uploaded byhanytheking
- Basic TimingUploaded byPaul Kennedy
- A Study of Finite State Machine Coding Styles for ImplementationUploaded byPronadeep Bora
- digital_mclogic_design.pdfUploaded byTiago Guerra
- example on circuitsUploaded byFrankie Burgos
- Final_CSE_V Semester_New_Syllabus.pdfUploaded bysaurabh303
- CSm51a Lecture 11Uploaded byZeeshan Pirzada
- Micro ControllerUploaded byMohd Tanveer Ashraf
- Traffic Light ControlUploaded byyuvaranz
- Tmp 9851Uploaded byFrontiers
- Chapter 01 - IntroductionUploaded byprinceji
- ifconfig le0 169Uploaded byYamen Nasr
- 02_FiniteAutomataUploaded byRohit Shrivastava
- EMEA_distribributorsUploaded byRohini James
- Cloning 11510all TypesUploaded bySubahan Shaik
- Mulan Reflection SheetMusicUploaded byshewheedledhermother
- Latex Cheatsheet TemplateUploaded byHossam Nabil
- MCMU 0 Computer LogsUploaded byAlex Andwanda
- mobicom09Uploaded byKishore Vennela
- How to Operate AAS With SignPal & PhotoPRINTUploaded byLucian Dogariu
- ANAS TemplateUploaded bymilismine
- mod3.2Uploaded byNiro Chweety
- Avionté Launches Next Generation Virtual Training InstructorUploaded byPR.com
- The Deployment of Several BI Presentation Services on a UnixUploaded bysakthiroh
- Emacs Tutorial ReferenceUploaded byyogeshwani
- Floorplan SureshUploaded bydk13071987
- EcoStruxure ExchangeUploaded byHujiLoko
- FacePhi - Financial Institutions 2013Uploaded byAbdennour Tamdrari

- Notas Sobre Adorno.Uploaded byGiovanny Antonio Salas Torres
- C2 - Administracao de Sistemas de Informacao(1)Uploaded byrenato jr
- A_Jewish_Intaglio_from_Roman_Ammaia_Lusi.pdfUploaded byRicardo Luis Martin Sant'Anna
- Practica 1 Circuitos Con ResistenciasUploaded byJorge Santiago Montiel
- Umbanda Exu Na Lei Da Quimbanda by OmirohumbiUploaded byMario Luiz
- Celia Amoros-Feminismo Igualdad y DiferenciaUploaded byAlicia
- ORACLE SQL QUERYUploaded bybhaskar1234567
- week 4 presentation 1Uploaded byapi-358487921
- How to Write a Book ReviewUploaded byPatricia Ivan
- La Civilización Del Amor. Reflexiones Para Una Sociedad en Crisis - Agustín Basave Fernandez Del ValleUploaded byFabian Zambrano
- Galipoli de 1354 y Galipoli de 1915 de Aneta de la Mar IkomonovaUploaded byAneta de la Mar
- Apa 6th EditionUploaded byDiana Gomez Oblea
- J2EE AuditingUploaded byMary Yomisma
- Primeras intenciones comunicativasUploaded byPablo García González
- Biografia Secar Vallejo CelenaUploaded byAlex Panduro Peña
- Thomas Hardy PoemsUploaded bykyle
- Saint Augustin - Discours sur les psaumes - Ps 131 l'Espérance en DieuUploaded byVan Karpo
- ficha de revisões 08.02.2011Uploaded byVera Pinto
- 02-RelationalModel-07[1]Uploaded byananthmt
- Introducao a Linguagem Grafica 2008 Aula 2Uploaded byAdhara Garcia
- 01 Introduction to Databases (Sept 10)Uploaded byNathan Wilson
- Anderson, Laura Killen - Handbook for ProofreadingUploaded byEdgar Ebojo
- Racionalidad e IlustracionUploaded byClaudio M. Stessens
- La Importancia de La MisaUploaded byLILLY LLAP
- Calculo III - Primer Tema - CurvasUploaded byElvis Damiano Perez
- Backwinkel_Holger_-_Telefonieren_Professionell.pdfUploaded byANA SIERRA
- SIMATIC S7-GRAPHUploaded byrigo_sk
- micro-p mini project Full ReportUploaded byWei Hor
- 3449-13641-1-PBUploaded byJulio César
- student centered learning - dom aUploaded byapi-354340831