summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan <jonathan@jonathan-VirtualBox.(none)>2014-01-09 18:10:54 +0100
committerJonathan <jonathan@jonathan-VirtualBox.(none)>2014-01-09 18:10:54 +0100
commit2595e3881e0904fc6ecb162775a149f5b0121848 (patch)
tree63d33d173e7bb047922321d79cc779f17ca5ac10
parent438b8e30bd7d4e186554a899d9fc86fc4bc65a9e (diff)
downloadSystDigit-Projet-2595e3881e0904fc6ecb162775a149f5b0121848.tar.gz
SystDigit-Projet-2595e3881e0904fc6ecb162775a149f5b0121848.zip
restored the functionnal version of mul
-rw-r--r--cpu/alu.ml19
1 files changed, 2 insertions, 17 deletions
diff --git a/cpu/alu.ml b/cpu/alu.ml
index 9f83369..aa82a6d 100644
--- a/cpu/alu.ml
+++ b/cpu/alu.ml
@@ -120,7 +120,6 @@ let rec split_list = function
| x::y::tl -> let a, b = split_list tl in x::a, y::b
(* n must be a power of two *)
-(*
let nmul n a b =
let summands = List.map (fun i ->
@@ -137,23 +136,9 @@ let nmul n a b =
let s1, s2 = split_list l in
nadder (2*n) (sum_list s1) (sum_list s2)
- in let r = List.fold_left (nadder (2*n)) (List.hd summands) (List.tl summands) in
-
-
- (*in
- let r = sum_list summands in*)
+ in
+ let r = sum_list summands in
(r % (0, n-1)), (r % (n, 2*n - 1))
- *)
-
-let nmul n a b =
- let nn = 2*n in
- let result = ref (zeroes (nn)) in
- for i = 0 to n-1 do
- result := mux (b ** i) !result (nadder nn !result ((zeroes i) ++ a ++ (zeroes (n-i))))
- done;
- let r = !result in
- r % (0, n-1), r % (n, nn-1)
-