Created
May 30, 2023 09:09
-
-
Save senier/dc396550c9a4879c0fee80949f21120a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Alt is | |
type Alt_Cond is (Alt_B => 1, Alt_C => 2) with Size => 8; | |
generic | |
session FSM is | |
Alt_Cond : Alt_Cond; | |
begin | |
state Init is | |
begin | |
Alt_Cond := Alt_B; | |
transition | |
goto A | |
end Init; | |
state A is | |
begin | |
transition | |
goto B | |
if Alt_Cond = Alt_B | |
goto C | |
if Alt_Cond = Alt_C | |
goto Init | |
end A; | |
state B is | |
begin | |
Alt_Cond := Alt_C; | |
transition | |
goto A | |
end B; | |
state C is | |
begin | |
Alt_Cond := Alt_B; | |
transition | |
goto A | |
end C; | |
end FSM; | |
end Alt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
State: Init | |
State: A | |
State: B | |
State: A | |
State: C | |
State: A | |
State: B | |
State: A | |
State: C | |
State: A | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with RFLX.Alt.FSM; | |
procedure Useit | |
is | |
type Context is new RFLX.Alt.FSM.Context with null record; | |
Ctx : Context; | |
begin | |
RFLX.Alt.FSM.Initialize (Ctx); | |
while RFLX.Alt.FSM.Active (Ctx) loop | |
RFLX.Alt.FSM.Run (Ctx); | |
end loop; | |
end Useit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment