summaryrefslogtreecommitdiff
path: root/cpu/cpu.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-02 17:16:09 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-02 17:16:09 +0100
commit6fdfebbc65949d6ad55ee5a47bd6b5bdbc74a91f (patch)
tree0b733bb8fdbeecf6baddb2306e82fd73c0641060 /cpu/cpu.ml
parent721c62c977635b6ca716d965c8b84837a3d7b215 (diff)
downloadSystDigit-Projet-6fdfebbc65949d6ad55ee5a47bd6b5bdbc74a91f.tar.gz
SystDigit-Projet-6fdfebbc65949d6ad55ee5a47bd6b5bdbc74a91f.zip
New netlist generation protocol
Diffstat (limited to 'cpu/cpu.ml')
-rw-r--r--cpu/cpu.ml18
1 files changed, 11 insertions, 7 deletions
diff --git a/cpu/cpu.ml b/cpu/cpu.ml
index 592f612..2d60bec 100644
--- a/cpu/cpu.ml
+++ b/cpu/cpu.ml
@@ -3,13 +3,17 @@ 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 x, set_x = loop n in
+ let r = reg n x in
+ let o1, o2 = Alu.nadder n i r (const "0") in
+ set_x o1, o2
let p =
- main_1_1 (sumz 8) 8
+ let width = 16 in
+ let sum, r = sumz width (get "in") in
+ program
+ [ "in", width ]
+ [ "out", width, sum;
+ "r", 1, r ]
-let () = Netlist_proc.print stdout p
+let () = Netlist_gen.print stdout p