Skip to content
Snippets Groups Projects
Commit d5bd7f84 authored by erwan's avatar erwan
Browse files

test: add the Ghosh mutual exclusion algo in sasa/test/ and salut/sasa/test/

parent 319660d4
No related branches found
No related tags found
No related merge requests found
Showing
with 125 additions and 8 deletions
-- Here, we use the Lustre version of the algorithm as an oracle for the ocaml version
include "../../lib/utils.lus"
node coloring_oracle(
legitimate : bool;
ocaml_cost : real;
ocaml_enabled : bool^actions_number^card;
active : bool^actions_number^card;
active : bool^actions_number^card;
ocaml_config : state^card;
round:bool;
round_nb:int;
)
round_nb:int;
)
returns (ok : bool);
var
lustre_config : state^card;
......@@ -20,18 +20,18 @@ var
lustre_round_nb : int;
-- lustre_cost:int;
let
lustre_config, lustre_enabled, lustre_round, lustre_round_nb =
lustre_config, lustre_enabled, lustre_round, lustre_round_nb =
topology(active -> pre active, -- ignored at the first step
ocaml_config -- used at the first step only
);
-- lustre_cost = cost(lustre_enabled, lustre_config);
ok = lustre_enabled = ocaml_enabled
ok = lustre_enabled = ocaml_enabled
-- compare the sasa dot interpretation and the salut dot to lustre compilation
and lustre_config = ocaml_config
-- compare the lustre and the ocaml version of the processes
-- and Lustre::real2int(ocaml_cost) = lustre_cost
-- and lustre_round = round
-- and lustre_round_nb = round_nb
and lustre_round_nb = round_nb
;
-- compare the cost functions
-- compare the cost functions
tel
TOPOLOGY ?= ghosh8
DOT2LUSFLAGS ?=
SASA_ALGOS := p0.ml p_odd.ml p_even.ml p_last
DECO_PATTERN="not possible with this algo"
include ./Makefile.inc
include ./Makefile.dot
##############################################################################
# Non-regression tests
test: ghosh8.kind2-test ghosh8.lurette
clean: genclean
##############################################################################
# Other examples of use
## Some examples of use of ../Makefile.inc
# run a simulation with luciole
simu: ghosh8.simu
# make diring4.simu
kind2: ghosh8.kind2
## do not work because there is a modulo in p.lus, which is not (yet) implemented in ../../bit-blast/*.lus
lesar: ghosh8.lesar
##############################################################################
-include ./Makefile.untrack
../Makefile.dot
\ No newline at end of file
../Makefile.inc
\ No newline at end of file
../../../test/ghosh/config.ml
\ No newline at end of file
../../../test/dune2copy
\ No newline at end of file
../../../test/dune-project2copy
\ No newline at end of file
../../../test/ghosh/ghosh10.dot
\ No newline at end of file
../../../test/ghosh/ghosh12.dot
\ No newline at end of file
../../../test/ghosh/ghosh14.dot
\ No newline at end of file
../../../test/ghosh/ghosh2.dot
\ No newline at end of file
../../../test/ghosh/ghosh4.dot
\ No newline at end of file
../../../test/ghosh/ghosh6.dot
\ No newline at end of file
../../../test/ghosh/ghosh8.dot
\ No newline at end of file
-- Here, we use the Lustre version of the algorithm as an oracle for the ocaml version
include "../../lib/utils.lus"
-- include "cost.lus"
node ghosh_oracle(
legitimate : bool;
-- ocaml_cost : real;
ocaml_enabled : bool^actions_number^card;
active : bool^actions_number^card;
ocaml_config : state^card;
round:bool;
round_nb:int;
)
returns (ok : bool);
var
lustre_config : state^card;
lustre_enabled : bool^actions_number^card;
-- lustre_cost:int;
lustre_round:bool;
lustre_round_nb:int;
let
lustre_config, lustre_enabled, lustre_round, lustre_round_nb =
topology(active -> pre active, -- ignored at the first step
ocaml_config -- used at the first step only
);
ok = lustre_enabled = ocaml_enabled
-- compare the sasa dot interpretation and the salut dot to lustre compilation
and lustre_config = ocaml_config
-- and round = lustre_round
and round_nb = lustre_round_nb
;
tel
function p0_enable<<const degree:int>>(this : state; neighbors : neigh^degree)
returns (enabled : bool^actions_number);
let
enabled = [ this <> state(neighbors[0]) ];
tel;
function p0_step<<const degree:int>>(
this : state;
neighbors : neigh^degree; action : action)
returns (new : state);
let
new = not this;
tel;
../../../test/ghosh/p0.ml
\ No newline at end of file
function p_even_enable<<const degree:int>>(s1 : state; neighbors : neigh^degree)
returns (enabled : bool^actions_number);
let
enabled = [ state(neighbors[0+if degree=3 then 0 else 1]) = s1 and
s1 = state(neighbors[1+if degree=3 then 0 else 1]) and
state(neighbors[2+if degree=3 then 0 else 1]) = not state(neighbors[1+if degree=3 then 0 else 1])
];
tel;
function p_even_step<<const degree:int>>(
this : state;
neighbors : neigh^degree; action : action)
returns (new : state);
let
new = not this;
tel;
../../../test/ghosh/p_even.ml
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment