From ad529541bf54d9a4339a7371208b7d328c0a449a Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Tue, 5 Nov 2013 18:38:25 +0100 Subject: Deleted useless debug output ; coded working 60/60/24 clock. --- sched/simplify.ml | 5 ----- tests/clockHMS.mj | 21 ++++++++++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sched/simplify.ml b/sched/simplify.ml index ae5ec65..5ca4b99 100644 --- a/sched/simplify.ml +++ b/sched/simplify.ml @@ -219,10 +219,6 @@ let topo_sort p = (* Apply all the simplification passes, in the order given in the header of this file *) -let dump_varlist p = - print_string "Eq list:\n"; - List.iter (fun (n, _) -> print_string ("- "^n^"\n")) p.p_eqs - let rec simplify p = let steps = [ cascade_slices; @@ -235,7 +231,6 @@ let rec simplify p = let pp, use = List.fold_left (fun (x, u) f -> let xx, uu = f x in - dump_varlist xx; (xx, u || uu)) (p, false) steps in if use then simplify pp else pp diff --git a/tests/clockHMS.mj b/tests/clockHMS.mj index a25a85c..4575c58 100644 --- a/tests/clockHMS.mj +++ b/tests/clockHMS.mj @@ -55,14 +55,21 @@ and_each(a, b:[n]) = (o:[n]) where end if end where -count_mod(in:[n]) = (out:[n]) where - (incr, carry) = adder(in, 1 . repeat(0), 0); - neq = not (equal(incr)); - out = and_each(neq, incr) +count_mod(in:[n], op) = (out:[n], reset) where + (incr, carry) = adder(in, op . repeat(0), 0); + reset = equal(incr); + neq = not reset; + out = and_each(neq, incr); end where -main() = (out:[4],next:[4]) where - next = count_mod<4, 12>(out); - out = reg_n<4>(next) +main() = (count_sec:[6],count_min:[6],count_hour:[5],next_day) where + (count_sec, aug_min) = count_mod<6, 60>(save_sec, 1); + save_sec = reg_n<6>(count_sec); + + (count_min, aug_hour) = count_mod<6, 60>(save_min, aug_min); + save_min = reg_n<6>(count_min); + + (count_hour, next_day) = count_mod<5, 24>(save_hour, aug_hour); + save_hour = reg_n<5>(count_hour) end where -- cgit v1.2.3