test 3007
authorAdam Megacz <adam.megacz@sun.com>
Mon, 17 Nov 2008 20:22:06 +0000 (20:22 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Mon, 17 Nov 2008 20:22:06 +0000 (20:22 +0000)
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index 9dd2ef3..9e776ce 100644 (file)
@@ -64,6 +64,23 @@ public class MarinaTest {
     // will never cause them to operate incorrectly.
     private static final int MORE_THAN_INSTRUCTION_IN_SATURATION_AMOUNT = 25;
        
+    // Officially, this should be the number of data items which can
+    // be sent from the dock while the "data" propper stopper is in
+    // the "stopped" state
+    //
+    // Less formally, this is roughly the number of stages of
+    // buffering between the dock's data successor and the "data"
+    // propper stopper
+    /*
+      FIXME: what is the correct value here?
+    private static final int DATA_OUT_SATURATION_AMOUNT = XXX;
+    */
+
+    // This is some number which is significantly greater than
+    // DATA_OUT_SATURATION_AMOUNT.  Increasing it may slow the tests down, but
+    // will never cause them to operate incorrectly.
+    private static final int MORE_THAN_DATA_OUT_SATURATION_AMOUNT = 16;
+       
        // Nominal cycle time assuming 4 GHz throughput
        private static final double CYCLE_TIME_NS = 0.250;
 
@@ -404,7 +421,7 @@ public class MarinaTest {
     }
 
     private void sendData(Marina marina) {
-       prln("Begin sendToken");
+       prln("Begin sendData");
        adjustIndent(2);
        
        prln("ILC=1");
@@ -431,7 +448,7 @@ public class MarinaTest {
         getCtrsFlags(marina);
         
         List<BitVector> dataItems = marina.data.drainMany();
-        fatal(dataItems.size()!=1, "Expected one token to emerge but got: "+dataItems.size()+" tokens");
+        fatal(dataItems.size()!=1, "Expected one data item to emerge but got: "+dataItems.size()+" data items");
         
         prln("Datum="+MarinaUtils.formatDataTokAddr(dataItems.get(0)));
 
@@ -712,6 +729,65 @@ public class MarinaTest {
         prln("End testRequeueStage0to1");
     }
 
+    private void testRequeueStage0to1to3(Marina marina) {
+        prln("Begin testRequeueStage0to1to3");
+       adjustIndent(2);
+
+        prln("Executing Set OLC=63");
+        marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,63));
+
+       prln("Executing Set ILC=1");
+       marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.InnerLoopCounter, 1));
+
+       prln("Executing Send Data (requeueable); this will cause 0->1 transition and be discarded");
+        marina.instrIn.fill(new Instruction.Move(DOCK,
+                                                 false,                 /* requeueing  */
+                                                 Predicate.IgnoreOLC,   /* predicate   */
+                                                 false,                 /* torpedoable */
+                                                 null,                  /* path        */
+                                                 false,                 /* tokenIn     */
+                                                 false,                 /* dataIn      */
+                                                 false,                 /* latchData   */
+                                                 false,                 /* latchPath   */
+                                                 true,                  /* dataOut     */
+                                                 false                  /* tokenOut    */
+                                                 ));
+
+       prln("Executing Set ILC=1 (requeueable); this will be requeued once TAIL happens");
+        marina.instrIn.fill(new Instruction.Set(DOCK,true,Predicate.IgnoreOLC,SetDest.InnerLoopCounter, 1));
+
+       prln("Executing Send Data (requeueable); this will be recirculated");
+        marina.instrIn.fill(new Instruction.Move(DOCK,
+                                                 false,                 /* requeueing  */
+                                                 Predicate.IgnoreOLC,   /* predicate   */
+                                                 false,                 /* torpedoable */
+                                                 null,                  /* path        */
+                                                 false,                 /* tokenIn     */
+                                                 false,                 /* dataIn      */
+                                                 false,                 /* latchData   */
+                                                 false,                 /* latchPath   */
+                                                 true,                  /* dataOut     */
+                                                 false                  /* tokenOut    */
+                                                 ));
+
+        List<BitVector> dataItems;
+
+        dataItems = marina.data.drainMany(2);
+        fatal(dataItems.size()!=1, "Expected exactly one data item to emerge but got: "+dataItems.size()+" data items");
+
+        // now we should be in state 1
+       prln("Executing Tail");
+        marina.instrIn.fill(new Instruction.Tail(DOCK));
+
+        // now we should be in state 3
+        dataItems = marina.data.drainMany(MORE_THAN_DATA_OUT_SATURATION_AMOUNT);
+        fatal(dataItems.size()!=MORE_THAN_DATA_OUT_SATURATION_AMOUNT,
+              "Expected an endless supply of data items, but only got: "+dataItems.size()+" of them");
+
+       adjustIndent(-2);
+        prln("End testRequeueStage0to1to3");
+    }
+
     private void testFlagAB(Marina marina) {
        prln("Begin testFlagAB");
        adjustIndent(2);
@@ -848,6 +924,7 @@ public class MarinaTest {
                case 3004: testFlagZ(marina); break;
                case 3005: testPredicationOnAB(marina); break;
                 case 3006: sendData(marina); break;
+               case 3007: testRequeueStage0to1to3(marina); break;
 
                default:
                        fatal(true, "Test number: "+testNum+" doesn't exist.");