diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-05 18:38:25 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-11-05 18:38:25 +0100 |
commit | ad529541bf54d9a4339a7371208b7d328c0a449a (patch) | |
tree | e101b23d58d0e9fcc6db8020506668b07f3b2804 /tests/clockHMS.mj | |
parent | 1514c384d205a1710d81e52aba82476e1146e37d (diff) | |
download | SystDigit-Projet-ad529541bf54d9a4339a7371208b7d328c0a449a.tar.gz SystDigit-Projet-ad529541bf54d9a4339a7371208b7d328c0a449a.zip |
Deleted useless debug output ; coded working 60/60/24 clock.
Diffstat (limited to 'tests/clockHMS.mj')
-rw-r--r-- | tests/clockHMS.mj | 21 |
1 files changed, 14 insertions, 7 deletions
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<n>(a, b:[n]) = (o:[n]) where end if end where -count_mod<n, m>(in:[n]) = (out:[n]) where - (incr, carry) = adder<n>(in, 1 . repeat<n-1>(0), 0); - neq = not (equal<n, m>(incr)); - out = and_each<n>(neq, incr) +count_mod<n, m>(in:[n], op) = (out:[n], reset) where + (incr, carry) = adder<n>(in, op . repeat<n-1>(0), 0); + reset = equal<n, m>(incr); + neq = not reset; + out = and_each<n>(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 |