From 036b6ba1caae40b439670c031a162a6fde7461ec Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Tue, 14 Jan 2014 17:34:02 +0100 Subject: Changes... --- cpu/alu.ml | 5 ++++- sched/simplify.ml | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cpu/alu.ml b/cpu/alu.ml index 87cfc10..934e6d8 100644 --- a/cpu/alu.ml +++ b/cpu/alu.ml @@ -18,7 +18,10 @@ let rec eq_c n v c = (* v is a value, c is a constant *) if n = 1 then if c = 1 then v else not v else - (eq_c 1 (v ** 0) (c mod 2)) ^& (eq_c (n-1) (v % (1, n-1)) (c/2)) + if c mod 2 = 1 then + mux (v ** 0) (const "0") (eq_c (n-1) (v % (1, n-1)) (c/2)) + else + mux (v ** 0) (eq_c (n-1) (v % (1, n-1)) (c/2)) (const "0") let rec all1 n x = if n = 1 then diff --git a/sched/simplify.ml b/sched/simplify.ml index a2c7770..582d5d0 100644 --- a/sched/simplify.ml +++ b/sched/simplify.ml @@ -147,6 +147,10 @@ let arith_simplify p = | Emux(_, a, b) when a = b -> Earg(a) | Emux(Aconst[|false|], a, b) -> Earg(a) | Emux(Aconst[|true|], a, b) -> Earg(b) + | Emux(c, Aconst[|false|], Avar(b)) when Env.find b p.p_vars = 1 -> + Ebinop(And, c, Avar(b)) + | Emux(c, Avar(b), Aconst[|true|]) when Env.find b p.p_vars = 1 -> + Ebinop(Or, c, Avar(b)) | Eslice(i, j, k) when i = j -> Eselect(i, k) -- cgit v1.2.3