add testOlcDecrementAtHighSpeed()
authorAdam Megacz <adam.megacz@sun.com>
Tue, 9 Dec 2008 22:03:37 +0000 (22:03 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Tue, 9 Dec 2008 22:03:37 +0000 (22:03 +0000)
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index 9f33b93..07aa38e 100644 (file)
@@ -1707,10 +1707,60 @@ public class MarinaTest {
         adjustIndent(2);
 
         List<BitVector> dataItems;
+        
+        // Each element of the following pair of arrays is one "test".
+        // The OLC will be loaded with olcs[i] and then decremented
+        // decr_amounts[i] times; after that has happened the zeroness
+        // of the OLC will be checked by executing a MOVE with
+        // [olc!=0] as the predicate.
+
+        int[] olcs         = new int[] { 3 /*, 3, 3, 10, 41*/ };
+        int[] decr_amounts = new int[] { 2 /*, 3, 4, 9,  10*/ };
+
+        for(int which=0; which<olcs.length; which++) {
+            int olc = olcs[which];
+            int decr_amount = decr_amounts[which];
+
+            prln("inserting set olc="+olc);
+            marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,olc));
+            prln("inserting set ilc=1");
+            marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.InnerLoopCounter,1));
+
+            /*
+            prln("disabling instruction send");
+            marina.enableInstructionSend(false);
+            prln("enabling instruction recirculate");
+            marina.enableInstructionRecirculate(true);
+            */
 
-        int olc = 3;
-        prln("set olc="+olc);
-        marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,olc));
+            prln("inserting "+decr_amount+" olc-- instructions");
+            for(int i=0; i<decr_amount; i++)
+                marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,
+                                                        SetDest.OuterLoopCounter,SetSource.Decrement));
+
+            prln("inserting [olc!=0] send data");
+            marina.instrIn.fill(new Instruction.Move(DOCK,
+                                                     false,                 /* requeueing  */
+                                                     Predicate.Default,     /* predicate   */
+                                                     false,                 /* torpedoable */
+                                                     null,                  /* path        */
+                                                     false,                 /* tokenIn     */
+                                                     false,                 /* dataIn      */
+                                                     false,                 /* latchData   */
+                                                     false,                 /* latchPath   */
+                                                     true,                  /* dataOut     */
+                                                     false                  /* tokenOut    */
+                                                     ));
+
+            prln("disabling instruction recirculate");
+            marina.enableInstructionRecirculate(false);
+            prln("enabling instruction send");
+            marina.enableInstructionSend(true);
+
+            int expected = decr_amount>=olc ? 0 : 1;
+            dataItems = marina.data.drainMany(2);
+            fatal(dataItems.size()!=expected, "Expected "+expected+" item to emerge but got: "+dataItems.size()+" data items");
+        }
 
         adjustIndent(-2);
         prln("End testOlcDecrementAtHighSpeed");
@@ -1887,6 +1937,7 @@ public class MarinaTest {
                 case 3021: recvPath(marina); break;
                 case 3022: testILC(marina); break;
                 case 3023: testTorpedoOnAnInfiniteNop(marina); break;
+                case 3025: testOlcDecrementAtHighSpeed(marina); break;
 
                default:
                        fatal(true, "Test number: "+testNum+" doesn't exist.");