revise testRequeueStage0to1
authorAdam Megacz <adam.megacz@sun.com>
Wed, 12 Nov 2008 17:50:59 +0000 (17:50 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Wed, 12 Nov 2008 17:50:59 +0000 (17:50 +0000)
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index da418e1..f43b7d6 100644 (file)
@@ -50,11 +50,11 @@ public class MarinaTest {
        // COLUMN_LATENCY is a delay that is larger than the latency through an Infinity column
        private static final int COLUMN_LATENCY = 10; // nanoseconds
 
-        // maximum number of instructions that fit in the instruction
-        // ring; note that in order for the ring to circulate, you
-        // must insert no more than INSTRUCTION_FIFO_CAPACITY-1
-        // instructions
-       private static final int INSTRUCTION_FIFO_CAPACITY = 13;
+        // This must be GREATER THAN the maximum number of
+        // instructions that fit in the instruction ring.  Increasing
+        // it will slow down the tests, but will not affect their
+        // correctness.
+       private static final int UPPER_BOUND_ON_INSTRUCTION_FIFO_SIZE = 18;
        
        // Nominal cycle time assuming 4 GHz throughput
        private static final double CYCLE_TIME_NS = 0.250;
@@ -614,15 +614,24 @@ public class MarinaTest {
        prln("End countOlc");
     }
 
-    private void saturateInstructionFifo(IsolatedInDock inDock, Instruction instruction) {
-        prln("Inserting "+(INSTRUCTION_FIFO_CAPACITY+1)+" copies of \"" + instruction + "\"");
+    private void saturateInstructionFifo(IsolatedInDock inDock, Instruction instruction, boolean expect_it_to_jam_up) {
+        prln("Inserting "+(UPPER_BOUND_ON_INSTRUCTION_FIFO_SIZE+1)+" copies of \"" + instruction + "\"");
        adjustIndent(2);
-        for(int i=0; i<(INSTRUCTION_FIFO_CAPACITY+1); i++) {
-            prln("Inserting instruction " + (i+1) +"/"+ (INSTRUCTION_FIFO_CAPACITY+1));
-            inDock.instrIn.fill(instruction);
+        int i=0;
+        for(i=0; i<(UPPER_BOUND_ON_INSTRUCTION_FIFO_SIZE+1); i++) {
+            boolean jammed = (inDock.instrIn.isFillStageFull()==MarinaUtils.StateWireState.FULL);
+            if (jammed && expect_it_to_jam_up) {
+                prln("Stopper remained full after inserting instruction; this was expected; we are happy.");
+                adjustIndent(-2);
+                return;
+            }
+            fatal(jammed, "Instruction stopper did not drain after inserting " + i + " instructions; not good!");
+            prln("Inserting instruction " + (i+1) +"/"+ (UPPER_BOUND_ON_INSTRUCTION_FIFO_SIZE+1));
+                inDock.instrIn.fill(instruction);
         }
+        fatal(expect_it_to_jam_up, "Expected instruction stopper to jam up, but it did not");
        adjustIndent(-2);
-        prln("Successfully inserted " + (INSTRUCTION_FIFO_CAPACITY+1) + " instructions");
+        prln("Successfully inserted " + i + " instructions");
     }
 
     private static final Instruction REQUEUEING_NOP =
@@ -647,7 +656,7 @@ public class MarinaTest {
         inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,1));
         prln("Executing Set OLC--");
         inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,SetSource.Decrement));
-        saturateInstructionFifo(inDock, REQUEUEING_NOP);
+        saturateInstructionFifo(inDock, REQUEUEING_NOP, false);
        adjustIndent(-2);
         prln("End testRequeueStage0");
     }
@@ -656,9 +665,9 @@ public class MarinaTest {
         prln("Begin testRequeueStage0to1");
        adjustIndent(2);
 
-        prln("Executing Set OLC=1");
-        inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,1));
-        saturateInstructionFifo(inDock, REQUEUEING_NOP);  /** FIXME: expect it to jam up */
+        prln("Executing Set OLC=63");
+        inDock.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,63));
+        saturateInstructionFifo(inDock, REQUEUEING_NOP, true);
        adjustIndent(-2);
         prln("End testRequeueStage0to1");
     }