CIS 540 Principles of Embedded Computation Spring 2015 Instructor: Rajeev Alur

Slides:



Advertisements
Similar presentations
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Advertisements

CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
EECS 20 Lecture 38 (April 27, 2001) Tom Henzinger Review.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
Synthesis of Embedded Software Using Free-Choice Petri Nets.
An Introduction to Input/Output Automata Qihua Wang.
Esterel Overview Roberto Passerone ee249 discussion section.
The Programming Discipline Professor Stephen K. Kwan 2010 Things you need to know (learn) for developing large computer programs.
Expressing Giotto in xGiotto and related schedulability problems Class Project Presentation Concurrent Models of Computation for Embedded Software University.
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
Mahapatra-A&M-Sprong'021 Co-design Finite State Machines Many slides of this lecture are borrowed from Margarida Jacome.
01/27/2005 Combinationality of cyclic definitions EECS 290A – Spring 2005 UC Berkeley.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
Chapter 8 Asynchronous System Model by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Topics n Basics of sequential machines. n Sequential machine specification. n Sequential.
Ch.2 Part A: Requirements, State Charts EECE **** Embedded System Design.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Instructor: Rajeev Alur
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Object-Oriented Modeling Using UML CS 3331 Section 2.3 of Jia 2003.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
CS6133 Software Specification and Verification
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Ch. 2. Specification and Modeling 2.1 Requirements Describe requirements and approaches for specifying and modeling embedded systems. Specification for.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Mahapatra-A&M-Fall'001 Co-design Finite State Machines Many slides of this lecture are borrowed from Margarida Jacome.
CS 367: Model-Based Reasoning Lecture 5 (01/29/2002) Gautam Biswas.
Module 1.2 Introduction to Verilog
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Conformance Test Experiments for Distributed Real-Time Systems Rachel Cardell-Oliver Complex Systems Group Department of Computer Science & Software Engineering.
Timing Model VHDL uses the following simulation cycle to model the stimulus and response nature of digital hardware Start Simulation Update Signals Execute.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Shared Variables Interaction Diagrams Radu Grosu State University of New York at Stony Brook joint work with Rajeev Alur University of Pennsylvania.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Modern VLSI Design 3e: Chapter 8 Copyright  1998, 2002 Prentice Hall PTR Topics n Basics of register-transfer design: –data paths and controllers; –ASM.
Chapter 8 Asynchronous System Model by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Model Checking Lecture 1. Model checking, narrowly interpreted: Decision procedures for checking if a given Kripke structure is a model for a given formula.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 6: Stepwise refinement revisited, Midterm review.
Algebra 2 June 18, 2016 Goals:   Identify functions in coordinate, table, or graph form   Determine domain and range of given functions.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
George Mason University Finite State Machines Refresher ECE 545 Lecture 11.
CPE555A: Real-Time Embedded Systems
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Instructor: Rajeev Alur
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Autonomous Cyber-Physical Systems: Synchronous Components: II
Lesson 4 Synchronous Design Architectures: Data Path and High-level Synthesis (part two) Sept EE37E Adv. Digital Electronics.
Spring CS 599. Instructor: Jyo Deshmukh
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL code ECE 448 – FPGA and ASIC Design.
Lecture 14: State Tables, Diagrams, Latches, and Flip Flop
Presentation transcript:

CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur

Finite-State Components bool in bool x := 0 out:=x ; x:= in bool out Delay int in1 out := in1 2 – in2 2 int out int in2 DiffSquare  A component is finite-state if all its variables range over finite types  Finite types: bool, enumerated types (e.g. {on, off}), int[-5..5]  Delay is finite-state, but DiffSquare is not CIS 540 Spring 2015; Lecture Jan 26

Mealy Machines (for Finite-state components) bool in bool x := 0 out:=x ; x:= in bool out Delay 01 0 / 0 1 / 0 1 / 1 0 / 1  Finite-state components are amenable to exact, algorithmic analysis CIS 540 Spring 2015; Lecture Jan 26

Switch: Is it finite-state? Input: bool press offon int x:=0 (press=0) ? (press=1) ? (press=0 & x<10)  x:=x+1 (press=1 | x>=10)  x:=0 CIS 540 Spring 2015; Lecture Jan 26 int[0,10] x:=0

Combinational Components bool in bool x := 0 out:=x ; x:= in bool out Delay int in1 out := in1 2 – in2 2 int out int in2 DiffSquare  A component is combinational if it has no state variables  DiffSquare is combinational, but Delay is not  Hardware gates are combinational components CIS 540 Spring 2015; Lecture Jan 26

Events  Input/output variable can be of type event  An event can be absent, or present, in which case has a value  event x means x ranges over {present, absent}  event(bool) x means x ranges over {0, 1, absent}  event(nat) x means x ranges over {absent, 0, 1, 2, …}  Syntax: x? means the test (x != absent)  Syntax: x!v means the assignment x := v  Event-based communication:  If no value is assigned to an output event, then it is absent (by default)  Event-triggered component executes only in those rounds where input events are present (actual definition slightly more general, see textbook)  Motivation: notion of “clock” can be different for different components CIS 540 Spring 2015; Lecture Jan 26

Second-To-Minute event second int x := 0 if second? then { x:=x+1; if x==60 then { minute!; x :=0 } } event minute Desired behavior (spec): Issue the output event every 60 th time the input event is present  Event-Triggered Components  No need to execute in a round where triggering input events absent  Read textbook for formal definition CIS 540 Spring 2015; Lecture Jan 26

Deterministic Components bool in bool x := 0 out:=x ; x:= in bool out Delay  A component is deterministic if (1) it has a single initial state, and (2) for every state s and input i, there is a unique state t and output o such that s –i/o  t is a reaction  Delay is deterministic, but LossyDelay is not  Deterministic: If same sequence of inputs supplied, same outputs observed (predictable, repeatable behavior)  Nondeterminism is useful in modeling uncertainty /unknown  Nondeterminism is not same as probabilistic (or random) choice bool in bool x := 0 out:=x ; x:= choose { in, x} bool out LossyDelay CIS 540 Spring 2015; Lecture Jan 26

What does this component do? event req1 Arbiter req1?  grant1! req2?  grant2! ~ req1? & ~ req2? event req2 event grant1 event grant2 CIS 540 Spring 2015; Lecture Jan 26

Input Enabled Components bool in bool x := 0 out:=x ; x:= in bool out Delay  A component is input-enabled if for every state s and input i, there exists a state t and an output o such that s –i/o  t is a reaction  Delay is input-enabled, but BlockingDelay is not  Not input-enabled means component is making assumptions about the context in which it is going to be used  When rest of system is designed, must check that it indeed satisfies these assumptions BlockingDelay bool in bool x := 0 if x != in then { out:=x; x:=in} bool out CIS 540 Spring 2015; Lecture Jan 26

Block Diagrams  Structured modeling  How do we build complex models from simpler ones  What are basic operations on components? CIS 540 Spring 2015; Lecture Jan 26

DoubleDelay  Design a component with  Input: bool in  Output: bool out  Output in round n should equal input in round n-2 bool in bool x := 0 out:=x ; x:= in bool out Delay bool in bool out Delay CIS 540 Spring 2015; Lecture Jan 26

DoubleDelay  Instantiation: Create two instances of Delay  Output of Delay1 = Input of Delay2 = Variable temp  Parallel composition: Concurrent execution of Delay1 and Delay2  Hide variable temp: Encapsulation bool in bool temp Delay1 bool out Delay2 CIS 540 Spring 2015; Lecture Jan 26

Instantiation / Renaming  Delay1 = Delay[out -> temp]  Explicit renaming of input/output variables  Implicit renaming of state variables  Components (I,O,S,Init,React) of Delay1 derived from Delay  Delay2 = Delay[in -> temp] bool in bool x := 0 out:=x ; x:= in bool out Delay bool in bool x1 := 0 temp:=x1 ; x1:= in bool temp Delay1 CIS 540 Spring 2015; Lecture Jan 26

Parallel Composition  DDelay = Delay1 || Delay2  Execute both concurrently  When can two components be composed?  How to define parallel composition precisely?  Input/output/state variables, initialization, and reaction description of composite defined in terms of components  Can be viewed as an “algorithm” for compilation bool in bool temp Delay1 bool out Delay2 CIS 540 Spring 2015; Lecture Jan 26

Compatibility of components C1 and C2  Can have common input variables  Cannot have common output variables  A unique component responsible for values of any given variable  Cannot have common state variables  State variables can be implicitly renamed to avoid conflicts  Input variable of one can be output of another, and vice versa CIS 540 Spring 2015; Lecture Jan 26

Outputs of Product  Output variables of Delay1 || Delay2 is {temp, out}  Note: By default, every output is available to outside world  If C1 has output vars O1 and C2 has output vars O2 then the product C1 || C2 has output vars O1 U O2 bool in bool temp Delay1 bool out Delay2 bool x1 := 0 temp:=x1 ; x1:= in bool x2 := 0 out:=x2 ; x2:= temp CIS 540 Spring 2015; Lecture Jan 26

Inputs of Product  Input variables of Delay1 || Delay2 is {in}  Even though temp is input of Delay2, it is not an input of product  If C1 has input vars I1 and C2 has input vars I2 then the product C1 || C2 has input vars (I1 U I2) \ (O1 U O2)  A variable is an input of the product if it is an input of one of the components, and not an output of the other bool in bool temp Delay1 bool out Delay2 bool x1 := 0 temp:=x1 ; x1:= in bool x2 := 0 out:=x2 ; x2:= temp CIS 540 Spring 2015; Lecture Jan 26

States of Product  State variables of Delay1 || Delay2 : {x1, x2}  If C1 has state vars S1 and C2 has state vars S2 then the product has state vars (S1 U S2)  A state of the product is a pair (s1, s2), where s1 is a state of C1 and s2 is a state of C2  If C1 has n1 states and C2 has n2 states then the product has (n1 x n2) states bool in bool temp Delay1 bool out Delay2 bool x1 := 0 temp:=x1 ; x1:= in bool x2 := 0 out:=x2 ; x2:= temp CIS 540 Spring 2015; Lecture Jan 26

Initial States of Product  The initialization code Init for Delay1 || Delay2 is “x1:=0;x2:=0”  Initial state is (0,0)  If C1 has initialization Init1 and C2 has initialization Init2 then the product C1 || C2 has initialization Init1; Init2  Order does not matter  [Init] is the product of sets [Init1] x [Init2] bool in bool temp Delay1 bool out Delay2 bool x1 := 0 temp:=x1 ; x1:= in bool x2 := 0 out:=x2 ; x2:= temp CIS 540 Spring 2015; Lecture Jan 26

Reactions of Product  Execution of Delay1 || Delay2 within a round  Environment provides input value for variable in  Execute code “temp:=x1; x1:=in” of Delay1  Execute code “out:=x2; x2:=temp” of Delay2 bool in bool temp Delay1 bool out Delay2 bool x1 := 0 temp:=x1 ; x1:= in bool x2 := 0 out:=x2 ; x2:= temp CIS 540 Spring 2015; Lecture Jan 26

Feedback Composition  When some output of C1 is an input of C2, and some output of C2 is an input of C1, how do we order the executions of reaction descriptions React1 and React2?  Should such composition be allowed at all? CIS 540 Spring 2015; Lecture Jan 26

Feedback Composition  For Relay, its output out “awaits” its input in  For Inverter, its output in “awaits” its input out  In product, cannot order the execution of the two  In presence of such cyclic dependency, composition is disallowed  Intuition: Combinational cycles should be avoided Relay out := in Inverter in := ~ out bool out bool in CIS 540 Spring 2015; Lecture Jan 26

Feedback Composition  For Delay, possible to produce output without waiting for its input by executing the assignment “out :=x”  Reaction code for product can be “out:=x; in := ~out; x := in”  Goal: Refine specification of reaction description so that “await” dependencies among output-input variables are easy to detect  Ordering of code-blocks during composition should be easy Delay out :=x; x := in Inverter in := ~ out bool out bool in bool x :=0 CIS 540 Spring 2015; Lecture Jan 26

Splitting Reaction code into Tasks bool in bool x := 0 out:=x bool out SplitDelay  A1 and A2 are tasks (atomic blocks of code)  Each task specifies variables it reads and writes  A1 reads x and writes out  Task Graph: Vertices are tasks and edges denote precedence  A1 < A2 means that A1 should be executed before A2  Graph should be acyclic A1: x -> out A2: in -> x x:=in CIS 540 Spring 2015; Lecture Jan 26

Example Task Graph bool in1 out1:=in1 bool out1 ParallelRelay  Tasks A1 and A2 are unordered  Possible “schedules” (linear ordering of tasks): A1, A2 and A2, A1  All consistent schedules give the same result  I/O await dependencies: out1 awaits in1, out2 awaits in2 A1: in1 -> out1A2: in2 -> out2 out2:=in2 bool in2 bool out2 CIS 540 Spring 2015; Lecture Jan 26

Muddy Childrens Puzzle There are some kids playing in a muddy pond. Their teacher walks by and says “some of you have mud on your forehead”. Each kid can look around and see which of other kids have muddy foreheads, but cannot see his/her own forehead. The teacher says “raise your hand if you know that you have muddy forehead”. Nobody raises their hands. The teacher repeats the same question, and it continues like that. If k kids have muddy foreheads, then after the teacher has asked the question k times, exactly those kids with muddy foreheads raise their hands. Explain the reasoning of the kids. CIS 540 Spring 2015; Lecture Jan 26