refactoring of InstructionStopper
authorAdam Megacz <adam.megacz@sun.com>
Tue, 24 Mar 2009 18:13:15 +0000 (18:13 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Tue, 24 Mar 2009 18:13:15 +0000 (18:13 +0000)
testCode/com/sun/vlsi/chips/marina/test/InstructionStopper.java
testCode/com/sun/vlsi/chips/marina/test/Marina.java
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index a463074..101301b 100644 (file)
@@ -11,28 +11,16 @@ import edu.berkeley.fleet.api.Dock;
 import edu.berkeley.fleet.api.Instruction;
 import edu.berkeley.fleet.marina.MarinaFleet;
 
-/** InstructionStopper is a scaffold that lets us create a 36 bit propperStopper
- * by using a 52 bit propperStopper and throwing away the unused bits. */
+import static com.sun.vlsi.chips.marina.test.Marina.INSTRUCTION_LENGTH;
+
+/**
+ * InstructionStopper is a scaffold that lets us create a 36 bit propperStopper
+ * by using a 52 bit propperStopper and throwing away the unused bits.
+ */
 public class InstructionStopper extends ProperStopper {
-    public static final BitVector TORPEDO;
-    public static final int INSTR_SZ = 36;
-    public static final MarinaFleet MARINA = new MarinaFleet();
-    public static final Dock DOCK = MARINA.getOnlyInputDock();
 
-    static {
-        BitVector d = new BitVector(37, "token");  d.setFromLong(0);
-        BitVector t = new BitVector(1, "token");   t.setFromLong(0);
-        BitVector a = new BitVector(14, "addr");   a.setFromLong(0);
-        TORPEDO = t.cat(a).cat(d); 
-    }
-    // Convert a Berkeley BitVector into a Sun BitVector
-    private BitVector berkToSun(edu.berkeley.fleet.api.BitVector berkBits) {
-        BitVector sunBits = new BitVector(INSTR_SZ, "instr");
-        for(int i=0; i<INSTR_SZ; i++) sunBits.set(i, berkBits.get(i));
-        return sunBits;
-    }
     private String formatDecodedInstr(BitVector dta) {
-        BitVector instr = dta.get(0, INSTR_SZ).bitReverse(); 
+        BitVector instr = dta.get(0, INSTRUCTION_LENGTH).bitReverse(); 
         StringBuffer sb = new StringBuffer();
         String pred = instr.get(0, 6)  .getState();
         String rq = instr.get(6, 1).getState();
@@ -51,16 +39,17 @@ public class InstructionStopper extends ProperStopper {
                               Indenter indenter) {
         super(propInst, controlChain, dataChain, reportChain, cc, model, clockHack, indenter);
     }
+
     @Override
     public void fill(BitVector instr) {
         // allow user to pass in complete item: data + token + addr
         if (instr.getNumBits()==(37+1+14)) {super.fill(instr); return;}
                 
         int n = instr.getNumBits();
-        fatal(n!=INSTR_SZ, "InstructionStopper.fill: wrong num bits: "+n+", expect: "+INSTR_SZ);
-        fatal(INSTR_SZ>37, "Instructions can't be more than 37 bits");
-        if (INSTR_SZ<37) {
-            BitVector pad = new BitVector(37-INSTR_SZ, "pad");
+        fatal(n!=INSTRUCTION_LENGTH, "InstructionStopper.fill: wrong num bits: "+n+", expect: "+INSTRUCTION_LENGTH);
+        fatal(INSTRUCTION_LENGTH>37, "Instructions can't be more than 37 bits");
+        if (INSTRUCTION_LENGTH<37) {
+            BitVector pad = new BitVector(37-INSTRUCTION_LENGTH, "pad");
             pad.setFromLong(0);
             instr = instr.cat(pad);
         }
@@ -69,18 +58,19 @@ public class InstructionStopper extends ProperStopper {
         //super.fill(instr.cat(t).cat(a));
         super.fill(t.cat(a).cat(instr));
     }
+
     public BitVector drainNoCheck() {
         BitVector dta = super.drainNoCheck();
-        return dta.get(15, INSTR_SZ);
+        return dta.get(15, INSTRUCTION_LENGTH);
     }
-    /*
-    @Override
-    public String formatDataTokAddr(BitVector dta) {
-        return formatDecodedInstr(dta);
-    }
-    */
+
     /** put one Instruction into InstructionStopper */
     public void fill(Instruction instr) {
-        fill(berkToSun(MARINA.encodeInstruction(DOCK, instr)));
+        fill(MarinaUtils.berkToSun(MarinaTest.marinaFleet.encodeInstruction(MarinaTest.marinaFleet.getOnlyInputDock(), instr)));
+    }
+
+    /* put a torpedo into the InstructionStopper */
+    public void fillTorpedo() {
+        throw new RuntimeException("currently not implemented");
     }
 }
index 1775d07..15bef38 100644 (file)
@@ -37,6 +37,8 @@ public class Marina {
     private static final int COUNTER_LENGTH = 34;
     private static final int INSTRUCTION_SEND_NDX = 1;
     private static final int INSTRUCTION_RECIRCULATE_NDX = 0;
+
+    public static final int INSTRUCTION_LENGTH = 36;
         
     private static final int A_FLAG_NDX = 0;
     private static final int B_FLAG_NDX = 1;
index d5c6e0e..7005f95 100644 (file)
@@ -36,6 +36,9 @@ import edu.berkeley.fleet.marina.MarinaPath;
  * Tests for Marina
  */
 public class MarinaTest {
+    public static final MarinaFleet marinaFleet = new MarinaFleet();
+    public static final Dock dock = marinaFleet.getOnlyInputDock();
+
     //--------------------------  constants -----------------------------------
     private static final String SCAN_CHAIN_XML = "marina.xml";
     private static final String NET_LIST = "marina.spi";
@@ -45,7 +48,6 @@ public class MarinaTest {
     public static final int INDEX_OF_ADDRESS_BIT_COPIED_TO_C_FLAG_WHEN_DC_EQUALS_ONE  = 13;
     public static final int INDEX_OF_ADDRESS_BIT_COPIED_TO_C_FLAG_WHEN_DC_EQUALS_ZERO = 0;
         
-    public static final Dock DOCK = InstructionStopper.DOCK;
     public static final Instruction.Set.FlagFunction CLEAR_FLAG 
         = Instruction.Set.FlagFunction.ZERO;
     public static final Instruction.Set.FlagFunction SET_FLAG 
@@ -483,7 +485,7 @@ public class MarinaTest {
 
         prln("send token");
         marina.instrIn.fill(
-                            new Instruction.Move(DOCK,
+                            new Instruction.Move(dock,
                                                  Predicate.IgnoreFlagD, /* predicate   */
                                                  false,                 /* torpedoable */
                                                  null,                  /* path        */
@@ -510,13 +512,13 @@ public class MarinaTest {
         
         prln("ILC=1");
         marina.instrIn.fill(
-                            new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+                            new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
 
         //getCtrsFlags(marina);
         
         prln("send data");
         marina.instrIn.fill(
-                            new Instruction.Move(DOCK,
+                            new Instruction.Move(dock,
                                                  Predicate.IgnoreFlagD, /* predicate   */
                                                  false,                 /* torpedoable */
                                                  null,                  /* path        */
@@ -545,7 +547,7 @@ public class MarinaTest {
         
         prln("ILC=\\infty");
         marina.instrIn.fill(
-                            new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity));
+                            new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity));
 
         getCtrsFlags(marina);
         
@@ -567,7 +569,7 @@ public class MarinaTest {
     private void setOLC(Marina marina, int olc) {
         // ugly hack, to be removed when we fix the zero-detect circuit
         for(int i=0; i<2; i++) {
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, olc));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, olc));
         }
     }
 
@@ -591,7 +593,7 @@ public class MarinaTest {
                 setOLC(marina, olc);
 
                 prln("Inserting ["+(predicate_olc_nonzero?"olc!=0":"olc==0")+"] send data");
-                marina.instrIn.fill(new Instruction.Move(DOCK,
+                marina.instrIn.fill(new Instruction.Move(dock,
                                                          predicate_olc_nonzero  /* predicate   */
                                                          ? only_if_olc_nonzero
                                                          : only_if_olc_zero
@@ -627,7 +629,7 @@ public class MarinaTest {
         for(boolean flag_a : new boolean[] { false, true }) {
             for(boolean flag_b : new boolean[] { false, true }) {
                 prln("Setting flags, a="+flag_a+" b="+flag_b);
-                marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+                marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                         flag_a
                                                         ? Instruction.Set.FlagFunction.ONE
                                                         : Instruction.Set.FlagFunction.ZERO,
@@ -648,8 +650,8 @@ public class MarinaTest {
 
                     prln("Attempting send data with a="+flag_a+", b="+flag_b+", predicate="+predicate.getClass().getName());
                     adjustIndent(2);
-                    marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
-                    marina.instrIn.fill(new Instruction.Move(DOCK,
+                    marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+                    marina.instrIn.fill(new Instruction.Move(dock,
                                                              predicate,             /* predicate   */
                                                              false,                 /* torpedoable */
                                                              null,                  /* path        */
@@ -704,7 +706,7 @@ public class MarinaTest {
             int inOlc = 0x20 >> i;
             prln("Set inOlc="+inOlc);
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, inOlc));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, inOlc));
             int outOlc = marina.getOLC();
             fatal(outOlc!=inOlc, "walkOneOLC: got="+outOlc+" expected="+inOlc);
         }
@@ -720,7 +722,7 @@ public class MarinaTest {
             prln("inIlc="+inIlc);
 
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, inIlc));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, inIlc));
 
             Ilc ilc = marina.getILC();
             int outIlc = ilc.getCount();
@@ -733,7 +735,7 @@ public class MarinaTest {
         }
         prln("Now test the infinity bit");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
         Ilc ilc = marina.getILC();
         fatal(!ilc.getInfinity(), "bad Infinity bit: false");
         adjustIndent(-2);
@@ -746,14 +748,14 @@ public class MarinaTest {
         
         prln("Set ILC=63");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, maxIlc));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, maxIlc));
 
         int ilc = marina.getILC().getCount();
         fatal(ilc!=maxIlc, "bad ILC count: "+ilc+" expected: "+maxIlc);
                 
         prln("execute a move instruction that does nothing except decrement the ILC to zero");
         marina.instrIn.fill(
-                            new Instruction.Move(DOCK,
+                            new Instruction.Move(dock,
                                                  Predicate.IgnoreFlagD,   /* predicate   */
                                                  false,                 /* torpedoable */
                                                  null,                  /* path        */
@@ -782,13 +784,13 @@ public class MarinaTest {
         adjustIndent(2);
         
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, maxOlc));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, maxOlc));
         for (int i=maxOlc; i>=0; i--) {
             prln("OLC should be: "+i);
             int olc = marina.getOLC();
             fatal(olc!=i, "bad OLC: "+olc+" expected: "+i);
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, SetSource.Decrement));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, SetSource.Decrement));
         }
 
         adjustIndent(-2);
@@ -816,7 +818,7 @@ public class MarinaTest {
     }
 
     private static final Instruction NOP =
-        new Instruction.Move(DOCK,
+        new Instruction.Move(dock,
                              Predicate.IgnoreFlagD,   /* predicate   */
                              false,                 /* torpedoable */
                              null,                  /* path        */
@@ -829,7 +831,7 @@ public class MarinaTest {
                              );
 
     private static final Instruction REQUEUEING_NOP =
-        new Instruction.Move(DOCK,
+        new Instruction.Move(dock,
                              Predicate.IgnoreFlagD,   /* predicate   */
                              false,                 /* torpedoable */
                              null,                  /* path        */
@@ -842,7 +844,7 @@ public class MarinaTest {
                              );
 
     private static final Instruction SEND_DATA =
-        new Instruction.Move(DOCK,
+        new Instruction.Move(dock,
                              Predicate.IgnoreFlagD,   /* predicate   */
                              false,                 /* torpedoable */
                              null,                  /* path        */
@@ -855,7 +857,7 @@ public class MarinaTest {
                              );
 
     private static final Instruction RECV_DATA =
-        new Instruction.Move(DOCK,
+        new Instruction.Move(dock,
                              Predicate.IgnoreFlagD,   /* predicate   */
                              false,                 /* torpedoable */
                              null,                  /* path        */
@@ -868,7 +870,7 @@ public class MarinaTest {
                              );
 
     private static final Instruction SEND_TOKEN =
-        new Instruction.Move(DOCK,
+        new Instruction.Move(dock,
                              Predicate.IgnoreFlagD,   /* predicate   */
                              false,                 /* torpedoable */
                              null,                  /* path        */
@@ -881,7 +883,7 @@ public class MarinaTest {
                              );
 
     private static final Instruction RECV_TOKEN =
-        new Instruction.Move(DOCK,
+        new Instruction.Move(dock,
                              Predicate.IgnoreFlagD,   /* predicate   */
                              false,                 /* torpedoable */
                              null,                  /* path        */
@@ -894,7 +896,7 @@ public class MarinaTest {
                              );
 
     private static final Instruction REQUEUEING_SEND_DATA =
-        new Instruction.Move(DOCK,
+        new Instruction.Move(dock,
                              Predicate.IgnoreFlagD,   /* predicate   */
                              false,                 /* torpedoable */
                              null,                  /* path        */
@@ -953,7 +955,7 @@ public class MarinaTest {
         prln("Executing Set OLC="+olc_value);
         setOLC(marina, olc_value);
         prln("Executing Set ILC=1");
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
 
         // verify state0 "EPI->ring" and 0->1 transition
         prln("Executing Send Data (requeueable); this will cause 0->1 transition and be discarded");
@@ -963,13 +965,13 @@ public class MarinaTest {
 
         // verify state1 "EPI->ring"
         prln("Executing Set ILC=1; this will be recirculated");
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
 
         prln("Executing Send Data; this will be recirculated");
         marina.instrIn.fill(REQUEUEING_SEND_DATA);
 
         prln("Executing Set OLC--; this will be recirculated");
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.Decrement));
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.Decrement));
 
         // verify state1 "OD waits"
         dataItems = marina.data.drainMany(2);
@@ -977,7 +979,7 @@ public class MarinaTest {
 
         // verify 1->3 transition
         prln("Executing Tail; this will cause the 2->3 transition and be discarded");
-        marina.instrIn.fill(new Instruction.Tail(DOCK));
+        marina.instrIn.fill(new Instruction.Tail(dock));
 
         // State 3 //////////////////////////////////////////////////////////////////////////////
 
@@ -1029,7 +1031,7 @@ public class MarinaTest {
         setOLC(marina, olc_value);
 
         prln("Executing Set ILC=1");
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
 
         // insert many non-requeueing "send data item" instructions;
         // this will let us single-step the execution point by
@@ -1048,11 +1050,11 @@ public class MarinaTest {
         marina.instrIn.fill(REQUEUEING_SEND_DATA);
 
         prln("Inserting [Rq] Set OLC--; this will be recirculated");
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.Decrement));
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.Decrement));
 
         // insert the tail, which will cause the 0->2 transition
         prln("Inserting Tail");
-        marina.instrIn.fill(new Instruction.Tail(DOCK));
+        marina.instrIn.fill(new Instruction.Tail(dock));
 
         // State 2 //////////////////////////////////////////////////////////////////////////////
 
@@ -1113,7 +1115,7 @@ public class MarinaTest {
         }
 
         prln("inserting instruction: [Rq] Set ILC=1");
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
 
         prln("inserting instruction: [Rq] Send Data");
         marina.instrIn.fill(REQUEUEING_SEND_DATA);
@@ -1143,7 +1145,7 @@ public class MarinaTest {
           setOLC(marina, 63);
 
           prln("inserting instruction: Set ILC=1");
-          marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+          marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
 
           // if you uncomment this, then the NOP will be dropped and the test will pass
           //prln("inserting instruction: [Rq] Nop; this will cause 0->1 transition and possibly be discarded");
@@ -1153,10 +1155,10 @@ public class MarinaTest {
           marina.instrIn.fill(REQUEUEING_SEND_DATA);
 
           prln("inserting instruction: [Rq] Set ILC=1");
-          marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+          marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
 
           prln("inserting instruction: Tail");
-          marina.instrIn.fill(new Instruction.Tail(DOCK));
+          marina.instrIn.fill(new Instruction.Tail(dock));
 
           dataItems = marina.data.drainMany(3);
           fatal(dataItems.size()<3, "Expected exactly unlimited data items to emerge but got only: "+dataItems.size());
@@ -1191,7 +1193,7 @@ public class MarinaTest {
             prln((b?"Setting":"Clearing")+" flags");
 
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                 b ? one : zero,
                                                 b ? one : zero
                                                 ));
@@ -1226,7 +1228,7 @@ public class MarinaTest {
 
                                     // set A,B flags to a_state and b_state
                                     marina.instrIn.fill(new 
-                                                        Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+                                                        Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                                         a_state ? one : zero,
                                                                         b_state ? one : zero
                                                                         ));
@@ -1246,7 +1248,7 @@ public class MarinaTest {
                                     if (c_input!=null) func = func.add(c_input);
 
                                     Instruction inst = new 
-                                        Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+                                        Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                         !which ? func : zero.add(Predicate.FlagA),
                                                         which  ? func : zero.add(Predicate.FlagB)
                                                         );
@@ -1270,8 +1272,8 @@ public class MarinaTest {
         prln("Begin recvData");
         adjustIndent(2);
 
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
-        marina.instrIn.fill(new Instruction.Move(DOCK,
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
+        marina.instrIn.fill(new Instruction.Move(dock,
                                                  Predicate.IgnoreFlagD, /* predicate   */
                                                  true,                  /* torpedoable */
                                                  null,                  /* path        */
@@ -1282,7 +1284,7 @@ public class MarinaTest {
                                                  false,                 /* dataOut     */
                                                  false                  /* tokenOut    */
                                                  ));
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD, SET_FLAG, SET_FLAG));
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, SET_FLAG, SET_FLAG));
 
         prln("checking to confirm that A flag is cleared");
         fatal(marina.getFlagA(), "bad A flag: "+marina.getFlagA());
@@ -1326,7 +1328,7 @@ public class MarinaTest {
             fatal(dataItems.size()!=0,
                   "found a data item waiting in the north proper stopper, but should not have");
 
-            marina.instrIn.fill(new Instruction.Move(DOCK,
+            marina.instrIn.fill(new Instruction.Move(dock,
                                                      Predicate.IgnoreFlagD,   // predicate   
                                                      true,                  // torpedoable 
                                                      null,                  // path        
@@ -1366,7 +1368,7 @@ public class MarinaTest {
             marina.fillNorthProperStopper(new MarinaPacket(data, false, addr));
 
             marina.instrIn.fill(RECV_DATA);
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.DataLatch));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,SetSource.DataLatch));
 
             int olc = marina.getOLC();
             fatal(olc != (1<<bit), "expected olc to be " + (1<<bit) + ", but got " + olc); 
@@ -1390,9 +1392,9 @@ public class MarinaTest {
             data.set(bit, true);
             marina.fillNorthProperStopper(new MarinaPacket(data, false, addr));
 
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
             marina.instrIn.fill(RECV_DATA);
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.DataLatch));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.DataLatch));
 
             int ilc = marina.getILC().getCount();
             fatal(ilc != (1<<bit), "expected ilc to be " + (1<<bit) + ", but got " + ilc); 
@@ -1430,7 +1432,7 @@ public class MarinaTest {
 
         for(long val : new long[] { -1, 0, 1, (-1L << 14) }) {
             prln("inserting Set Data Latch (sign-extended) 37'b" + Long.toString(val, 1));
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                     Instruction.Set.SetDest.DataLatch,
                                                     val));
 
@@ -1464,7 +1466,7 @@ public class MarinaTest {
         adjustIndent(2);
 
         prln("clearing the D register");
-        marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                 Instruction.Set.SetDest.DataLatch,
                                                 0));
 
@@ -1478,7 +1480,7 @@ public class MarinaTest {
                 new edu.berkeley.fleet.api.BitVector(19);
             for(int i=0; i<immediate.length(); i++)
                 immediate.set(i, (val & (1L << i)) != 0);
-            marina.instrIn.fill(new Instruction.Shift(DOCK,Predicate.IgnoreFlagD,immediate));
+            marina.instrIn.fill(new Instruction.Shift(dock,Predicate.IgnoreFlagD,immediate));
 
             // shift over 19 LSB's towards MSB
             for(int i=0; i<19; i++)
@@ -1534,10 +1536,10 @@ public class MarinaTest {
                 marina.fillNorthProperStopper(new MarinaPacket(data, false, addr));
                 
                 prln("clearing flags");
-                marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
+                marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
                 
                 prln("executing recv data with Dc="+dc);
-                marina.instrIn.fill(new Instruction.Move(DOCK,
+                marina.instrIn.fill(new Instruction.Move(dock,
                                                          Predicate.IgnoreFlagD,   /* predicate   */
                                                          true,                  /* torpedoable */
                                                          null,                  /* path        */
@@ -1550,7 +1552,7 @@ public class MarinaTest {
                                                          ));
                 
                 prln("copying c-flag to a-flag");
-                marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+                marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                         Instruction.Set.FlagFunction.ZERO.add(Predicate.FlagC),
                                                         CLEAR_FLAG
                                                         ));
@@ -1578,10 +1580,10 @@ public class MarinaTest {
         for(int i=0; i<4; i++)
             bv.set(i, true);
 
-        MarinaPath path = new MarinaPath((MarinaFleet)DOCK.getShip().getFleet(), bv);
+        MarinaPath path = new MarinaPath((MarinaFleet)dock.getShip().getFleet(), bv);
 
         prln("send data with path="+bv);
-        marina.instrIn.fill(new Instruction.Move(DOCK,
+        marina.instrIn.fill(new Instruction.Move(dock,
                                                  Predicate.IgnoreFlagD,   /* predicate   */
                                                  false,                 /* torpedoable */
                                                  path,                  /* path        */
@@ -1604,7 +1606,7 @@ public class MarinaTest {
         fatalIfBitVectorsDoNotMatch(MarinaUtils.berkToSun(bv), mp.path.get(0,13));
 
         prln("send data with no change to path");
-        marina.instrIn.fill(new Instruction.Move(DOCK,
+        marina.instrIn.fill(new Instruction.Move(dock,
                                                  Predicate.IgnoreFlagD,   /* predicate   */
                                                  false,                 /* torpedoable */
                                                  null,                  /* path        */
@@ -1642,7 +1644,7 @@ public class MarinaTest {
             marina.fillNorthProperStopper(new MarinaPacket(packet_data, false, packet_path));
                                            
             prln("recv path, send data (using recv'd path)");
-            marina.instrIn.fill(new Instruction.Move(DOCK,
+            marina.instrIn.fill(new Instruction.Move(dock,
                                                      Predicate.IgnoreFlagD,   /* predicate   */
                                                      false,                 /* torpedoable */
                                                      null,                  /* path        */
@@ -1673,7 +1675,7 @@ public class MarinaTest {
             int ilc = bit<0 ? 0 : (1<<bit);
 
             prln("set ilc="+ilc);
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,ilc));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,ilc));
 
             prln("send data");
             marina.instrIn.fill(SEND_DATA);
@@ -1692,25 +1694,25 @@ public class MarinaTest {
         
         prln("Set OLC = 1");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 1));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 1));
 
         int olc = marina.getOLC();
         fatal(olc!=1, "bad OLC: "+olc+" expected: 1");
 
         prln("Set A=0, B=0");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
 
         fatal(marina.getFlagA(), "bad A flag: true");
         fatal(marina.getFlagB(), "bad B flag: true");
                 
         prln("Set ILC = Infinity");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, SetSource.Infinity));
                 
         prln("execute a move instruction that does nothing but loops until torpedo arrives"); 
         marina.instrIn.fill(
-                            new Instruction.Move(DOCK,
+                            new Instruction.Move(dock,
                                                  Predicate.IgnoreFlagD,   /* predicate   */
                                                  true,                 /* torpedoable */
                                                  null,                  /* path        */
@@ -1724,10 +1726,10 @@ public class MarinaTest {
         
         prln("A=1, B=1 This instruction should get torpedoed along with the Move");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.Default, SET_FLAG, SET_FLAG));
+                            Instruction.Set(dock,Predicate.Default, SET_FLAG, SET_FLAG));
 
         prln("send torpedo. This should clear the OLC");
-        marina.instrIn.fill(InstructionStopper.TORPEDO);
+        marina.instrIn.fillTorpedo();
                 
         getCtrsFlags(marina);
                 
@@ -1740,14 +1742,14 @@ public class MarinaTest {
         
         prln("OLC = 63. Reload OLC after torpedo");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 63));
 
         olc = marina.getOLC();
         fatal(olc!=63, "bad OLC: "+olc+" expected: 63");
                 
         prln("Set A=1, B=1 This instruction should execute because OLC!=0");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.Default, SET_FLAG, SET_FLAG));
+                            Instruction.Set(dock,Predicate.Default, SET_FLAG, SET_FLAG));
 
         prln("A and B should be true");
         fatal(!marina.getFlagA(), "bad A flag: false");
@@ -1765,10 +1767,10 @@ public class MarinaTest {
 
         for(boolean torpedoable : new boolean[] { true, false }) {
             prln("set ilc=\\infty");
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,SetSource.Infinity));
             
             prln("nop");
-            marina.instrIn.fill(new Instruction.Move(DOCK,
+            marina.instrIn.fill(new Instruction.Move(dock,
                                                      Predicate.IgnoreFlagD,   /* predicate   */
                                                      torpedoable,           /* torpedoable */
                                                      null,                  /* path        */
@@ -1787,7 +1789,7 @@ public class MarinaTest {
             fatal(dataItems.size()!=0, "Expected no data item(s) to emerge but got at least: "+dataItems.size()+" data items");
             
             prln("send torpedo");
-            marina.instrIn.fill(InstructionStopper.TORPEDO);
+            marina.instrIn.fillTorpedo();
             
             int expected = torpedoable?1:0;
             dataItems = marina.data.drainMany(2);
@@ -1818,9 +1820,9 @@ public class MarinaTest {
             int decr_amount = decr_amounts[which];
 
             prln("inserting set olc="+olc);
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,olc));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter,olc));
             prln("inserting set ilc=1");
-            marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
+            marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
 
             // commenting the following four lines causes this test to pass
             prln("disabling instruction send");
@@ -1830,11 +1832,11 @@ public class MarinaTest {
 
             prln("inserting "+decr_amount+" olc-- instructions");
             for(int i=0; i<decr_amount; i++)
-                marina.instrIn.fill(new Instruction.Set(DOCK,Predicate.IgnoreFlagD,
+                marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,
                                                         SetDest.OuterLoopCounter,SetSource.Decrement));
 
             prln("inserting [olc!=0] send data");
-            marina.instrIn.fill(new Instruction.Move(DOCK,
+            marina.instrIn.fill(new Instruction.Move(dock,
                                                      Predicate.Default,     /* predicate   */
                                                      false,                 /* torpedoable */
                                                      null,                  /* path        */
@@ -1875,11 +1877,11 @@ public class MarinaTest {
             int notZero = 32 >> i;
             prln("Set ILC=0");
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
                 
             prln("Then immediately set ILC="+notZero);
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
                 
             prln("Verify ILC using scan chain");
             Ilc ilc = marina.getILC();
@@ -1891,11 +1893,11 @@ public class MarinaTest {
                         
             prln("Set ILC="+notZero);
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, notZero));
                 
             prln("Then immediately set ILC=0");
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 0));
                         
             prln("Verify ILC using scan chain");
             ilc = marina.getILC();
@@ -1917,17 +1919,17 @@ public class MarinaTest {
 
         prln("Set A=0, B=0");
         marina.instrIn.fill(new 
-                            Instruction.Set(DOCK,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
+                            Instruction.Set(dock,Predicate.IgnoreFlagD, CLEAR_FLAG, CLEAR_FLAG));
 
         for (int i=0; i<6; i++) {
             int notZero = 32 >> i;
             prln("Set OLC=0");
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
         
             prln("Then immediately set OLC="+notZero);
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
         
             prln("Verify OLC count using scan chain");
             int outOlc = marina.getOLC();
@@ -1936,16 +1938,16 @@ public class MarinaTest {
             prln("Verify OLC zero bit using predication");
             prln("if (OLC==0) {A=1; B=1;} // should not get executed");
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.FlagD, SET_FLAG, SET_FLAG));
+                                Instruction.Set(dock,Predicate.FlagD, SET_FLAG, SET_FLAG));
             fatal(marina.getFlagA(), "bad A flag. expected: false");
         
             prln("Set OLC="+notZero);
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, notZero));
         
             prln("Then immediately set OLC=0");
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
+                                Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 0));
                         
             prln("Verify OLC count using scan chain");
             outOlc = marina.getOLC();
@@ -1954,7 +1956,7 @@ public class MarinaTest {
             prln("Verify OLC zero bit using predication");
             prln("if (OLC!=0) {A=1; B=1;} // should not get executed");
             marina.instrIn.fill(new 
-                                Instruction.Set(DOCK,Predicate.Default, SET_FLAG, SET_FLAG));
+                                Instruction.Set(dock,Predicate.Default, SET_FLAG, SET_FLAG));
             fatal(marina.getFlagA(), "bad A flag. expected: false");
         }