outline composition, conformance topologies proof of solution node flexibilities examples node...

60
Outline • Composition, Conformance • Topologies • Proof of solution • Node flexibilities • Examples • Node minimization • Windowing • C-progressive

Post on 20-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Outline

• Composition, Conformance

• Topologies

• Proof of solution

• Node flexibilities

• Examples

• Node minimization

• Windowing

• C-progressive

Composition

• Synchronous

• Asynchronous (parallel)

• Mapping Asynchronous to Synchronous

X Y{{ }|{( )} }i i i

X X YXL L

X Y {{( )} |{ } }i iX XY

L L

Composition (synthronous or asynchronous) – involves two steps1. Make the two machines have the same input alphabet (support)2. Perform the product

Synchronous (changing the support)1. Projection – Given a language L over the alphabet

projection is defined as2. Lifting – given a language L over the alphabet X, lifting

to the alphabet is defined as

X Y{{ ( )} |{ } }X i iX

L p L if

( ) otherwisei i

X i

Xp

X Y*{{ }|{ } , }i i i i i iY

L x x L Y

Asynchronous (changing the support)1. Restriction – Given a language L over the alphabet ,

the restriction to X is defined as where

2. Expansion – given a language L over X, lifting to the alphabet is defined as

Mapping Parallel into SynchronousSuppose F is a FSM on inputs i,v and outputs u and S is an FSM on inputs i and outputs o.

FFi

u

SSi o

The semantics are that when an input comes into a module, it takes an unspecified amount of time for the module to produce an output. This will be modeled with a non-deterministic self-loop labeled with

v XXo

i/u

i u

s s’

s’’

s s’Similarly for the others. For S a transition of the type (q i/o q’) becomes (q i q’’) (q’’ o q’).

Transitions of F (as an FSM) are one of the forms (s i/u s’) or (s v/u s’).

For S, its transitions are of the type (q i/o q’). For each, we convert into automata by creating new intermediate states between inputs and outputs. Thus a transition (s i/u s’) becomes two transitions (s i s’’) (s’’ u s’).

i o

q q’

q’’

We want to lift up the language of F to include o and arbitrary delays so that iuvu becomes for example:

And S to include u and v and arbitrary delays, so that the two languages can contain similar strings. io becomes for example

In particular, they both can become the same thing:

i uoo o o o ov u

uvu vvvu uui o

i u v u o i u v u o

This is done on the automaton F by the following:i1/u1 v1/u2

becomes

i uoo o o o ov u

uvu vvvu uui o The common symbols act to synchronization

1i 1u 1v 2u

,o ,o ,o ,o ,oNote the alphabet is

i v u o

With these conversions, we can do synchronous composition and get the equivalent expanded result of parallel composition S FThus we need to implement only one type of compositional method – synchronous, and simply have a mapping of each machine into its extended machine to compose in parallel. Finally, we can take the synchronous solution and map it back into an FSM.

Similarly for S:i1/o1

becomes i1 o1

, ,u v

Note that all states are deterministic since the alphabet is

i1

, ,u v , ,u v

, ,u v

i v u o

ConformanceSimulation Relation ( ) Let 1F and 2F

be two automata over the same alphabet

2F simulates 1F ( 1 2F F ) if there exists a simulation relation

1 2S S S such that

'1 2 2

' ' ' '1 1 2 2 1 2[( ) ( ) ( ) ]s s S s

s s s s s s S

Note that 2F simulates 1F implies that 1 2( ) ( )L F L Fbut these are not equivalent notions. If may be easier to find a simulation relation than to prove language containment.

Language Containment ( )

To show that 1 2F F (i.e. 1 2( ) ( )L F L F ) we typically show that 1 2F F

This requires complementing 2F which may be hard if

2F is non-deterministic (subset construction). So simulation may be easier to check.

Use of a simulation relation instead of language containment can allow avoidance of computing in the construction of . Note that if S is deterministic or small, then there is no motivation to avoid computing so using language containment is fine.

SF S

S

1 2( ) ( )L F L F

Proposition: If two FSMs, F1 and F2, and F2 is deterministic, then

1 2 1 2( ( ) ( )) ( ( ) ( ))L F L F L F L F

Language Equality ( )

Hence, if we are solving and S is a deterministic FSM then is the MSG.

F X SX F S

If S is ND, then what is MSG?

Comment: Clearly, we need in order for there to be a solution of . This requires that supp(S) supp(F), since otherwise there is a variable v in F but not in S. Then would be too large.

F SF X S

vS

I1

I2

O2

O1

U1U2

F

X

most general

Topologies

I1

O2

U1U2

X

Ftwo-waycascade

I1

O2

U1

F

X

one-waycascade

I1

O2

U1U2

F

Xtwo-waycascade

I1

O2

U1

X

F

one-waycascade

I1

O1

U1U2

F

Xrectification

I2

O2

U1U2

F

X

EngineeringChange

I2

U1=O1

U2

F

X

Controller

Communicating the internal state

I1

I2

O2

O1

U1U2

F

X

I1

I2

O2

O1

U1U2

F

X

cs

latch_exposelatch_expose

Hiding only the outputs

I O

UV

F

X

Thus the only variables that X does not see are the O variables. In the construction, for the most general solution,

is deterministic. The only variables eliminated before complementation are O. The only way it could become ND is if ivuo on a pair of arcs have the same values of ivu, but different o’s. Thus if o is a deterministic function of i,v, o = f (i,v,cs), this could not happen.

( ( ) )U V I U V

X F S

( )U V

F S

Theorem: If O is a deterministic function of i,v,cs, the second complementation is easy (no subset construction).

( ( ) )U V I U V

X F S

Hiding the outputs only

i’u’v’o1

iuvo2

The only way it could become non-deterministic after hiding o is if i’u’v’ = iuv. But then o1 = o2 which means that the product machine was ND.

Solving a language equationSolve A X C where { , } and { , , }

In particular, find the largest solution X (most general solution).

Theorem A: Let A and C be languages over alphabets I U and I O respectively. For the equation, A X C the most general solution is ( )

O U U OX A C

Theorem B: Let A and C be languages over alphabets I U and I O respectively. For the equation, A X C the most general solution is ( )

O U U OX A C

Proof: We prove Theorem A. Let *( )U O . Then A C means that

( )

( )

( )

( ) ( )

( )

( )

O I I O

O I U I O

O I U

O I U U O

I U O O U U O

O U U O

O U U O

A C

A C

A C

A C

A C

A C

A C

A C

Thus A C is the largest solution of A X C The proof of Theorem B is similar.

I

OU

A

X

Computing the CF for a node -Computing the CF for a node -global stepglobal step

iy

X Z

( , ) ( , )( ], )[ , ispe

i ZcRR X X y ZZy R X

( , , )iR X y Z

Computing CF - local step

( ( , ),, [ )( ) ]ii X ii M X R XCF y YY y

iy

X ZjY

( , ) [ [( , ) ( , (, ) , ]])i i X Zisp c

ieM X Y R X yCF R ZY y Z X

( , )iM X YYi

YYiiyyii

CFCF

X Z

iy

YYiiyyii

YYii yyii

( , )iM X Y

,

(( , ) ( ,( , ) [ [ ]]

[ ( , ) ( , , )]

,

(

, )

, )

) si i X Z

specX Z i i

ipec

i R XM X Y R XCF Y y

M X

Z

Y R X y Z R

y

X Z

Z

( , )iM X Y

Note that essentially the same computation applies for multiple-Note that essentially the same computation applies for multiple-output nodes, i.e. where output nodes, i.e. where

1{ , , }ki i iy y y

FSM networks – computing complete sequential flexibility (CSF)

contextcontext

unknownunknown

ii oo

uuvv

spec

Specification Specification S S ((i,oi,o))

Context Context C C ((i,v,u,oi,v,u,o))

Unknown Unknown X X ((u,vu,v))

Problem:Problem: Given Given SS and and C C , find the Most , find the Most General Solution (MGS) ofGeneral Solution (MGS) of

X C S

FSMFSM

FSMFSMFSM

FSMFSM

FSMFSM

FSMFSM

FSMFSM

i1i1

i2i2 oo

FSM Networks

The most general solution (MGS) of X C S

is

( , , , ) ( , )( ( ) )

i v u o u vMGS C S

contextcontext

unknownunknown

ii oo

uuvv

spec

In general, MGSMGS is deterministic automatonbut as an FSM it is non-deterministic (NDFSM)(NDFSM)

Complete Sequential Flexibility (CSF)

• CSF is maximum sub-behavior in MGS which is prefix closed and uu-progressive.– For unknown to be an FSM, it must be

progressive in its inputs

CSFCSF

uuvv

Comparison with combinational case

, ( , , , ) ( , )( , ) ( ( ) )i o i v u o u v

CSF u v C S

,( , ) [ ( , ) ( , , )] ( , )speci i X Z i iCF Y y M X Y R X y Z R X Z

contextcontext

unknownunknown

ii oo

uu vv

spec

, ( , ) ( , ,

( , )]

)[spe

X iZ i

c

M X Y R X y Z

R X Z

X

YYii yyii

( , )iM X Y

( , , )iR X y Z

unknownunknown

Sequential

Combinational

Extending CF

FSMFSM

Combinationalsub-block

IO

uu vv

Spec is IO behavior of FSM. Combinational block is treated as unknown X with inputs u and outputs v. We derive the CSF for X. It is different than the CF where the spec is taken to be the combinational behavior of the FSM, i.e. with inputs I,CS and outputs O,NS. Also, if we extract from X a maximum combinational subpart (combinational projection), it is also different that CF

X

AlgorithmAlgorithmAlgorithm:: LanguageEquationSolvingLanguageEquationSolving

InputInput::prefix-closed deterministicprefix-closed deterministic S(i.o)S(i.o) andand C(i,v,u,o)C(i,v,u,o)OutputOutput:: most general prefix-closed,most general prefix-closed,

progressiveprogressive X X (FSM)(FSM)beginbegin

0101 XX := := CompleteComplete ( ( SS,, non-accepting )non-accepting )0202 XX := := Determinize&ComplementDeterminize&Complement ( ( XX ) )0303 X X := := Support Support ((XX, (, (i,v,u,oi,v,u,o)) - )) - raiseraise

0303 XX := := ProductProduct ( ( CC,, X X ) )0404 XX := := SupportSupport ( ( XX, (, (u,vu,v) ) - ) ) - hidehide

0505 XX := := DeterminizeDeterminize &Complement&Complement ( ( XX, , u u ))0606 returnreturn Prefix&ProgressivePrefix&Progressive ( (X X ))

endend

S

( , , , )( )

i v u oS

( , , , )( ( ) )

i v u oC S

( , , , ) ( , )( ( ) )

i v u o u vC S

( , , , ) ( , )( ( ) )

i v u o u vC S

Convert to FSMConvert to FSM

Examples

• Games– Nim– Tic-tac-toe– Toe-tac-tic– Board

• Control– Wolf, goat, cabbage

• Latch splitting

Example: Coin Game (NIM)

In God WeTrust

In God WeTrust

In God WeIn God WeTrustTrust

1. Players alternate turns2. On each turn, player can take 1-n coins from any one pile3. Player who takes last coin loses

Winning strategyWinning strategy: Give your opponent a pile of coins with even number of 1’s in bit columns (except at end)

Example: 6 5 36 = 1 1 05 = 1 0 13 = 0 1 1 ____ 2 2 2

ContextContext describes the state of the game and legal moves. Its inputinput is random moves by first player and its outputoutput tells if the game is in a losing, winning or continuing state.

SpecificationSpecification is a 3-state automaton, playing, won, and lost.

.model game-piles

.inputs p1 d1 p2 d2

.outputs out

.mv p1,p2,p,pt,ptt 3

.mv d1,d2,d 7

.mv cs0,cs1,cs2,ns0,ns1,ns2,nh,h 7

.mv whoseturn,whoseturn1 2 1 2

.mv out 3 OK notOK done

.latch ns0 cs0

.reset cs0 3.latch ns1 cs1.reset cs1 2.latch ns2 cs2 .reset cs2 1

.latch whoseturn1 whoseturn

.reset whoseturn1#set this to 2 if Player 2 goes first.

.table whoseturn whoseturn1

.default 22 1

.table whoseturn d1 d2 d1 - - =d12 - - =d2

.table whoseturn p1 p2 ptt1 - - =p12 - - =p2

NIM

.model spec

.inputs out

.outputs Acc

.mv out 3 OK notOK done

.mv CS,NS 3 a b c

.table CS ->Acc

.default 1b 0.table out CS ->NSOK a anotOK a bdone a c- b b- c c.latch NS CS.reset CSa.end

spec.mva

# The next state ns is due to the move.

.table p nh cs0 ns00 - - =nh(1,2) - - =cs0

.table p nh cs1 ns11 - - =nh(0,2) - - =cs1

.table p nh cs2 ns22 - - =nh(0,1) - - =cs2

#"out" indicates who the winner is..table whoseturn ns0 ns1 ns2 out.default OK1 0 0 0 done2 0 0 0 notOK

.end

# Map move into a legal move.table ptt cs0 cs1 cs2 pt0 (1,2,3,4,5,6) - - 01 - (1,2,3,4,5,6) - 12 - - (1,2,3,4,5,6) 20 0 - - 11 - 0 - 22 - - 0 0.table pt cs0 cs1 cs2 p0 (1,2,3,4,5,6) - - 01 - (1,2,3,4,5,6) - 12 - - (1,2,3,4,5,6) 20 0 - - 11 - 0 - 22 - - 0 0#selects the height of the pile chosen by player 1.table p cs0 cs1 cs2 h0 - - - =cs01 - - - =cs12 - - - =cs2#computes h-d. If h<=d then =0.table h d nh.default 06 1 56 2 46 3 36 4 26 5 15 1 45 2 35 3 25 4 14 3 14 2 24 1 33 2 13 1 22 1 1

rl fixed.mvstg_extract fixed.mvaecho "Synthesis ..."determinize -ci spec.mva spec_dci.mvasupport p2(3),d2(7),p1(3),d1(7),out(3) spec_dci.mva spec_dci_supp.mvasupport p2(3),d2(7),p1(3),d1(7),out(3) fixed.mva fixed_supp.mvaproduct fixed_supp.mva spec_dci_supp.mva p.mvasupport p1(3),d1(7),p2(3),d2(7) p.mva p_supp.mvadeterminize -ci p_supp.mva p_dci.mvaprefix p_dci.mva p_dci_pre.mvaprogressive -i 2 p_dci_pre.mva x.mvaminimize x.mva x-min.mvaprefix x-min.mva x-min.mvaecho "Verification ..."support p2(3),d2(7),p1(3),d1(7),out(3) x.mva x_supp.mvaproduct x_supp.mva fixed_supp.mva prod.mvasupport p2(3),d2(7),p1(3),d1(7),out(3) spec.mva spec_supp.mvacheck prod.mva spec_supp.mva

Lang.script (NIM)

mvsis 02> source lang.scriptThe STG with 40 states and 110 transitions is written to file "fixed.mva".Synthesis ...The automaton is deterministic; determinization is not performed.Product: (40 st, 110 trans) x (3 st, 5 trans) -> (42 st, 112 trans)The automaton is deterministic; determinization is not performed.Warning: The automaton has been completed before state minimization.State minimization: (22 states, 45 trans) -> (13 states, 30 trans)Verification ...Product: (21 st, 34 trans) x (40 st, 110 trans) -> (21 st, 34 trans)Warning: Automaton "game-piles*spec*game-piles" is completed before checking.The behavior of "game-piles*spec*game-piles" is contained in the behavior of "spec".mvsis 03> psa x-min.mva"game-piles*spec": incomplete (9 st), deterministic, non-progressive (9 st), and non-Moore (9 st).4 inputs (4 FSM inputs) 12 states (12 accepting) 19 transInputs = { p1(3),d1(7),p2(3),d2(7) }mvsis 03>

Example of CSF computation:Example of CSF computation:NDFSM represented as NDFSM represented as automatonautomaton

In God WeTrust

In God WeTrust

In God WeIn God WeTrustTrust

Inputs p1(3),d1(7)Outputs p2(3),d2(7)

Tic-tac-toe

.model spec

.inputs m1 c1 m2 c2

.outputs out

.mv m1,m2 9

.mv out 3

.table ->out02.end

#.model spec.inputs out.outputs Acc.mv out 3 .mv CS,NS 3 a b c

.table CS ->Acc

.default 1b 0

.table out CS ->NS0 a a1 a b2 a c- b b- c c

.latch NS CS

.reset CSa.end

spec.mv

spec.mva

.model game-tic-tac-toe

.inputs m1 m2

.outputs out

.mv out 3

.mv m1,m2,m 9

.mv cs0,cs1,cs2,cs3,cs4,cs5,cs6,cs7,cs8 3

.mv ns0,ns1,ns2,ns3,ns4,ns5,ns6,ns7,ns8 3

.mv whoseturn,whoseturn1 2 1 2

.latch whoseturn1 whoseturn

.reset whoseturn1.latch ns0 cs0.reset cs0 0.latch ns1 cs1.reset cs1 0.latch ns2 cs2 .reset cs2 0.latch ns3 cs3 .reset cs3 0.latch ns4 cs4 .reset cs4 2# set this to 0 if player 2 makes the second move..latch ns5 cs5 .reset cs5 0.latch ns6 cs6 .reset cs6 0.latch ns7 cs7 .reset cs7 0.latch ns8 cs8 .reset cs8 0

.table illegal whoseturn whoseturn10 2 10 1 21 - =whoseturn.table whoseturn m1 m2 m1 - - =m12 - - =m2# Player makes a illegal move if the square indicated by mt in not empty.table m cs0 cs1 cs2 cs3 cs4 cs5 cs6 cs7 cs8 illegal.default 10 0 - - - - - - - - 01 - 0 - - - - - - - 02 - - 0 - - - - - - 03 - - - 0 - - - - - 04 - - - - 0 - - - - 05 - - - - - 0 - - - 06 - - - - - - 0 - - 07 - - - - - - - 0 - 08 - - - - - - - - 0 0# out records if there is a line of 2's (then out=2) or a line of 1's (then out=1).table whoseturn ns0 ns1 ns2 ns3 ns4 ns5 ns6 ns7 ns8 out.default 02 - - 2 - 2 - 2 - - 22 2 2 2 - - - - - - 22 2 - - 2 - - 2 - - 22 2 - - - 2 - - - 2 22 - - - 2 2 2 - - - 22 - - 2 - - 2 - - 2 22 - 2 - - 2 - - 2 - 22 - - - - - - 2 2 2 21 - - 1 - 1 - 1 - - 11 1 1 1 - - - - - - 11 1 - - 1 - - 1 - - 11 1 - - - 1 - - - 1 11 - - - 1 1 1 - - - 11 - - 1 - - 1 - - 1 11 - 1 - - 1 - - 1 - 11 - - - - - - 1 1 1 1

# Once the game gets into a winning configuration, do not change the state..table cs0 cs1 cs2 cs3 cs4 cs5 cs6 cs7 cs8 done.default 0- - 2 - 2 - 2 - - 12 2 2 - - - - - - 12 - - 2 - - 2 - - 12 - - - 2 - - - 2 1- - - 2 2 2 - - - 1- - 2 - - 2 - - 2 1- 2 - - 2 - - 2 - 1- - - - - - 2 2 2 1- - 1 - 1 - 1 - - 11 1 1 - - - - - - 11 - - 1 - - 1 - - 11 - - - 1 - - - 1 1- - - 1 1 1 - - - 1- - 1 - - 1 - - 1 1- 1 - - 1 - - 1 - 1- - - - - - 1 1 1 1# If there is a winner (done=1) then the state remains unchanged.# Otherwise, if m=i and whoseturn=1, then csi=1. Similarly, if # m=i and whoseturn=2, then csi=2 .table illegal done cs0 m whoseturn ns0#.default 00 1 - - - =cs00 0 - 0 1 10 0 - 0 2 20 0 - (1,2,3,4,5,6,7,8) - =cs01 - - - - =cs0.table illegal done cs1 m whoseturn ns1#.default 00 1 - - - =cs10 0 - 1 1 10 0 - 1 2 20 0 - (0,2,3,4,5,6,7,8) - =cs11 - - - - =cs1.table illegal done cs2 m whoseturn ns2#.default 00 1 - - - =cs20 0 - 2 1 10 0 - 2 2 20 0 - (0,1,3,4,5,6,7,8) - =cs21 - - - - =cs2

.table illegal done cs3 m whoseturn ns3#.default 00 1 - - - =cs30 0 - 3 1 10 0 - 3 2 20 0 - (0,1,2,4,5,6,7,8) - =cs31 - - - - =cs3.table illegal done cs4 m whoseturn ns4#.default 00 1 - - - =cs40 0 - 4 1 10 0 - 4 2 20 0 - (0,1,2,3,5,6,7,8) - =cs41 - - - - =cs4.table illegal done cs5 m whoseturn ns5#.default 00 1 - - - =cs50 0 - 5 1 10 0 - 5 2 20 0 - (0,1,2,3,4,6,7,8) - =cs51 - - - - =cs5.table illegal done cs6 m whoseturn ns6#.default 00 1 - - - =cs60 0 - 6 1 10 0 - 6 2 20 0 - (0,1,2,3,4,5,7,8) - =cs61 - - - - =cs6.table illegal done cs7 m whoseturn ns7#.default 00 1 - - - =cs70 0 - 7 1 10 0 - 7 2 20 0 - (0,1,2,3,4,5,6,8) - =cs71 - - - - =cs7.table illegal done cs8 m whoseturn ns8#.default 00 1 - - - =cs80 0 - 8 1 10 0 - 8 2 20 0 - (0,1,2,3,4,5,6,7) - =cs81 - - - - =cs8.end

Lang.script (tic-tac-toe)rl fixed1.mvlatch_exposestg_extract fixed.mva

echo "Synthesis ..."determinize -ci spec.mva spec_dci.mvasupport cs0(3),cs1(3),cs2(3),cs3(3),cs4(3),cs5(3),cs6(3),cs7(3),cs8(3), whoseturn(2),m1(9),m2(9),out(3) spec_dci.mva spec_dci_supp.mvasupport cs0(3),cs1(3),cs2(3),cs3(3),cs4(3),cs5(3),cs6(3),cs7(3),cs8(3), whoseturn(2),m1(9),m2(9),out(3) fixed.mva fixed_supp.mvaproduct fixed_supp.mva spec_dci_supp.mva p.mvasupport cs0(3),cs1(3),cs2(3),cs3(3),cs4(3),cs5(3),cs6(3),cs7(3),cs8(3),

whoseturn(2),m2(9) p.mva p_supp.mvadeterminize -ci p_supp.mva p_dci.mvaprefix p_dci.mva p_dci_pre.mvaprogressive -i 10 p_dci_pre.mva x.mvaminimize x.mva x-min.mvaprefix x.mva x-min.mva

Wolf, goat, cabbage.model wolfe.inputs in.outputs out.mv in,in1 4 empty wolfe goat cabbage.mv csw,csg,csc,nsw,nsg,nsc 3 left right boat.mv bank,bank1 2 left right.mv out 3 OK notOK done.latch stop1 stop.reset stop0.latch nsw csw.reset csw left.latch nsg csg.reset csg left.latch nsc csc.reset csc left.latch bank1 bank.reset bankleft.table out stop stop1.default 0done - 1- 1 1.table stop bank bank1.default left0 left right1 - =bank

.table stop bank in1 csw nsw0 left (empty,goat,cabbage) boat left0 left wolfe (left,boat) boat0 right (empty,goat,cabbage) boat right0 right wolfe (right,boat) boat0 - (empty,goat,cabbage) (left,right) =csw1 - - - =csw.table stop bank in1 csg nsg0 left (empty,wolfe,cabbage) boat left0 left goat (left,boat) boat0 right (empty,wolfe,cabbage) boat right0 right goat (right,boat) boat0 - (empty,wolfe,cabbage) (left,right) =csg1 - - - =csg.table stop bank in1 csc nsc0 left (empty,goat,wolfe) boat left0 left cabbage (left,boat) boat0 right (empty,goat,wolfe) boat right0 right cabbage (right,boat) boat0 - (empty,goat,wolfe) (left,right) =csc1 - - - =csc.table bank nsw nsg nsc out.default OKright left left - notOKleft right right - notOKright - left left notOKleft - right right notOKright (right,boat) (right,boat) (right,boat) done# map input (in) into any legal input.table bank in csw csg csc in1.default emptyright wolfe (right,boat) - - =inleft wolfe (left,boat) - - =inright goat - (right,boat) - =inleft goat - (left,boat) - =inright cabbage - - (right,boat) =inleft cabbage - - (left,boat) =in.end

out

in(boat)

.model spec

.inputs out

.outputs Acc

.mv out 3 OK notOK done

.mv CS,NS 3 a b c

.table CS ->Acc

.default 1b 0

.table out CS ->NSOK a anotOK a bdone a c- b b- c c

.latch NS CS

.reset CSa.end

spec.mva spec.mva for wolf-goat-cabbagefor wolf-goat-cabbage

rl wolfe.mvstg_extract fixed.mva

echo "Synthesis ..."determinize -lci spec.mva spec_dci.mvasupport in(4),out(3) spec_dci.mva spec_dci_supp.mvasupport in(4),out(3) fixed.mva fixed_supp.mvaproduct -l fixed_supp.mva spec_dci_supp.mva p.mvasupport in(4) p.mva p_supp.mvadeterminize -lci p_supp.mva p_dci.mvaprefix p_dci.mva p_dci_pre.mvaprogressive -i 0 p_dci_pre.mva x.mvaminimize x.mva x-min.mvaprefix x-min.mva x-min.mva

echo "Verification ..."support in(4),out(3) x.mva x_supp.mvaproduct x_supp.mva fixed_supp.mva prod.mvasupport in(4),out(3) spec.mva spec_supp.mvacheck prod.mva spec_supp.mva

lang.scriptlang.script

Wolf, goat, cabbagex.mva

Minimizedx-min.mva

Other Games1. Toe-tac-tic (solvable)

– Like tic-tac-toe– Except that any player can play either X or O at any

time– A player wins when he completes a line or either X’s

or O’s

2. Board game (too many states)– 4 x 4 board– Each player has 4 pieces which initially at the top and

bottom rows of the board.– Any piece can move forward, left or right– Player wins when he moves one of his pieces to the

other side– 12870 reachable states – can’t do it right now

FSMFSM

Application - splitting FSM blif filesApplication - splitting FSM blif files

FSM2FSM2FSM1FSM1

uu

vv

ii

oo

This is just a syntactic change. Nothing has been done yet.

XX

Latch split

i oS i

cs1cs2

o

mvsis 05> _split -hUsage: _split [-v] <latch_list> splits the current network S into two parts: F and X generates the script to solve the equation F * X = S -v : toggles verbose [default = no]<latch_list> : the list of latches to be included in X no spaces are allowed in the latch list the numbers of latches are zero-based for example: 0,3,5-7,9mvsis 05>

Latch_split example.model s27.bench.inputs G0 G1 G2 G3.outputs G17.reset G5 0.latch G10 G5.reset G6 0.latch G11 G6.reset G7 0.latch G13 G7.table G0 G1 G3 G5 G6 G7 G17.default 01 1 - - - - 11 - 0 - - - 11 - - - - 1 1- - - 1 - - 1- 1 - - 0 - 1- - 0 - 0 - 1- - - - 0 1 1.table G0 G1 G3 G5 G7 G10.default 01 1 - - - 11 - 0 - - 11 - - 1 - 11 - - - 1 1.table G0 G1 G3 G5 G6 G7 G11.default 00 - - 0 1 - 1- 0 1 0 - 0 1.table G1 G2 G7 G13.default 01 0 - 1- 0 1 1.end

.model s27.bench

.inputs G0 G1 G2 G3 G5 G6

.outputs G17

.latch G13 G7 0

.names G0 G1 G3 G5 G6 G7 G1711---- 11-0--- 11----1 1---1-- 1-1--0- 1--0-0- 1----01 1.names G0 G1 G3 G5 G7 G1011--- 11-0-- 11--1- 11---1 1.names G0 G1 G3 G5 G6 G7 G110--01- 1-010-0 1.names G1 G2 G7 G1310- 1-01 1.end

.model s27.bench

.inputs G0 G1 G2 G3 G7

.outputs G17

.latch G10 G5 0

.latch G11 G6 0

.names G0 G1 G3 G5 G6 G7 G1711---- 11-0--- 11----1 1---1-- 1-1--0- 1--0-0- 1----01 1.names G0 G1 G3 G5 G7 G1011--- 11-0-- 11--1- 11---1 1.names G0 G1 G3 G5 G6 G7 G110--01- 1-010-0 1.names G1 G2 G7 G1310- 1-01 1.end

s27f (s27f (FF)) s27a (s27a (X’X’))

SS

# Language solving script generated by MVSIS# for sequential network "s27.blif" on Wed Feb 18 21:35:53 2004# Command line was: "split 0,1".

echo "Solving the language equation ... "solve s27f.blif s27.blif G0,G1,G2,G3,G7 G5,G6 s27x.autpsa s27x.aut

echo "Verifying the containment of the known implementation ... "read_blif s27a.bliflatch_exposestg_extract s27a.autsupport G0,G1,G2,G3,G7,G5,G6 s27a.aut s27a.autcheck s27a.aut s27x.autread_blif s27.blif

s27x.aut

s27x-dcmin.aut

s27a.blif

inputsinputs outputsoutputsG0, G1, G2, G3, G7G0, G1, G2, G3, G7, G5, G6, G5, G6

FSM networks - Node MinimizationFSM networks - Node Minimization

Given a NDFSM Given a NDFSM CSFCSF, find the “smallest” FSM , find the “smallest” FSM YY, such that , such that YY is is well-definedwell-defined and and

Y CSF

YY is called a is called a reductionreduction of CSF of CSF

State graph of X

It generally looks likeIt generally looks likenon-acceptingnon-accepting

don’t care statedon’t care state

C-compatibility - C-compatibility - dcmindcmin

Two states and are c-compatible if their Two states and are c-compatible if their carecare sets do not intersect, i.e. the care set of sets do not intersect, i.e. the care set of one is completely contained in the don’t care one is completely contained in the don’t care set of the other.set of the other.

1s 2s

ss11 ss22 states

u-spaceCareCaresetset

CareCaresetset

RemainingRemainingDCDC

,( , ) ( , , , )v nsY cs u X cs u v ns1 2( , ) ( , )Y s u Y s u

X X ((cs,u,v,nscs,u,v,ns))

uu vv

A simple state reduction method-A simple state reduction method-dcmindcmin• Let Let be the relation for the be the relation for the incompleteincomplete CSFCSF XX, and compute, and compute

– i.e. those states and inputs for which there exists a next state and output (the i.e. those states and inputs for which there exists a next state and output (the next state can be either accepting or not).  next state can be either accepting or not).  

• Order this BDD with the Order this BDD with the uu variables first, and let be the unique functions variables first, and let be the unique functions below the below the uu variables pointed to. variables pointed to.

• Two states and Two states and areare c-compatible c-compatible if and only if if and only if for all for all ii, , i.e. they have no minterm i.e. they have no minterm uu in common. in common.

• So is a clique of states that can't be merged, i.e. are not c-compatible and So is a clique of states that can't be merged, i.e. are not c-compatible and must have different colors. must have different colors.

• Then the c-incompatibility graph is which has to be Then the c-incompatibility graph is which has to be colored. colored.

• Suppose is the assignment of states Suppose is the assignment of states ss  to colors  to colors cc. The new automaton . The new automaton relation for relation for XX is then is then

      

, '( , ) ( , , , ')v sY s u X s v u s

( )ip s

( , ') ( ) ( ')i ii

I s s p s p s

1 2( ) ( ) 0i ip s p s 1s 2s

( )ip s

( , )Q s c

, ''( , , , ') ( , ) ( , , , ') ( ', ')s sX c v u c Q s c X s v u s Q s c

( , , , ')X s v u s

Simple state reduction

MergedMergedstatesstates Note that this is a Note that this is a

“simple” coloring “simple” coloring problem in contrast to problem in contrast to the compatibilities the compatibilities problem normally problem normally associated with state associated with state minimization for minimization for incompletely specified incompletely specified FSMs.FSMs.In contrast, here a In contrast, here a group of states is “c-group of states is “c-compatible” iff they are compatible” iff they are pair-wise c-compatible.pair-wise c-compatible.

uu-space-space CareCaresetset

CareCaresetset

CareCaresetset

RemainingRemainingDCDC

Other ideas on reduction of CSF• This problem is similar to SOP minimization when using CFCF to minimize

the node in the combinational network.• Many cost functions are possible. If we try to minimize the number of states

in CSFCSF, it is the problem of minimizing a PNDFSM – – T. Kam et. al., DAC 1994.

• We might want to look for a good implementation directly, rather than first minimizing the number of states. – Similarly, for a node in the combinational circuit, looking for a small SOP, or the

minimum number of literals in FF, may be misleading.• A specialized algorithm has been developed to check whether a

combinational solution (a single-state reduction) exists. – The problem is reduced to SAT with as many variables as there are states + transitions

in the CSFCSF. Solution is practical for, say, 100 states and 500 transitions.– A similar algorithm can be developed to check whether a 2 or 3 state solution exists

• more variables, the SAT problem is harder

Iterative language solving

The problem of computing the CSF can be iterative.1. Given F and S 2. Split F into F1 and F2

3. Solve F1 * X = S. 4. If we can reduce X to a smaller implementation than F2, replace

F2

5. Solve F2 * X = S6. If we can reduce X to a smaller implementation than F1, replace

F1

7. Set F = F1 * F2

8. If either F1 or F2 has changed, go to 2

FSM Windowing

XX

FSMFSM33

FSMFSM22

FSMFSM11

ii

XX11

XX22

XX33

X = XX = X11 * * XX22 * * XX33

CompositionallyCompositionallyProgressiveProgressive

• X should be compositionally progressive (c-progressive) with F – i.e. for every product state cs of X * F, the next state ns and output o should be defined for all i.

• Roland Jiang has proposed a way to use this to additionally trim the solution X during the subset construction. But he is not 100% sure it is right.

• Nina and Tiziano have another method for trimming and have proved that the largest c-progressive solution can contain well-defined FSM sub-behaviors that are not c-progressive.

• Roland has demonstrated that the above paper is wrong.

• Being c-progressive does not necessarily imply no combinational loops

• To hear a more detailed discussion, attend MVSIS weekly meeting Friday, 11-1pm in DOP center library (fishbowl)

• There might be a connection here with omega-automata.

FF

XX

ii oo

uu vv

spec

Future developmentsFuture developments• Objective is to push to the limit, the size of application that

can be done– Keep multi-level MV structure, given in MVSIS, as long as possible

(lecture on this later)– Use SAT in subset construction

• The bottleneck looks to be extracting good sub-behavior of CSF (reduction)– A sub-graph of the CSF usually not good enough– “Simplified” (dcmin) state minimization of CSF may be good first

step?

• Try for a good sub-behavior more directly without constructing CSF

• Try hierarchy and windowing applied to FSM network