CS244-Introduction to Embedded Systems and Ubiquitous ComputingCS244 – Lecture 6Taxonomy of ComputationsModels, Languages, & ToolsModels of ComputationModels of Computation …Models of computation: ExamplesSlide 8Slide 9LanguagesModels vs. languagesFinite-state machine (FSM) modelFormal definitionFinite-state machine with datapath model (FSMD)Describing a system as a state machineState machine vs. sequential program modelTry Capturing Other Behaviors with an FSMCapturing state machines in sequential programming languageLanguage subset approachGeneral templateHCFSM and the Statecharts languageProgram-state machine model (PSM): HCFSM plus sequential program modelPetri NetsApplications of Petri NetPowerPoint PresentationSlide 26Slide 27Slide 28Slide 29Slide 30Example: In a Restaurant (A Petri Net)Example: In a Restaurant (Two Scenarios)Example: In a Restaurant (Scenario 1)Example: In a Restaurant (Scenario 2)Petri Net with TimeReferencesConcurrent process modelProcess NetworkAsynchronous message passingDataflow modelSynchronous dataflowCS244-Introduction to Embedded Systems and Ubiquitous ComputingInstructor: Eli BozorgzadehComputer Science DepartmentUC IrvineWinter 2010Winter 2010- CS 2442CS244 – Lecture 6Model of ComputationTaxonomy of Computations “Regular” vs “Event-Driven”Regular examples: streaming applications, processors,…Event-driven: “reactive” (triggered by changes in environment)Real-Time Hard vs. Soft deadlines Periodic vs. AperiodicControl, Data, Communication How much of each?Parallelism, Geographic distances Highly concurrent vs. sequential; distributed systemsDeterministic vs. Non-deterministicDegree of predictabilitySome CharacteristicsModels, Languages, & ToolsA model of computation is a conceptual notions used to capture a system behavior, e.g.:A set of objectsComposition rulesExecution semanticsA languages defines the syntax to capture a models of computationA tool is a “compiler” transforming a model captured in one language to a model captured in another languageModel M1Model M2Language L1Language L2ToolBehaviorBehaviorModels of ComputationSequential model of computationA single thread of executionConcurrent model of computationMultiple threads of executionSynchronization pointsCommunication mechanismsObject Oriented (OO) Model of computationView the computation as a set of objectsBased, inherited, or composedPolymorphism: a derived class can modify the behavior of its base classModels of Computation …FSMA set of states and transitionsMealy and MooreDFGA set of computation nodes and flow pathsPetri netA set of places, transitions, edges, and tokensKahn Process Network (KPN)A set of concurrent processes sharing data using unbounded buffersCommunicating Sequential Processes (CSP)P1P2P4P3Petri netKPNICS212 FQ05 (Dutt) Models, Languages, ToolsModels of computation: ExamplesDiscrete event modelDiscrete event modelabctimeactiona:=5 b:=7 c:=8 a:=6 a:=9 queue5 10 13 15 19Discrete Events (DE)Events occur at discrete points on a time continuumEvents trigger computationsComputations trigger more eventsModels of computation: ExamplesContinuous Time (CT): Differential equationsContinuous Time (CT): Differential equationsSynchronous message passingSynchronous message passingbtx22Asynchronous message passingAsynchronous message passingDifferential equations model continuous i/o response as a function of continuous timeModels of Computation …Synchronous Reactive (SR)Break time into an ordered sequence of instancesEach instance is initiated by an event from the environmentPublish & Subscribe (P&S)Sending applications (publishers) publish messages without explicitly specifying recipientsReceiving applications (subscribers) receive only those messages that the subscriber has registered an interest inLoosely coupled networked systems (middleware handles the linking)Hybrid and hierarchical modelsLanguagesCommon:Assembly (closest language to Turing-machine model of computation)ANSI C, C++ANSI C/C++ & POSIXADA, VHDLJAVAEvolving:SystemCSystemVerilogSpecC, …Others:Magic for layoutVHDL subset for RTLPtolemyAPI extensionsCORBAClient-serverTCP/IPEtc.11Models vs. languagesComputation models describe system behaviorConceptual notion, e.g., recipe, sequential programLanguages capture modelsConcrete form, e.g., English, CVariety of languages can capture one modelE.g., sequential program model C,C++, Java One language can capture variety of modelsE.g., C++ → sequential program model, object-oriented model, state machine modelCertain languages better at capturing certain computation modelsModelsLanguagesRecipeSpanishEnglish JapanesePoetry Story Sequent.programC++C JavaStatemachineData-flowRecipes vs. EnglishSequential programs vs. C12Finite-state machine (FSM) modelIdleGoingUpreq > floorreq < floor!(req > floor) !(timer < 10)req < floorDoorOpenGoingDnreq > flooru,d,o, t = 1,0,0,0u,d,o,t = 0,0,1,0u,d,o,t = 0,1,0,0u,d,o,t = 0,0,1,1u is up, d is down, o is openreq == floor!(req<floor)timer < 10t is timer_startUnitControl process using a state machine13Formal definitionAn FSM is a 6-tuple F<S, I, O, F, H, s0>S is a set of all states {s0, s1, …, sl}I is a set of inputs {i0, i1, …, im}O is a set of outputs {o0, o1, …, on}F is a next-state function (S x I → S)H is an output function (S → O)s0 is an initial stateMoore-typeAssociates outputs with states (as given above, H maps S → O)Mealy-typeAssociates outputs with transitions (H maps S x I → O)Shorthand notations to simplify descriptionsImplicitly assign 0 to all unassigned outputs in a stateImplicitly AND every transition condition with clock edge (FSM is synchronous)14Finite-state machine with datapath model (FSMD)FSMD extends FSM: complex data types and variables for storing dataFSMs use only Boolean data types and operations, no variablesFSMD: 7-tuple <S, I , O, V, F, H, s0>S is a set of states {s0, s1, …, sl}I is a set of inputs {i0, i1, …, im}O is a set of outputs {o0, o1, …, on}V is a set of variables {v0, v1, …, vn}F is a next-state function (S x I x V → S)H is an action function (S → O + V)s0 is an initial stateI,O,V may
View Full Document