590 likes | 729 Views
“Software†Esterel Execution (work in progress). Dumitru POTOP-BUTUCARU Ecole des Mines de Paris tyshbe@math.tau.ac.il. loop emit S ; pause end. Start. » loop emit S ; pause end. Start. loop » emit S ; pause end. Start. loop emit S ; » pause end. Start.
E N D
“Software” Esterel Execution(work in progress) DumitruPOTOP-BUTUCARU Ecole des Mines de Paris tyshbe@math.tau.ac.il
loop emit S ; pause end
Start »loop emit S ; pause end
Start loop »emit S ; pause end
Start loop emit S ; »pause end
Start loop emit S ; pause end
Resume »loop emit S ; pause end
Resume loop emit S ; »pause end
Resume loop »emit S ; pause end
Resume loop emit S ; »pause end
Resume loop emit S ; pause end
Overview • Building an Intermediate Representation • Giving it a (proper) meaning, based on existing semantics • Some interesting classes of programs • Simulation and tentative optimization
What Esterel • Esterel v5 (with data) • In this paper, examples without data
signal S in emit S ; pause || present S then pause end end
signal S in emit S ; pause1 ||3 present S then pause2 end end
Organizing Actions in a Graph »signal S in emit S ; pause1 ||3 present S then pause2 end end start ·
Organizing Actions in a Graph · signal S in »emit S ; pause1 ||3 »present S then pause2 end end start enter 3 fork ·
Organizing Actions in a Graph · signal S+ in emit S ; »pause1 ||3 »present S then pause2 end end S start enter 3 fork ·
Organizing Actions in a Graph · signal S+ in emit S ; »pause1 ||3 present S then »pause2 end end S start enter 3 fork F S · T
Organizing Actions in a Graph enter 1 · signal S+ in emit S ; pause1 ||3 present S then »pause2 end end S start enter 3 fork F S · T p
Organizing Actions in a Graph enter 1 · signal S+ in emit S ; pause1 ||3 present S then pause2 end end S start enter 3 fork F S enter 2 · T p p
Organizing Actions in a Graph join enter 1 pause(1) signal S in emit S ; pause1 ||3 present S then pause2 end end S start enter 3 fork term(2) F pause S pause · enter 2 pause(2) T
Organizing Actions in a Graph join enter 1 pause(1) »signal S in emit S ; pause1 ||3 present S then pause2 end end S start enter 3 fork term(2) F pause S pause enter 2 pause(2) T join F inactive(1) active 1 exit 1 term(1) resume T fork · F inactive(2) active 2 term exit 3 term T exit 2 term(2)
Organizing Actions in a Graph join enter 1 pause(1) signal S- in emit S ; »pause1 ||3 present S then »pause2 end end S start enter 3 fork term(2) F pause S pause enter 2 pause(2) T join F F inactive(1) active 1 exit 1 term(1) · resume T fork F inactive(2) active 2 term exit 3 term T exit 2 · term(2)
Organizing Actions in a Graph join enter 1 pause(1) signal S- in emit S ; pause1 ||3 present Sthen »pause2 end end S start enter 3 fork term(2) F pause S pause enter 2 pause(2) T t join F F inactive(1) active 1 exit 1 term(1) · resume T fork F inactive(2) active 2 term exit 3 term T exit 2 · term(2)
Organizing Actions in a Graph join enter 1 pause(1) signal S- in emit S ; pause1 ||3 present S then pause2 end end S start enter 3 fork term(2) F pause S pause enter 2 pause(2) T t t join F F inactive(1) active 1 exit 1 term(1) · resume T fork F inactive(2) active 2 term exit 3 term T exit 2 · term(2)
Organizing Actions in a Graph join enter 1 pause(1) signal S in emit S ; pause1 ||3 present S then pause2 end end S start enter 3 fork term(2) F pause S pause enter 2 pause(2) T join F inactive(1) active 1 exit 1 term(1) resume T fork F inactive(2) active 2 term exit 3 term · T exit 2 term(2)
Intermediate format • Vertices – represent computation • test • fork • join (parallel branch termination synchronizing) • emit • state/memory update action • Edges – control flow and signal dependencies S S
State representation issues • no state encoding decision yet • intuitive semantics: • one boolean variable per pause and composed statement • all false, in the beginning • enter sets it to 1, exit sets it to 0 • several possible encoding techniques • optimization issues
Semantics • SOS rules (using Cannot auxiliary functions) - dynamic • CCFG-like semantics on the intermediate graph • Translation to Constructive Circuits – fine grained, static
SOS rules k , E’ p’ p’’ E p’, p’’ are terms over statement p k {} – completion code E:S v{0,1,} – input event E’ – emitted signal or 0 , E’ p’ p E , E’ p’;q p;·q E
SOS rules ,S p’ p’’ E(S,) , signal S in p’end signal S+ in p’’ end E SCannot(p’) , signal S inp’end signal S- in p’ end E CONSTRUCTIVE
CCFG-based semantics • goal is sequential code generation • graph interpreted as a classical flowchart • limited class of programs • related to intermediate representation of Stephen Edwards and of the CNET group • graph acyclicity required • lesser grain • static
CCFG-based semantics ,S p’ p’’ E(S,) , signal S, in p’end signal S ,+ in p’’ end E SCannot’(p’) , signal S, + in p’end signal S+ in p’ end E SCannot’(p’) , signal S, inp’end signal S- in p’ end E
S Cannot(p’) • CCFG view • all the signal emission statements have been ruled out by executed tests • Constructive view • all the signal emission statements have been ruled out by either: • executed tests • not yet executed tests for which the test condition is already computed so that we can prune one of the test branches.
Acyclicity • Can be defined on both intermediate graph and associated circuit • Simple (cheap) correctness criteria for big programs • Basis of static scheduling • Problem: graph acyclicity is not the same as circuit acyclicity • what is a compilable program
Acyclicity discrepancy signal S in [ nothing || present I then nothing else present S then pause else pause end end present ]; emit S end signal term term(1) S start fork T term(2) pause I pause(2) T F S F
Acyclicity discrepancy signal S in [ nothing || present I then nothing else present S then pause else pause end end present ]; emit S end signal term term(1) S start fork T term(2) pause I pause(2) T F S F
Acyclicity discrepancy signal S in [ nothing || present I then nothing else present S then pause else pause end end present ]; emit S end signal term S start T pause T F F
Acyclicity discrepancy • Possible solutions: • splitting the synchronizers with problems, and so borrow some expressive power from circuit semantics • duplicate cycle code based on the trigger or the problem test (improve the CCFG model)
Compilable Program Classes acyclic circuit acyclic CCFG
Compilable Program Classes acyclic circuit acyclic CCFG
Static analysis • Graph arc removal in the circuit • Results hold in CCFG, if the result is acyclic • Problem: causality • Some particular simplifications proved, like erasing dependencies based on state incompatibility
Static analysis • What I would like to do term term(1) S start fork T term(2) pause I pause(2) T F S · F
Static analysis • What I would like to do term term(1) S start fork T term(2) pause I pause(2) T F S · F
Static analysis • What I would like to do term term(1) S start fork T term(2) pause I pause(2) T F S · F
Compilable Program Classes acyclic after simplif. acyclic circuit acyclic CCFG
Compilable Program Classes correct programs acyclic after simplif. acyclic circuit acyclic CCFG
Cyclic specifications • Proving correctness – not my goal • Execution (Simulation)
Cyclic specifications • 3-valued simulation • Resynthesis of cyclic parts