Open pjljvandelaar opened 7 years ago
Or should we also explain how to use irrelevant values to initialize all variable? I.e.
CONSTDEF irrelevant :: Int ::= -1 ENDDEF
CHANDEF Channels ::=
Input, Output :: Int
ENDDEF
--State transitions
STAUTDEF fibonacci [Input, Output :: Int]() ::=
VAR fibm, fibn, count :: Int
STATE inputState, outputState
INIT inputState{ fibm := 1
; fibn := 1
; count := irrelevant
}
TRANS
inputState -> Input ? n [[ (n > 1) /\ (n < 100) ]] { count := n - 1 } -> outputState
outputState -> Output ! fibm + fibn [[ count == 1]] { fibm := 1; fibn := 1; count := irrelevant } -> inputState
outputState -> Output ! fibm + fibn [[ count > 1 ]] { fibm := fibn; fibn := fibm + fibn; count := count - 1 } -> outputState
ENDDEF
--System model
MODELDEF Model ::=
CHAN IN Input
CHAN OUT Output
BEHAVIOUR
fibonacci [Input, Output]()
ENDDEF
Or should we only use the assignment count := irrelevant
in the initialization?
By leaving it out, we might gain some performance...
but loose readability....
I would like to add Fibonacci as an example or test case.
I prefer to add it as an example, since it also explains what an update list is and how it works (simultaneous assignment of all variables using the old values) This concept was not understood by one of our TorXakis users.
It must be added since I made a change to TxsHappy.y that resulted in no falling tests, yet Fibonacci didn't work....