summaryrefslogtreecommitdiff
path: root/cpu/cpu.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-02 15:47:08 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-02 15:47:08 +0100
commit721c62c977635b6ca716d965c8b84837a3d7b215 (patch)
tree243c1a925fa3995b5b281c99c5fbd7839978b1c3 /cpu/cpu.ml
parent6268a3d0f92df7be461da6f8474fa7a62e628fe3 (diff)
downloadSystDigit-Projet-721c62c977635b6ca716d965c8b84837a3d7b215.tar.gz
SystDigit-Projet-721c62c977635b6ca716d965c8b84837a3d7b215.zip
Memorizing CPU : summs all the entries
Diffstat (limited to 'cpu/cpu.ml')
-rw-r--r--cpu/cpu.ml9
1 files changed, 8 insertions, 1 deletions
diff --git a/cpu/cpu.ml b/cpu/cpu.ml
index 10e7bc4..592f612 100644
--- a/cpu/cpu.ml
+++ b/cpu/cpu.ml
@@ -2,7 +2,14 @@ open Netlist_gen
(* Dumb CPU that just does an 8-bit addition *)
+let sumz n i =
+ let rec res =
+ let aux = reg n in
+ fun () -> fst (Alu.nadder n i (aux res) (value "0")) ()
+ in
+ res
+
let p =
-main_2_2 (fun a b -> Alu.nadder 8 a b (value "0")) 8 8
+ main_1_1 (sumz 8) 8
let () = Netlist_proc.print stdout p