summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'cpu')
-rw-r--r--cpu/alu.ml5
1 files changed, 4 insertions, 1 deletions
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