add test 3023, testTorpedoOnAnInfiniteNop()
authorAdam Megacz <adam.megacz@sun.com>
Mon, 24 Nov 2008 19:53:37 +0000 (19:53 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Mon, 24 Nov 2008 19:53:37 +0000 (19:53 +0000)
testCode/com/sun/vlsi/chips/marina/test/Marina.java
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index 320a151..9bd5b6f 100644 (file)
@@ -6,6 +6,8 @@ import com.sun.async.test.ChipModel;
 import com.sun.async.test.JtagTester;
 import com.sun.async.test.NanosimModel;
 
+import edu.berkeley.fleet.api.Instruction;
+
 /** The Marina object will eventually represent the Marina test chip.  
  * Right now, it doesn't do much of anything. It just helps me exercise
  * my test infrastructure. */
@@ -195,6 +197,14 @@ public class Marina {
     public void fillNorthProperStopper(MarinaPacket mp) {
         this.data.fill(mp.toSingleBitVector());
     }
+    /** Fill the "South" Fifo ring with instructions */
+    public void fillSouthProperStopper(Instruction[] instructions) {
+        enableInstructionSend(false);
+        enableInstructionRecirculate(false);
+        for(Instruction i : instructions)
+            instrIn.fill(i);
+        enableInstructionSend(true);
+    }
     /** Enable the transmission of instructions from the instruction
      * ring test structure to the EPI FIFO. */
     public void enableInstructionSend(boolean b) {
index 88ef81a..54518e6 100644 (file)
@@ -1344,7 +1344,7 @@ public class MarinaTest {
             boolean mismatch = false;
             String err = "";
             for(int i=0; i<37; i++) {
-                if (bv.get(37-i) != ( (val & (1L << i)) != 0 )) {
+                if (bv.get(i) != ( (val & (1L << i)) != 0 )) {
                     mismatch = true;
                     err += ""+i+", ";
                 }
@@ -1396,7 +1396,7 @@ public class MarinaTest {
             boolean mismatch = false;
             String err = "";
             for(int i=0; i<37; i++) {
-                if (bv.get(37-i) != ( (val & (1L << i)) != 0 )) {
+                if (bv.get(i) != ( (val & (1L << i)) != 0 )) {
                     mismatch = true;
                     err += ""+i+", ";
                 }
@@ -1660,6 +1660,91 @@ public class MarinaTest {
                adjustIndent(-2);
        prln("End sendTorpedo");        
     }    
+
+    private void testTorpedoOnAnInfiniteNop(Marina marina) {
+        prln("Begin testTorpedoOnAnInfiniteNop");
+        adjustIndent(2);
+
+        List<BitVector> dataItems;
+
+        for(boolean torpedoable : new boolean[] { true, false }) {
+            prln("set ilc=\\infty");
+            marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.InnerLoopCounter,SetSource.Infinity));
+            
+            prln("nop");
+            marina.instrIn.fill(new Instruction.Move(DOCK,
+                                                     false,                 /* requeueing  */
+                                                     Predicate.IgnoreOLC,   /* predicate   */
+                                                     torpedoable,           /* torpedoable */
+                                                     null,                  /* path        */
+                                                     false,                 /* tokenIn     */
+                                                     false,                 /* dataIn      */
+                                                     false,                 /* latchData   */
+                                                     false,                 /* latchPath   */
+                                                     false,                 /* dataOut     */
+                                                     false                  /* tokenOut    */
+                                                     ));
+            prln("send data");
+            marina.instrIn.fill(SEND_DATA);
+            
+            // expect nothing to come out, because the NOP is executing
+            dataItems = marina.data.drainMany(10);
+            fatal(dataItems.size()!=0, "Expected no data item(s) to emerge but got at least: "+dataItems.size()+" data items");
+            
+            prln("send torpedo");
+            marina.instrIn.fill(InstructionStopper.TORPEDO);
+            
+            int expected = torpedoable?1:0;
+            dataItems = marina.data.drainMany(2);
+            fatal(dataItems.size()!=expected, "Expected "+expected+" item to emerge but got: "+dataItems.size()+" data items");
+        }
+
+        adjustIndent(-2);
+        prln("End testTorpedoOnAnInfiniteNop");
+    }
+
+    private void testOlcDecrementAtHighSpeed(Marina marina) {
+        prln("Begin testOlcDecrementAtHighSpeed");
+        adjustIndent(2);
+
+        List<BitVector> dataItems;
+
+        int olc = 3;
+        prln("set olc="+olc);
+        marina.instrIn.fill(new Instruction.Set(DOCK,false,Predicate.IgnoreOLC,SetDest.OuterLoopCounter,olc));
+            
+            prln("nop");
+            marina.instrIn.fill(new Instruction.Move(DOCK,
+                                                     false,                 /* requeueing  */
+                                                     Predicate.IgnoreOLC,   /* predicate   */
+                                                     torpedoable,           /* torpedoable */
+                                                     null,                  /* path        */
+                                                     false,                 /* tokenIn     */
+                                                     false,                 /* dataIn      */
+                                                     false,                 /* latchData   */
+                                                     false,                 /* latchPath   */
+                                                     false,                 /* dataOut     */
+                                                     false                  /* tokenOut    */
+                                                     ));
+            prln("send data");
+            marina.instrIn.fill(SEND_DATA);
+            
+            // expect nothing to come out, because the NOP is executing
+            dataItems = marina.data.drainMany(10);
+            fatal(dataItems.size()!=0, "Expected no data item(s) to emerge but got at least: "+dataItems.size()+" data items");
+            
+            prln("send torpedo");
+            marina.instrIn.fill(InstructionStopper.TORPEDO);
+            
+            int expected = torpedoable?1:0;
+            dataItems = marina.data.drainMany(2);
+            fatal(dataItems.size()!=expected, "Expected "+expected+" item to emerge but got: "+dataItems.size()+" data items");
+        }
+
+        adjustIndent(-2);
+        prln("End testTorpedoOnAnInfiniteNop");
+    }
+
     private void flipIlcBit(Marina marina) {
        prln("Begin flipIlcBit");
        adjustIndent(2);
@@ -1830,6 +1915,7 @@ public class MarinaTest {
                 case 3020: setIlcFromDataLatch(marina); break;
                 case 3021: recvPath(marina); break;
                 case 3022: testILC(marina); break;
+                case 3023: testTorpedoOnAnInfiniteNop(marina); break;
 
                default:
                        fatal(true, "Test number: "+testNum+" doesn't exist.");