830 likes | 1.1k Views
Esterel tutorial. Mike Kishinevsky (Intel) Gerard Berry (Esterel Technology) Satnam Singh (Microsoft). UPC July 5, 2005. Outline. Esterel basics Hardware and software compilation Verification Late design changes (ECO) . Synchronous languages approach.
E N D
Esterel tutorial Mike Kishinevsky (Intel) Gerard Berry (Esterel Technology) Satnam Singh (Microsoft) UPC July 5, 2005
Outline • Esterel basics • Hardware and software compilation • Verification • Late design changes (ECO)
Synchronous languages approach • Time advances in lock step with one or more clocks • Abstraction of synchronous hardware and discrete control software • Deterministic concurrency • Concurrent processes always end up in a unique fix point state • Explicit well controlled non-determinism is allowed for modeling needs • Reactive • No input changes within a cycle => no internal and output changes • unless receivers look into past or emitters emit to the future • Safety: correct-by-construction implementation that can be checked • Convince customers, designers, certification authorities of safety • Solid mathematical foundation • Support formal reasoning, verification • Reviews: Proceedings of the IEEE [Sept. 1991, Jan. 2003]
Behavior of Synchronous System Cycle based read inputs compute reaction produce outputs Synchronous = within the same cycle propagate control propagate signals
Delay models • Synchronous languages : zero delay • Esterel, Lustre, Argos, SyncCharts, Signal, PBS, etc.. • Behavioral determinism • Choose the right order for dependent actions • Nice algebra => useful idealization Will not discuss today • Asynchronous languages : arbitrary delay • Petri Nets, CSP, Occam, Internet, etc. • Behavioral non-determinism • Determinism for sub-classes (e.g. delay-insensitive, speed-independent) • More complex than synchrony • Real computing and communication: some delay • Any implementation has some inertia and cost • Internal non-determinism is unavoidable • but, does not imply external non-determinism (e.g. RTL logic)
Zero delay example: Newtonian Mechanics Concurrency + Determinism Calculations are feasible
Predictable delay examples: sound, light, waves • Wait long enough, same result as 0-delay ! • Zero delay and predictable delay are fully compatible • Constructive semantics is the unification • A theory of causality for reactive systems • Clocked digital circuits paradigm
Synchronous Reactive Systems Esterel SyncCharts Argos PBS Lustre SCADE Signal Lava signals signals control data values values Esterel v7
Signals • Two possible states of a signal during clock cycle • present= emitted by somebody (encoded by “1”) • absent= otherwise (encoded by “0”) • Signal format <present_bit> <value_of_type> • present_bit is reactive (does not keep the value during next cycle) • value is persistent (carry the value to the next cycle) • Signal types • Pure (no value) – control • Value only (no present bit) – data • Valued – control bit (like a valid bit) and a data • Signal location: input, output, input-output, local • Full support for scoping of local signals
Combinational emit S if S then … else … end loop Sequential pause await S sustain S Some Esterel statements • Control flow: • Sequence: “;” • Concurrency: “||” • abort • if • loop • Data flow expressions: • ?A < 0 • ?B + ?C • call P() • ?D = f()
Sequencing emit A ; emit B ; pause ; emit C
Sequencing emit A ; emit B ; pause ; emit C A
Sequencing emit A ; emit B ; pause ; emit C A B
Sequencing wait for a cycle emit A ; emit B ; pause ; emit C A B
Sequencing emit A ; emit B ; pause ; emit C C A B
Looping loop emit A ; emit B ; pause ; emit C end loop C A B
Looping loop emit A ; emit B ; pause ; emit C end loop C A B
Looping loop emit A ; emit B ; pause ; emit C end loop C A B
Looping loop emit A ; emit B ; pause ; emit C end loop C A A B
Looping loop emit A ; emit B ; pause ; emit C end loop • Loop back in the same cycle • Non-instantaneous body • Loop invariant: cannot reenter if the body still executes C A B A B
Decision emit A ; emit B ; pause ; loop if C then emit D else Q end if; if E then emit F end if; pause end loop C C E E D D Q F A F B
Concurrency { await A ; emit C || await B ; emit D } ; emit E A B D E C • Start parallel statements in the same cycle • Terminate parallel block once all branches terminated B A C E D A B C D E
Preemption abort pause ; pause ; emit A when B ; emit C • Normal termination • Aborted termination • Aborted termination; emit A preempted A C B C B C
When to react? await A ; emit B await immediate A ; emit B A A A B B A A A B B • Non-immediate (default) form does not react to signals arrived during the initial instance (before the first tick)
When to kill? abort pause; emit A ; pause; emit B when C; emit D weak abort pause; emit A ; pause; emit B when C; emit D C C A D D C C B D A D A • Strong abort (default) kills all emissions during the abort cycle • Weak abort gives signal emissions the last will
Four (react, kill) possibilities When to react to A weak abortPwhenA abortPwhenA next abortP when immediateA weak abortP when immediateA now When to kill P next now
Esterel more concise than Verilog loop await caseicu_missdo if (notcacheble)then await (normal_ackorerror_ack) else abort await4 normal_ack whenerror_ack end end case(pcsu_powedownand notjmp_e and notvalid_diag_window)do await (pcsu_powerdownandnot jmp_e) end end ; pause end loop Example from S. Edwards
Esterel more concise than Verilog Write to memory as soon as Addr and Data have arrived. Wait for memory Latency before iterating. Restart behavior each Replay.
Esterel more concise than Verilog Write to memory as soon as Addr and Data have arrived. Verilog = explicit FSM Esterel: write things once { awaitAddr|| awaitData} ; emitWrite(funcW(?Addr,?Data)) ; A D A, D/W( ) D/W( ) A/W( )
Esterel more concise than Verilog Write to memory as soon as Addr and Data have arrived. Wait for memory Latency before iterating. Esterel: write things once Verilog = explicit FSM loop { awaitAddr|| awaitData} ; emitWrite(funcW(?Addr,?Data)) ; awaitLatencytick end loop A D A, D/W() D/W() A/W() L=0 X := L-1 X = 0 X > 0 / X:=X-1
Local events; concurrency/preemption; hierarchy; parameterization of delays; call things once Global state; state/transition explosion; flat; explicit counters; multiple calls Esterel more concise than Verilog Write to memory as soon as Addr and Data have arrived. Wait for memory Latency before iterating. Restart behavior each Replay. Verilog = explicit FSM Esterel: write things once R loop abort { awaitAddr|| awaitData} ; emitWrite(funcW(?Addr,?Data)) ; awaitLatencytick whenReplay end loop R A D R A, D/W() D/W() A/W() L=0or R X := L-1 X = 0orR X > 0 / X:=X-1
SyncCharts = Graphical Esterel SyncChart [C. Andre, …] Esterel code loop [ await A|| await B ] ; emit O each R Implemented in Esterel Studio
Extensions in Esterel v7 language Goal: remove the limitations of Esterel v5 much more expressive, but very same semantics • Mix of Esterel imperative and Lustre equational styles • Better modularity, (mild) object orientation • data, interface, and module units, data and interface inheritance • Structured ports, arrays, more signal kinds • value, temp, registered, etc. • Static code replication (for ... dopar) • Support for Moore machines • Numerical encodings • binary, onehot, Gray, etc. • Multi-clock, clock-gating • 100% synthesizableto RTL/C/SystemC, modular optimization
ZBT SSRAM SDRAM DDRSDRAM ROM OPB ZBT SSRAMController SDRAMController DDR SDRAMController External BusController OPB Bridge On-ChipPeripheral CoreConnect OPB(On-Chip Peripheral Bus) CoreConnect Processor Local Bus (PLB) Arbiter On-ChipPeripheral 405 PPC I-Cache PLB OPB Bridge D-Cache PLB High-SpeedPeripheral
Code generation VHDL, Verilog -> hardware implementation void uart_device_driver () { ..... } Esterel design uart.c C -> software implementation
Serial ATA • New standard for inside-the-box storage connection with cable length <1m • 100% SW compatible “drop in” replacement for ATA with additional capabilities (hot plug) • Fast low voltage differential signaling w/ 8b/10b encoding • 1.5Gbps -> 3.0Gbps -> 6.0Gbps • “Star” topology (point-to-point, no hubs) • Cost competitive with parallel ATA • Long term scalable solution
Serial ATA Architecture Transport Translates taskfile accesses to sequences of interface operations. Link Manages interface operations including transmission/reception of frames. SATA Host Controller Transport SW Interface PHY Transmits/receives serial signal and converts to/from digital. Task File Link PHY
How Esterel different from RTL phy_ready pmack /pmack JK-flop mod7 reset counter /pmack clear PMACK 1 1 0 1 1 + adv * suff + ! phy_ready / clear suff 0 = 2 0 set 1 3 0 7 PMWAIT adv pmack pmack clear clear adv adv • Explicit communication via three signals • Hard to ensure proper use in time: reset of data path • forgotten if not phy_ready at last counting cycle
The same spec in Esterel is correct-by-construction /* PMACK state */ abort sustainpmack when case not phy_ready case 7 adv end abort /* PMWAIT state */ PMACK /pmack <1> <2> not phy_ready 7 adv • No explicit communication • Compiler does the job, not designer • Behaviors and signals have local scope • If (not phy_ready) then automatic correct reset of counting data path • Sequential events and actions can be embedded into control (e.g. await 7 adv) PMWAIT
Verification with Observers Inputs Observed system System model Observer BUG Outputs BUG is possibly emitted BUG is always emitted Verifier BUG is never emitted
Verification engines • 2 proof engines available inside Esterel Studio • Built-in verifier : TiGeR • BDD technique • Prover Plug-in • SAT + numerical techniques • Handles control + data
Formal verification Of the OPB slave interface : proving that it won’t cause bus timeouts Proven in less than 2 seconds
Three methods • Esterel => FSM => encode => netlist • does not scale • Esterel => netlist (syntax-directed) => optimize • Main method in (v5 compiler) • Optimization both combinational and sequential • Modular compilation to scale (v6, v7) • Esterel => program graph => encode locally => netlist => optimize • Might give better trade-offs and still scale well • Columbia U. compiler (Edwards, …)
Syntax directed translation by example loop abort [awaitAddr || awaitData] ; callWrite (?Addr, ?Data) ; await [Latencytick] whenReplay end loop Addr GO SEL RES K0