From 18448f7f17468182b9a91333c5e73117b9e01e9b Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Tue, 14 Jan 2014 15:23:50 +0100 Subject: Save tick counter on 16 bits now. --- cpu/cpu.ml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'cpu/cpu.ml') diff --git a/cpu/cpu.ml b/cpu/cpu.ml index 9b5eed0..dbea33b 100644 --- a/cpu/cpu.ml +++ b/cpu/cpu.ml @@ -37,12 +37,15 @@ let cpu_ram ra we wa d = 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 + let read_tick_lo = eq_c 16 ra 0x4000 in + let read_tick_hi = eq_c 16 ra 0x4001 in + let next_tick, save_next_tick = loop 16 in + let tick = nadder 16 (reg 16 next_tick) (get "tick" ++ zeroes 15) in let read_data = - save_next_tick (mux read_tick tick (zeroes 8)) ^. - mux read_tick read_data tick in + save_next_tick (mux read_tick_hi tick (zeroes 16)) ^. + mux read_tick_lo + (mux read_tick_hi read_data (tick % (8, 15))) + (tick % (0, 7)) in let write_ser = we ^& (eq_c 16 wa 0x4102) in let read_data = -- cgit v1.2.3