add Marina.dispatch(Instruction[]) and Marina.Ilc.toString()
authorAdam Megacz <adam.megacz@sun.com>
Wed, 6 May 2009 18:50:36 +0000 (18:50 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Wed, 6 May 2009 18:50:36 +0000 (18:50 +0000)
testCode/com/sun/vlsi/chips/marina/test/Marina.java
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index ce76f93..12a0fdf 100644 (file)
@@ -81,6 +81,9 @@ public class Marina {
         public int getCount() {
             return value & 0x3f;
         }
+        public String toString() {
+            return "[ilc, count="+getCount()+", infinity="+getInfinity()+", done="+getDone()+"]";
+        }
     }
         
     private final Indenter indenter;
@@ -373,5 +376,16 @@ public class Marina {
     public void enableInstructionCounter(Boolean b) {
         instrIn.setGeneralPurposeOutput(b);
     }
+
+    public void dispatch(Instruction[] instructions) {
+        enableInstructionSend(false);
+        enableInstructionRecirculate(true);
+        for(Instruction i : instructions)
+            instrIn.fill(i);
+        enableInstructionRecirculate(false);
+        enableInstructionSend(true);
+        instrIn.run();
+    }
+
     
 }
index 27f9522..af1e1d7 100644 (file)
@@ -640,6 +640,8 @@ public class MarinaTest {
         
         List<BitVector> dItems;
 
+        prln("Setting OLC=1");
+        marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.OuterLoopCounter, 1));
         prln("Setting ILC=1");
         marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter, 1));
 
@@ -1768,6 +1770,8 @@ public class MarinaTest {
             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");
+
+            fatal(!marina.getILC().getDone(), "Expected ilc=done, but got "+marina.getILC());
         }
 
         adjustIndent(-2);
@@ -1799,37 +1803,29 @@ public class MarinaTest {
             marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,SetDest.InnerLoopCounter,1));
 
             // commenting the following four lines causes this test to pass
-            prln("disabling instruction send");
-            marina.enableInstructionSend(false);
-            prln("enabling instruction recirculate");
-            marina.enableInstructionRecirculate(true);
 
             prln("inserting: "+decr_amount+" olc-- instructions");
-            for(int i=0; i<decr_amount; i++)
-                marina.instrIn.fill(new Instruction.Set(dock,Predicate.IgnoreFlagD,
-                                                        SetDest.OuterLoopCounter,SetSource.Decrement));
-
             prln("inserting: [!d] send data");
-            marina.instrIn.fill(new Instruction.Move(dock,
-                                                     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);
-
-            prln("calling marina.instrIn.run()");
-            marina.instrIn.run();
-            
+            Instruction[] instructions = new Instruction[decr_amount+1];
+            for(int i=0; i<decr_amount; i++)
+                instructions[i] =
+                    new Instruction.Set(dock,
+                                        Predicate.IgnoreFlagD,
+                                        SetDest.OuterLoopCounter,
+                                        SetSource.Decrement);
+            instructions[instructions.length-1] =
+                new Instruction.Move(dock,
+                                     Predicate.Default,     // predicate   
+                                     false,                 // torpedoable 
+                                     null,                  // path        
+                                     false,                 // tokenIn     
+                                     false,                 // dataIn      
+                                     false,                 // latchData   
+                                     false,                 // latchPath   
+                                     true,                  // dataOut     
+                                     false                  // tokenOut    
+                                     );
+            marina.dispatch(instructions);
             model.waitNS(64 * CYCLE_TIME_NS);
 
             int expected = decr_amount>=olc ? 0 : 1;