Skip to content
Snippets Groups Projects
Commit 3986eedf authored by Emile Guillaume's avatar Emile Guillaume
Browse files

Fix some merge bug (I think) and ad coloring implementation with neigh type

parent 5ed4bea4
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,6 @@ let output_prelude lustre_topology lustre_const (graph : Topology.t) = ...@@ -49,7 +49,6 @@ let output_prelude lustre_topology lustre_const (graph : Topology.t) =
Printf.fprintf lustre_const "const mean_degree = %f;\n" (Topology.get_mean_degree graph); Printf.fprintf lustre_const "const mean_degree = %f;\n" (Topology.get_mean_degree graph);
Printf.fprintf lustre_const "const diameter = %d;\n" (Diameter.get graph); Printf.fprintf lustre_const "const diameter = %d;\n" (Diameter.get graph);
Printf.fprintf lustre_const "const is_directed = %b;\n" graph.directed; Printf.fprintf lustre_const "const is_directed = %b;\n" graph.directed;
Printf.fprintf lustre_const "const diameter= %d;\n" (Diameter.get graph);
Printf.fprintf lustre_const "const is_cyclic = %b;\n" (Topology.is_cyclic graph); Printf.fprintf lustre_const "const is_cyclic = %b;\n" (Topology.is_cyclic graph);
Printf.fprintf lustre_const "const is_connected = %b;\n" (Topology.is_connected graph); Printf.fprintf lustre_const "const is_connected = %b;\n" (Topology.is_connected graph);
let neigh_list = graph.nodes |> List.map (fun (n:Topology.node) -> graph.pred n.id) in let neigh_list = graph.nodes |> List.map (fun (n:Topology.node) -> graph.pred n.id) in
...@@ -65,7 +64,6 @@ let output_prelude lustre_topology lustre_const (graph : Topology.t) = ...@@ -65,7 +64,6 @@ let output_prelude lustre_topology lustre_const (graph : Topology.t) =
| "mean_degree" | "mean_degree"
| "diameter" | "diameter"
| "is_directed" | "is_directed"
| "diameter"
| "is_cyclic" | "is_cyclic"
| "is_connected" | "is_connected"
| "f" | "f"
......
...@@ -10,7 +10,7 @@ include ../Makefile.inc ...@@ -10,7 +10,7 @@ include ../Makefile.inc
############################################################################## ##############################################################################
# Non-regression tests # Non-regression tests
test: clique3.kind2 clique3.lesar # clique3.lurette test: clique3.kind2-test clique3.lurette
clean: genclean clean: genclean
rm -f ring*.* er*.* grid*.* clique*.* rm -f ring*.* er*.* grid*.* clique*.*
......
graph {
p0 [algo="p.lus"]
p1 [algo="p.lus"]
p2 [algo="p.lus"]
p3 [algo="p.lus"]
p4 [algo="p.lus"]
p1 -- p2 -- p3 -- p4 -- p1
p1 -- p0 -- p2
p4 -- p0 -- p3
}
include "../../lib/bitset.lus" include "../../lib/bitset.lus"
type state = int; const K = max_degree + 1;
type action = enum { recolor }; function p_enable<<const degree:int>>(this : state; neighbors : neigh^degree)
const actions_number = 1;
function action_of_int(i : int) returns (a : action);
let
a = recolor;
tel;
const K = degree + 1;
function p_enable<<const degree:int>>(this : state; neighbors : state^degree)
returns (enabled : bool^actions_number); returns (enabled : bool^actions_number);
var conflict, out_of_range : bool; var conflict, out_of_range : bool;
let let
out_of_range = this < 0 or this >= K; out_of_range = this < 0 or this >= K;
conflict = subset<<K>>(one_hot<<K>>(this), bitset_of_list<<K,degree>>(neighbors)); conflict = subset<<K>>(one_hot<<K>>(this), bitset_of_list<<K,degree>>(map<<state,degree>>(neighbors)));
enabled = [ out_of_range or conflict ]; enabled = [ out_of_range or conflict ];
tel; tel;
function p_step<<const degree:int>>(this : state; neighbors : state^degree; action : action) function p_step<<const degree:int>>(this : state; neighbors : neigh^degree; action : action)
returns (new : state); returns (new : state);
let let
new = first_set<<K>>(diff<<K>>(true^K, bitset_of_list<<K,degree>>(neighbors))); new = first_set<<K>>(diff<<K>>(true^K, bitset_of_list<<K,degree>>(map<<state,degree>>(neighbors))));
tel; tel;
...@@ -10,7 +10,7 @@ include ../Makefile.inc ...@@ -10,7 +10,7 @@ include ../Makefile.inc
############################################################################## ##############################################################################
# Non-regression tests # Non-regression tests
test: diring4.lurette diring4.kind2 test: diring3.kind2-test diring4.lurette
clean: genclean clean: genclean
rm -f diring*.* rm -f diring*.*
......
const m0 = 2*diameter -1; const m0 = 2*diameter -1;
const k = if m0<2 then 2 else m0;
function min_clock<<const n:int>> (this : int; neighbors : neigh^n) function min_clock<<const n:int>> (this : int; neighbors : neigh^n)
returns (new: int); returns (new: int);
...@@ -12,7 +13,7 @@ tel; ...@@ -12,7 +13,7 @@ tel;
function newClockValue<<const n:int>> (this : int ; neighbors : neigh^n) function newClockValue<<const n:int>> (this : int ; neighbors : neigh^n)
returns (new: state); returns (new: state);
let let
new = (min_clock<<n>>(this,neighbors)+1) mod (if m0 < 2 then 2 else m0); new = (min_clock<<n>>(this,neighbors)+1) mod k;
tel; tel;
function unison_enable<<const degree:int>> (this : state; neighbors : neigh^degree) function unison_enable<<const degree:int>> (this : state; neighbors : neigh^degree)
......
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