Fix Alu3, add test code.
authorAmir Kamil <kamil@cs.berkeley.edu>
Wed, 8 Aug 2007 06:02:00 +0000 (07:02 +0100)
committerAmir Kamil <kamil@cs.berkeley.edu>
Wed, 8 Aug 2007 06:02:00 +0000 (07:02 +0100)
ships/Alu3.ship

index 56f2c2a..e6bf24b 100644 (file)
@@ -18,12 +18,12 @@ data  out:  outBits
 
 == Fleeterpreter ====================================================
 int count = 74;
-Bitfifo.BitStorage bits = new Bitfifo.BitStorage(74);
+Bitfifo.BitStorage outBits = new Bitfifo.BitStorage(74);
 public void service() {
   if (box_in1.dataReadyForShip() &&
       box_in2.dataReadyForShip() &&
       box_in3.dataReadyForShip() &&
-      bits.hasSpace(1) &&
+      outBits.hasSpace(1) &&
       box_out1.readyForDataFromShip() &&
       box_out2.readyForDataFromShip() &&
       box_out3.readyForDataFromShip()) {
@@ -39,8 +39,7 @@ public void service() {
         o1 = ((v1 & v2) | (v2 & v3) | (v1 & v3))/* << 1*/;
         o2 = (v1 ^ v2 ^ v3) >> 1;
         o3 = 0;
-        bits.add((v1 ^ v2 ^ v3) & 0x1L, 1);
-        System.out.println("size is now " + bits.size());
+        outBits.add((v1 ^ v2 ^ v3) & 0x1L, 1);
       }
       box_out1.addDataFromShip(o1);
       box_out2.addDataFromShip(o2);
@@ -55,15 +54,14 @@ public void service() {
           o1 = ((v1 & v2) | (v2 & v3) | (v1 & v3))/* << 1*/;
           o2 = (v1 ^ v2 ^ v3) >> 1;
           o3 = 0;
-          bits.add((v1 ^ v2 ^ v3) & 0x1L, 1);
-          System.out.println("size is now " + bits.size());
+          outBits.add((v1 ^ v2 ^ v3) & 0x1L, 1);
         }
         count = 74;
       }
   }
   if (box_outBits.readyForDataFromShip() &&
-      bits.size() >= 37) {
-      box_outBits.addDataFromShip(bits.get(37));
+      outBits.size() >= 37) {
+      box_outBits.addDataFromShip(outBits.get(37));
   }
 }
 
@@ -112,13 +110,26 @@ public void service() {
 
 
 == Test ========================================================================
-#expect 25
+#expect 100488372224
+#expect 8
 
-#ship alu3 : Alu3
+
+#ship alu3  : Alu3
 #ship debug : Debug
 
-25: sendto debug.in;
-debug.in: [*] take, deliver;
+1000000:       sendto alu3.in1;
+1200000:       sendto alu3.in2;
+0:             sendto alu3.in3;
+0:             sendto alu3.in1;
+0:             sendto alu3.in2;
+alu3.in1:      [*] take, deliver;
+alu3.in2:      [*] take, deliver;
+alu3.in3:      [*] take, deliver;
+alu3.out1:     [74] take, sendto alu3.in1;
+alu3.out2:     [74] take, sendto alu3.in2;
+alu3.out3:     [74] take, sendto alu3.in3;
+alu3.outBits:  [2] take, sendto debug.in;
+debug.in:      [*] take, deliver;
 
 
 == Contributors =========================================================