shithub: orca

Download patch

ref: 9062f0ea05008482bc4086a5a5836aa32a9a9906
parent: 55cdf65459e3e511c51d6af157e2f49bc049bed9
author: cancel <cancel@cancel.fm>
date: Wed Dec 19 23:22:24 EST 2018

Update behavior of 'P'

--- a/sim.c
+++ b/sim.c
@@ -770,8 +770,8 @@
   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 @@
   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 @@
   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;