add MarinaTest.loadEveryValueOLC()
[fleet.git] / marina / testCode / com / sun / vlsi / chips / marina / test / MarinaTest.java
index 06035b9..798dd4e 100644 (file)
@@ -817,6 +817,41 @@ public class MarinaTest {
         adjustIndent(-2);
         prln("End countOlc");
     }
+    private void loadEveryValueOLC(Marina marina) {
+        adjustIndent(2);
+        for (int i=0; i<(1<<6); i++) {
+
+            if (marina.kesselsCounter) {
+                System.out.println("master-clearing...");
+                // master clear on each iteration; otherwise we'd need to "run down" the olc
+                marina.masterClear();
+                marina.enableInstructionSend(true);
+            }
+
+            int inOlc = i;
+            marina.fillSouthProperStopper(new Instruction[] {
+
+                    // to ensure that instruction is bubble-limited
+                    RECV_DATA,
+
+                    // the Set-OLC instruction
+                    new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, inOlc),
+
+                    // put a Set-ILC instruction right behind it with inverted bits to be sure we're
+                    // not capturing the instruction-latch value too late in the cycle
+                    new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, (inOlc ^ (~(-1<<6)))),
+                    
+                });
+
+            model.waitNS(128 * CYCLE_TIME_NS);
+            marina.fillNorthProperStopper();
+            model.waitNS(128 * CYCLE_TIME_NS);
+
+            expectOlc(inOlc);
+            prln("loadEveryValueOLC: "+inOlc+" checks out");
+        }
+        adjustIndent(-2);
+    }
 
     private void saturateInstructionFifo(Marina marina, Instruction instruction, int quantity, boolean expect_it_to_jam_up) {
         prln("Inserting "+quantity+" copies of \"" + instruction + "\"");
@@ -1102,12 +1137,10 @@ public class MarinaTest {
                 new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1),
                 SEND_DATA,
             });
-        dataItems = marina.data.drainMany(1);
-        fatal(dataItems.size()!=0, "Expected exactly no data items to emerge but got at least: "+dataItems.size());
-        marina.instrIn.fill(new Instruction.Tail(dock));
 
-        BitVector bv = marina.data.drain();
-        fatal(bv==null, "Expected at least one data item to emerge but got none");
+        expectNorthFifoExactly(0);
+        marina.instrIn.fill(new Instruction.Tail(dock));
+        expectNorthFifoAtLeast(1);
 
         adjustIndent(-2);
         prln("End testHeadWaitsForTail");
@@ -1912,6 +1945,45 @@ public class MarinaTest {
         prln("End testTorpedoOnAnInfinite");
     }
 
+    private void testDFlagWhenTorpedoLyingInWait(Marina marina) {
+        marina.fillSouthProperStopper(new Instruction[] {
+                RECV_DATA,
+                TORPEDOABLE_RECV_DATA,
+                marina.kesselsCounter ? null : FLAG_NOP,
+                SEND_DATA_IF_D_SET,
+            });
+        marina.instrIn.fillTorpedo();
+        model.waitNS(64 * CYCLE_TIME_NS);
+        marina.fillNorthProperStopper();
+        model.waitNS(64 * CYCLE_TIME_NS);
+        expectNorthFifoExactly(1);
+    }
+
+    private void testSetOlcFollowedByDPredicated(Marina marina) {
+        for(boolean d_set : new boolean[] { false, true }) {
+            prln("");
+            marina.fillSouthProperStopper(new Instruction[] {
+                    setOlc(0),
+                    marina.kesselsCounter ? null : FLAG_NOP,
+                    d_set ? SEND_DATA_IF_D_SET : SEND_DATA_IF_D_NOT_SET,
+                });
+            expectNorthFifoExactly(d_set ? 1 : 0);
+
+            prln("");
+            marina.fillSouthProperStopper(new Instruction[] {
+                    setOlc(32),
+                    marina.kesselsCounter ? null : FLAG_NOP,
+                    d_set ? SEND_DATA_IF_D_SET : SEND_DATA_IF_D_NOT_SET,
+                });
+            expectNorthFifoExactly(d_set ? 0 : 1);
+
+            if (marina.kesselsCounter) {
+                marina.masterClear();
+                marina.enableInstructionSend(true);
+            }
+        }
+    }
+
     private void testOlcDecrementAtHighSpeed(Marina marina) {
         prln("Begin testOlcDecrementAtHighSpeed");
         adjustIndent(2);
@@ -2109,6 +2181,23 @@ public class MarinaTest {
         adjustIndent(-2);
         prln("End testSouthRecirculate("+AMOUNT+")");
     }
+
+
+    private void testOverfillTokens(Marina marina) {
+        prln("Begin testOverfillTokens");
+        adjustIndent(2);
+
+        for(int i=0; i<marina.TOKEN_FIFO_CAPACITY + 3; i++)
+            marina.instrIn.fill(SEND_TOKEN);
+        marina.instrIn.fill(SEND_DATA);
+        expectNorthFifoExactly(0);
+        
+        adjustIndent(-2);
+        prln("End testSouthRecirculate");
+    }
+
+
+
     private void doOneTest(int testNum) {
         prln("");
         prln("============================================================");