updates to saturateInstructionFifo()
authorAdam Megacz <adam.megacz@sun.com>
Mon, 17 Nov 2008 17:42:04 +0000 (17:42 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Mon, 17 Nov 2008 17:42:04 +0000 (17:42 +0000)
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index 890565d..bd9fbac 100644 (file)
@@ -50,11 +50,19 @@ 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
 
-        // 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;
+
+    // Officially, this should be the number of requeueing no-ops that
+    // can be inserted into an idle dock whose OLC is nonzero.
+    //
+    // Less formally, this is roughly the number of stages of
+    // buffering between the instruction insertion point and the
+    // instruction ring, plus the capacity of the instruction ring.
+    private static final int SATURATION_AMOUNT = 19;
+
+    // This is some number which is significantly greater than
+    // SATURATION_AMOUNT.  Increasing it may slow the tests down, but
+    // will never cause them to operate incorrectly.
+    private static final int MORE_THAN_SATURATION_AMOUNT = 25;
        
        // Nominal cycle time assuming 4 GHz throughput
        private static final double CYCLE_TIME_NS = 0.250;
@@ -452,8 +460,12 @@ public class MarinaTest {
             for(boolean flag_b : new boolean[] { false, true }) {
                 prln("Setting flags, a="+flag_a+" b="+flag_b);
                 marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,
-                                                        flag_a ? Instruction.Set.FlagFunction.ONE : Instruction.Set.FlagFunction.ZERO,
-                                                        flag_b ? Instruction.Set.FlagFunction.ONE : Instruction.Set.FlagFunction.ZERO
+                                                        flag_a
+                                                        ? Instruction.Set.FlagFunction.ONE
+                                                        : Instruction.Set.FlagFunction.ZERO,
+                                                        flag_b
+                                                        ? Instruction.Set.FlagFunction.ONE
+                                                        : Instruction.Set.FlagFunction.ZERO
                                                         ));
                getCtrsFlags(marina);
 
@@ -606,20 +618,20 @@ public class MarinaTest {
        prln("End countOlc");
     }
 
-    private void saturateInstructionFifo(Marina marina, Instruction instruction, boolean expect_it_to_jam_up) {
-        prln("Inserting "+(UPPER_BOUND_ON_INSTRUCTION_FIFO_SIZE+1)+" copies of \"" + instruction + "\"");
+    private void saturateInstructionFifo(Marina marina, Instruction instruction, int quantity, boolean expect_it_to_jam_up) {
+        prln("Inserting "+quantity+" copies of \"" + instruction + "\"");
        adjustIndent(2);
         int i=0;
-        for(i=0; i<(UPPER_BOUND_ON_INSTRUCTION_FIFO_SIZE+1); i++) {
+        for(i=0; i<quantity; i++) {
+            prln("Inserting instruction " + (i+1) +"/"+ quantity);
+            marina.instrIn.fill(instruction);
             boolean jammed = (marina.instrIn.getFillStateWire()==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));
-                marina.instrIn.fill(instruction);
+            fatal(jammed, "Instruction stopper did not drain after inserting " + (i+1) + " instructions; not good!");
         }
         fatal(expect_it_to_jam_up, "Expected instruction stopper to jam up, but it did not");
        adjustIndent(-2);
@@ -648,7 +660,7 @@ public class MarinaTest {
         marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,1));
         prln("Executing Set OLC--");
         marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,SetSource.Decrement));
-        saturateInstructionFifo(marina, REQUEUEING_NOP, false);
+        saturateInstructionFifo(marina, REQUEUEING_NOP, MORE_THAN_SATURATION_AMOUNT, false);
        adjustIndent(-2);
         prln("End testRequeueStage0");
     }
@@ -659,7 +671,7 @@ public class MarinaTest {
 
         prln("Executing Set OLC=63");
         marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,63));
-        saturateInstructionFifo(marina, REQUEUEING_NOP, true);
+        saturateInstructionFifo(marina, REQUEUEING_NOP, MORE_THAN_SATURATION_AMOUNT, true);
        adjustIndent(-2);
         prln("End testRequeueStage0to1");
     }