master clear works (at least for memory ship)
[fleet.git] / ships / Lut3.ship
index 40a1006..6b68cc5 100644 (file)
@@ -18,9 +18,9 @@ NOR
 
 == TeX ==============================================================
 
-This ship implements a 3-input {\bf L}ook {\bf U}p {\bf T}able.  The
-least significant eight bits of the {\tt inLut} value form a truth
-table with three inputs and one output.
+This ship implements a bitwise 3-input {\bf L}ook {\bf U}p {\bf
+T}able.  The least significant eight bits of the {\tt inLut} value
+form a truth table with three inputs and one output.
 
 When values are available at all four inputs they are consumed and a
 value is produced at {\tt out}.  Each bit of {\tt out} is produced by
@@ -34,9 +34,6 @@ bit}.  This three-bit number, ranging from 0 to 7 (decimal), is used
 as a bit index into {\tt inLut}'s value (whose least significant bit
 is considered ``bit zero'').
 
-The ship-specific constants refer to commonly-used truth tables for
-{\it two-input} functions; these constant truth tables are invariant
-under input {\tt in3}.
 
 == Fleeterpreter ====================================================
   public void service() {
@@ -370,37 +367,43 @@ under input {\tt in3}.
 #ship lut          : Lut3
 #ship alu          : Alu1
 
-// constant inputs
-85:          sendto lut.in1;
-51:          sendto lut.in2;
-15:          sendto lut.in3;
-
-lut.in1:   take; [*] deliver;
-lut.in2:   take; [*] deliver;
-lut.in3:   take; [*] deliver;
-lut.inLut: [*] take, deliver;
+lut.in1:   literal 85; [*] deliver;
+lut.in2:   literal 51; [*] deliver;
+lut.in3:   literal 15; [*] deliver;
 lut.out:   [*] take, sendto debug.in;
 
 // cycle through truth tables using alu as INC
-1: sendto alu.inOp;
 alu.inOp:
-   take;
-   [120] deliver;
-   [120] deliver;
-   [15] deliver;
-alu.in: [*] take, deliver;
-0: sendto alu.in;
+   literal 1;
+   load repeat counter with 63;
+   deliver;
+   load repeat counter with 63;
+   deliver;
+   load repeat counter with 63;
+   deliver;
+   load repeat counter with 63;
+   deliver;
+   load repeat counter with 3;
+   deliver;
+alu.in:
+   literal 0;
+   deliver;
+   [*] take, deliver;
 alu.out:
-  [*]  nop;
-  (*) wait, take, sendto lut.inLut;
-  (*) sendto alu.in;
-  kill;
+  clog;
+  load loop counter with 2;
+  wait, take, sendto lut.inLut;
+  sendto alu.in;
+  unclog;
 
 // acks from debug ship trigger new truth tables
-debug.in:   [*] take, deliver, notify alu.out;
+debug.in:
+  [*] take, deliver, notify alu.out;
 
-// kickoff
-0:           sendto lut.inLut;
+lut.inLut:
+  literal 0;
+  deliver;
+  [*] take, deliver;