summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-24 13:30:30 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-01-24 13:30:30 +0100
commit48ab6c6cae4b0a0b6eba3906fcb6fd222c184468 (patch)
tree67b89cb76b1075f5707713f0dcec40305042481c /cpu
parent3245f2efbe18d678ff7a95dafcdc7bc296a263c0 (diff)
downloadSystDigit-Projet-48ab6c6cae4b0a0b6eba3906fcb6fd222c184468.tar.gz
SystDigit-Projet-48ab6c6cae4b0a0b6eba3906fcb6fd222c184468.zip
Correct tick loosing bug.
Diffstat (limited to 'cpu')
-rw-r--r--cpu/cpu.ml13
1 files changed, 11 insertions, 2 deletions
diff --git a/cpu/cpu.ml b/cpu/cpu.ml
index 74e25c3..867a979 100644
--- a/cpu/cpu.ml
+++ b/cpu/cpu.ml
@@ -41,10 +41,19 @@ let cpu_ram ra we wa d =
(* MMIO *)
let read_tick_lo = eq_c 16 ra 0x4000 in
let read_tick_hi = eq_c 16 ra 0x4001 in
+ let read_tick = read_tick_lo ^| read_tick_hi in
+
+ let next_tick_buffer, save_next_tick_buffer = loop 3 in
+ let tick_buffer = nadder 3 (reg 3 next_tick_buffer) (get "tick" ++ zeroes 2) in
+
let next_tick, save_next_tick = loop 16 in
- let tick = nadder 16 (reg 16 next_tick) (get "tick" ++ zeroes 15) in
+ let tick = reg 16 next_tick in
+
let read_data =
- save_next_tick (mux read_tick_hi tick (zeroes 16)) ^.
+ save_next_tick_buffer (mux read_tick (zeroes 3) tick_buffer) ^.
+ save_next_tick (mux read_tick (nadder 16 tick (tick_buffer ++ zeroes 13))
+ (mux read_tick_hi tick (zeroes 16))) ^.
+
mux read_tick_lo
(mux read_tick_hi read_data (tick % (8, 15)))
(tick % (0, 7)) in