Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

27
Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU

Transcript of Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Page 1: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Optimized State Encoding for Esterel Programs

Dumitru POTOP-BUTUCARU

Page 2: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Overview

• State of an Esterel program

• The optimizing property

• Applications:• Register removal• State re-encoding using the optimizing information

Page 3: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

State of an Esterel program

• Esterel statements:• p¦¦q , p;q , loop p end • emit S, present S then p else q end • signal S in p end • trap T in p end , exit T• suspend p when S end• pause

• derived statements: await S, abort p when S, sustain S , every S do p end

Page 4: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

State of an Esterel program

• Esterel program execution• Esterel = synchronous language• Program execution = sequence of synchronous execution instants (clock ticks)• Execution instant = instantaneous mapping:

(current state, input signals)

(next instant state,output signals)

Page 5: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

State of an Esterel program

• Global state and state of a statement• Program state = state of the pause statements in the program• State of a sub-statement = state of the pause sub-statements of the given statement• The state of a composed statement is the union of the states of its direct sub-statements

Page 6: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

State of an Esterel program

• Selection and selection tree• Selected statement = statement that has at least one active pause sub-statement• The selection status of composed statement is the OR of the selection statuses of its direct sub-statements• Selection tree = the tree defined by the pause statements and the OR gates corresponding to the composed statements

Page 7: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

State of an Esterel program

• Selection nodes• pause nodes • exclusive selection nodes

• parallel selection nodes

p;qpresent S then p else q end

#

p q

p¦¦q

¦¦

p q

Page 8: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

State of an Esterel program

• Example

#

pausepause

loop present I then pause;emit O1 else pause;emit O2 end presentend loop

Page 9: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

State of an Esterel program

• Exampletrap TERMINATE in loop pause; emit O1; pause; emit O2 end loop¦¦ sustain RUNNING¦¦ await TERMINATE_SIGNAL; exit TERMINATEend trap

sustain await#

¦¦

pausepause

parallel

loop

Page 10: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property

• Exampletrap TERMINATE in loop pause; emit O1; pause; emit O2 end loop¦¦ sustain RUNNING¦¦ await TERMINATE_SIGNAL; exit TERMINATEend trap

sustain await#

¦¦

pausepause

parallel

loop

Page 11: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property

• Exampletrap TERMINATE in loop pause; emit O1; pause; emit O2 end loop¦¦ sustain RUNNING¦¦ await TERMINATE_SIGNAL; exit TERMINATEend trap

sustain await#

¦¦

pausepause

=

parallel

loop

Page 12: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property

• Exampletrap TERMINATE in loop pause; emit O1; pause; emit O2 end loop¦¦ sustain RUNNING¦¦ await TERMINATE_SIGNAL; exit TERMINATEend trap

sustain await#

¦¦

pausepause

=

parallel

loop

Page 13: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property

• Exampletrap TERMINATE in loop pause; emit O1; pause; emit O2 end loop¦¦ sustain RUNNING¦¦ await TERMINATE_SIGNAL; exit TERMINATEend trap

sustain await#

¦¦

pausepause

= =

parallel

loop

Page 14: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property

• Exampletrap TERMINATE in loop pause; emit O1; pause; emit O2 end loop¦¦ sustain RUNNING¦¦ await TERMINATE_SIGNAL; exit TERMINATEend trap

sustain await#

¦¦

pausepause

= ==

parallel

loop

Page 15: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property• If a parallel statement branch cannot terminate then the selection status of the branch

is equal, at each instant, with the selection status of the entire parallel statement

Page 16: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property

• Non-termination criteria• The static analysis of the Esterel program that is done at compile time• Cheap method (the information comes for free)

Page 17: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

The optimizing property

• Some statistics:selection tree nodes nodes with equal markexample

exclusive parallel pause total % pause %arbiter 4 1 8 4 28 0 0cabine 319 316 909 772 50 328 36

controleur 15 58 136 173 82 131 96global 525 612 1358 894 36 285 21mmid 32 21 109 61 37 28 26mmip 13 13 44 33 46 16 36

sequencer 67 31 153 84 33 38 25tcint 21 16 81 38 31 15 19

trains_trappes 79 46 156 121 43 34 22wristwatch 12 14 34 33 54 19 56

Page 18: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• Register removal

sustain await#

¦¦

pausepause

= ==

parallel

loop

parallel status=

loop status=

sustain status=

await status

Page 19: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• Register removal

sustain await#

¦¦

pausepause

= ==

parallel

loop

parallel status=

loop status=

sustain status=

await status

Page 20: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• Register removal

sustain

await

#

pausepause

parallel

loop

parallel status=

loop status=

sustain status=

await status

Page 21: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• Register removal

registersexample

initial after optimizationwristwatch 35 22 (62%)

tcint 82 61 (74%)

Page 22: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• State re-encoding• Exclusive selection nodes become switches that choose the selected son

#

#1 2 3

4 5

0

01 10 11

0 1

valuebit 0 bit 1 bit 2

selectednodes

0 0 - none0 1 - 1,01 0 - 2,0

0 4,3,01 1

1 5,3,0

Page 23: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• State re-encoding• The selection tree encoding is given by the encoding of all the

¦¦

#

#

=¦¦

#

#

=

Page 24: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• State re-encoding• The selection tree encoding is given by the encoding of all the sub-trees

¦¦

#

#

=

0

1 2

3 4

5 6

Page 25: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• State re-encoding• The selection tree encoding is given by the encoding of all the sub-trees

¦¦

#

#

=

0

1 2

4

5 6

valuebit 0 bit 1 bit 2

selectednodes

0 - - none0 - 1,0

0 5,4,2,01

11 6,4,2,0

Page 26: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications

• State re-encoding• The selection tree encoding is given by the encoding of all the sub-trees

3bit0

selectednodes

0 none1 3

Page 27: Optimized State Encoding for Esterel Programs Dumitru POTOP-BUTUCARU.

Applications• State re-encoding

regtree blifopt -area bitsexample registersnum % num % num %

arbiter 9 - - 4 45 5 55cabine 910 896 98 - - 433 47

controleur 137 - - - - 20 14global 1358 - - - - 935 68mmid 110 81 73 - - 56 51mmip 45 38 84 12 26 23 51

sequencer 154 118 76 - - 82 53tcint 82 35 42 22 26 21 25

trains_trappes 157 - - - - 79 50wristwatch 35 29 82 11 31 13 37transmitter 23 21 91 11 47 12 50