diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-01-07 15:07:22 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2014-01-07 15:07:22 +0100 |
commit | d9f8744ea219fb04057059cdcbf7162534c63852 (patch) | |
tree | 9c1c2d0fa9011bd656d1eae7bbee6db954b3adfe /cpu | |
parent | c8a30baeb18756f2cc246de6a575943fcf9b7ed4 (diff) | |
download | SystDigit-Projet-d9f8744ea219fb04057059cdcbf7162534c63852.tar.gz SystDigit-Projet-d9f8744ea219fb04057059cdcbf7162534c63852.zip |
Document.
Diffstat (limited to 'cpu')
-rw-r--r-- | cpu/alu.ml | 2 | ||||
-rw-r--r-- | cpu/cpu.ml | 4 | ||||
-rw-r--r-- | cpu/netlist_gen.ml | 9 | ||||
-rw-r--r-- | cpu/netlist_gen.mli | 2 |
4 files changed, 7 insertions, 10 deletions
@@ -51,7 +51,7 @@ let rec nadder_with_carry n a b c_in = let nadder n a b = let a, b = nadder_with_carry n a b (const "0") in - ignore b a + b ^. a let rec nsubber n a b = zeroes n (* TODO *) @@ -17,6 +17,7 @@ let cpu_ram ra we wa d = 0x8000 to 0xFFFF is RAM *) let read_data = zeroes 8 in + (* ROM chip *) let ra_hi1 = ra ** 15 in let ra_lo1 = ra % (0, 14) in let ra_hi2 = ra ** 14 in @@ -25,7 +26,7 @@ let cpu_ram ra we wa d = let rd_rom = rom "ROM0" 14 8 ra_lo2 in let read_data = mux read_rom read_data rd_rom in - + (* RAM chip *) let read_ram = ra_hi1 in let wa_hi1 = wa ** 15 in let wa_lo1 = wa % (0, 14) in @@ -33,6 +34,7 @@ let cpu_ram ra we wa d = let rd_ram = ram 15 8 ra_lo1 we_ram wa_lo1 d in let read_data = mux read_ram read_data rd_ram in + (* MMIO *) let read_tick = eq_c 16 ra 0x4000 in let next_tick, save_next_tick = loop 8 in let tick = nadder 8 (reg 8 next_tick) (get "tick" ++ zeroes 7) in diff --git a/cpu/netlist_gen.ml b/cpu/netlist_gen.ml index 1aad452..016c595 100644 --- a/cpu/netlist_gen.ml +++ b/cpu/netlist_gen.ml @@ -16,9 +16,8 @@ let add p id eq size = assert (not (Env.mem id p.p_vars) || (Env.find id p.p_vars = size)); assert (not (List.mem_assoc id p.p_eqs)); - { p_eqs = (id, eq)::p.p_eqs; - p_inputs = p.p_inputs; - p_outputs = p.p_outputs; + { p with + p_eqs = (id, eq)::p.p_eqs; p_vars = Env.add id size p.p_vars } let get id = @@ -195,9 +194,7 @@ let program entries outputs = p, outputs) (p, []) outputs in - { p_inputs = p.p_inputs; - p_eqs = p.p_eqs; - p_vars = p.p_vars; + { p with p_outputs = List.rev outputs } diff --git a/cpu/netlist_gen.mli b/cpu/netlist_gen.mli index 280ee8c..67d4774 100644 --- a/cpu/netlist_gen.mli +++ b/cpu/netlist_gen.mli @@ -2,8 +2,6 @@ type t val print : out_channel -> Netlist_ast.program -> unit -val id : string -> Netlist_ast.ident - val get : Netlist_ast.ident -> t val loop : int -> (t * (t -> t)) |