From 9062f0ea05008482bc4086a5a5836aa32a9a9906 Mon Sep 17 00:00:00 2001 From: cancel Date: Thu, 20 Dec 2018 04:22:24 +0900 Subject: [PATCH] Update behavior of 'P' --- sim.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sim.c b/sim.c index 5afba1e..1098abb 100644 --- a/sim.c +++ b/sim.c @@ -770,8 +770,8 @@ BEGIN_DUAL_PHASE_0(offset) coords[0] = 0; // y coords[1] = 1; // x if (IS_AWAKE && DUAL_IS_ACTIVE) { - coords[0] = (I32)usz_clamp(index_of(PEEK(0, -1)), 0, 16); - coords[1] = (I32)usz_clamp(index_of(PEEK(0, -2)) + 1, 1, 16); + coords[0] = (I32)index_of(PEEK(0, -1)); + coords[1] = (I32)index_of(PEEK(0, -2)) + 1; STORE(coords); } BEGIN_DUAL_PORTS @@ -797,12 +797,12 @@ BEGIN_DUAL_PHASE_0(push) I32 write_val_x[1]; write_val_x[0] = 0; if (IS_AWAKE && DUAL_IS_ACTIVE) { - Usz len = usz_clamp(index_of(PEEK(0, -1)), 1, 16); + Usz len = index_of(PEEK(0, -1)) + 1; Usz key = index_of(PEEK(0, -2)); write_val_x[0] = (I32)(key % len); STORE(write_val_x); - for (Isz i = 0; i < write_val_x[0]; ++i) { - LOCK(1, i); + for (Usz i = 0; i < len; ++i) { + LOCK(1, (Isz)i); } } BEGIN_DUAL_PORTS @@ -813,7 +813,8 @@ BEGIN_DUAL_PHASE_0(push) END_PORTS END_PHASE BEGIN_DUAL_PHASE_1(push) - STOP_IF_NOT_BANGED; + REALIZE_DUAL; + STOP_IF_DUAL_INACTIVE; I32 write_val_x[1]; if (!LOAD(write_val_x)) { write_val_x[0] = 0;