Skip to content
Snippets Groups Projects
Commit 55efeade authored by Erwan Jahier's avatar Erwan Jahier
Browse files

lic2soc: factorize some Soc.gao tests

For the time being, we simple try to factorise out the test of
consecutive gao that holds on the same clock.

ps : also fix a pb (infinite loop in SortActions.topo_sort)
introduced in the previous change that, for a strange reason
(Makefile issue), was not catched by the test (almost all test were
failing !!).

pps : it actually seems to break quite a lot of test, but its my test
script that wrong ! since version 527 (we are 534), the compiler used
to perform the test in the tmp dirs is not upadated ! (well it is,
but on the wrong machine...).

I commit this change still as it introduces no more test failures.
parent f37347fe
No related branches found
No related tags found
No related merge requests found
(** Automatically generated from Makefile *) (** Automatically generated from Makefile *)
let tool = "lus2lic" let tool = "lus2lic"
let branch = "(no" let branch = "(no"
let commit = "533" let commit = "534"
let sha_1 = "987b66ecac7d8ed1b0c8c8c42ab67be1ef9316af" let sha_1 = "f37347fe7fa7f49efe1b0ae7a462d649437f4872"
let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")") let str = (branch ^ "." ^ commit ^ " (" ^ sha_1 ^ ")")
let maintainer = "jahier@imag.fr" let maintainer = "jahier@imag.fr"
(** Time-stamp: <modified the 06/10/2014 (at 10:57) by Erwan Jahier> *) (** Time-stamp: <modified the 07/10/2014 (at 16:21) by Erwan Jahier> *)
(** topological sort of actions (that may optimize test openning) *) (** topological sort of actions (that may optimize test openning) *)
...@@ -61,12 +61,12 @@ let (topo_sort : ActionsDeps.action list -> ActionsDeps.t -> ActionsDeps.action ...@@ -61,12 +61,12 @@ let (topo_sort : ActionsDeps.action list -> ActionsDeps.t -> ActionsDeps.action
if (try MapAction.find x visited with Not_found -> assert false) if (try MapAction.find x visited with Not_found -> assert false)
then then
f acc tail stbl visited f acc tail stbl visited
else else
try
let x_succ = ActionsDeps.find_deps stbl x in let x_succ = ActionsDeps.find_deps stbl x in
f acc (x_succ @ l) (ActionsDeps.remove_dep stbl x) visited if x_succ = [] then
with Not_found -> (* x has no (more) dep *) f (x::acc) tail stbl (MapAction.add x true visited)
f (x::acc) tail stbl (MapAction.add x true visited) else
f acc (x_succ @ l) (ActionsDeps.remove_dep stbl x) visited
in in
check_there_is_no_cycle actions stbl; check_there_is_no_cycle actions stbl;
f [] actions stbl visited_init f [] actions stbl visited_init
...@@ -92,16 +92,59 @@ let rec (gao_of_action: action -> Soc.gao) = ...@@ -92,16 +92,59 @@ let rec (gao_of_action: action -> Soc.gao) =
in in
unpack_clock ck unpack_clock ck
let f actions stbl lxm = (*********************************************************************************)
let actions = (* [my_assoc x l] returns the elt associated to x in l plus l without (x,elt) *)
try topo_sort actions stbl let my_assoc x l =
with DependencyCycle(x,l) -> let rec aux acc = function
let l = List.map ActionsDeps.string_of_action_simple l in | [] -> None
let msg = "A combinational cycle been detected "^ | (a,b)::l -> if compare a x = 0 then Some(b,List.rev_append acc l) else aux ((a,b)::acc) l
(Lxm.details lxm)^" on \n "^(ActionsDeps.string_of_action_simple x)^ in
"\n "^(String.concat "\n " l) ^ "\n\nHint: try to use --expand-nodes.\n" aux [] l
in
raise (Lv6errors.Global_error msg) (* Simple optimisation : when 2 consecutive gao holds on the same clock, we
in try to factorize them out.
let gaol = List.map gao_of_action actions in *)
gaol let (optimize_test_openning: Soc.gao list -> ActionsDeps.t -> Soc.gao list) =
fun gaol deps ->
let rec aux acc gaol = match gaol with
| [] -> List.rev acc
| [a] -> List.rev (a::acc)
| Soc.Call(o,op,i)::tail -> aux (Soc.Call(o,op,i)::acc) tail
| a1::Soc.Call(o,op,i)::tail -> aux (Soc.Call(o,op,i)::a1::acc) tail
| Case(v1,l1)::Case(v2,l2)::tail ->
if v1 <> v2 then aux (Soc.Case(v1,l1)::acc) (Case(v2,l2)::tail) else
let l = merge_gaol l1 l2 [] in
aux acc (Soc.Case(v1,l)::tail)
and (merge_gaol : (string * Soc.gao list) list -> (string * Soc.gao list) list ->
(string * Soc.gao list) list -> (string * Soc.gao list) list) =
fun l1 l2 acc ->
match l1 with
| [] -> if l2 = [] then List.rev acc else List.rev_append acc l2
| (x1,gaol1)::l1 ->
(match my_assoc x1 l2 with
| None -> merge_gaol l1 l2 ((x1,gaol1)::acc)
| Some(gaol2,l2) ->
let gaol = aux [] (gaol1@gaol2) in
merge_gaol l1 l2 ((x1,gaol)::acc)
)
in
aux [] gaol
(*********************************************************************************)
let (f : action list -> ActionsDeps.t -> Lxm.t -> Soc.gao list) =
fun actions deps lxm ->
let actions =
try topo_sort actions deps
with DependencyCycle(x,l) ->
let l = List.map ActionsDeps.string_of_action_simple l in
let msg = "A combinational cycle been detected "^
(Lxm.details lxm)^" on \n "^(ActionsDeps.string_of_action_simple x)^
"\n "^(String.concat "\n " l) ^ "\n\nHint: try to use --expand-nodes.\n"
in
raise (Lv6errors.Global_error msg)
in
let gaol = List.map gao_of_action actions in
optimize_test_openning gaol deps
(* gaol *)
...@@ -62,13 +62,13 @@ utest: ...@@ -62,13 +62,13 @@ utest:
# reftest isslower than qtest, but less sensible to the load of the machine (wrt time measurements) # reftest isslower than qtest, but less sensible to the load of the machine (wrt time measurements)
reftest: reftest:
rm -f $(LOG) rm -f $(LOG)
cd $(testdir); make tmpdirs $(TEST_MACHINE) "cd $(testdir); make tmpdirs"
time -o lus2lic.ref_time make $(LOG) time -o lus2lic.ref_time make $(LOG)
make lus2lic.time make lus2lic.time
qtest: qtest:
rm -f $(LOG) rm -f $(LOG)
cd $(testdir); make tmpdirs $(TEST_MACHINE) "cd $(testdir); make tmpdirs"
time -o lus2lic.quick_time make -j 8 $(LOG) time -o lus2lic.quick_time make -j 8 $(LOG)
cat lus2lic.quick_time cat lus2lic.quick_time
make lus2lic.time make lus2lic.time
......
This diff is collapsed.
lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 0 seconds lus2lic0.log:testcase ./lus2lic.tests/test0.exp completed in 0 seconds
lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 37 seconds lus2lic1.log:testcase ./lus2lic.tests/test1.exp completed in 20 seconds
lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 87 seconds lus2lic2.log:testcase ./lus2lic.tests/test2.exp completed in 56 seconds
lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 52 seconds lus2lic3.log:testcase ./lus2lic.tests/test3.exp completed in 17 seconds
lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 141 seconds lus2lic4.log:testcase ./lus2lic.tests/test4.exp completed in 66 seconds
* Ref time: * Ref time:
0.04user 0.10system 5:18.90elapsed 0%CPU (0avgtext+0avgdata 3004maxresident)k 0.05user 0.09system 2:40.91elapsed 0%CPU (0avgtext+0avgdata 3000maxresident)k
120inputs+0outputs (0major+14860minor)pagefaults 0swaps 120inputs+0outputs (0major+14858minor)pagefaults 0swaps
* Quick time (-j 4): * Quick time (-j 4):
0.05user 0.08system 2:36.87elapsed 0%CPU (0avgtext+0avgdata 3000maxresident)k
120inputs+0outputs (0major+14869minor)pagefaults 0swaps
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