Marina/MarinaTest.java: a few hacks to get the silicon working
authorAdam Megacz <adam@megacz.com>
Sat, 29 Aug 2009 23:05:53 +0000 (16:05 -0700)
committerAdam Megacz <adam@megacz.com>
Sat, 29 Aug 2009 23:05:53 +0000 (16:05 -0700)
src/com/sun/vlsi/chips/marina/test/Marina.java
src/com/sun/vlsi/chips/marina/test/MarinaTest.java

index 87a3c95..759662d 100644 (file)
@@ -6,6 +6,7 @@ import com.sun.async.test.ChipModel;
 import com.sun.async.test.JtagTester;
 import com.sun.async.test.NanosimModel;
 import com.sun.async.test.VerilogModel;
+import com.sun.async.test.*;
 
 import edu.berkeley.fleet.api.Instruction;
 import edu.berkeley.fleet.marina.MarinaPath;
@@ -268,10 +269,19 @@ public class Marina {
             nModel.setNodeVoltage(MASTER_CLEAR,0.0);
             nModel.waitNS(1);
         } else {
-            prln("FIXME!");
+            mc0.setLogicState(true);
+            mc1.setLogicState(true);
+            model.waitNS(1000);
+            mc0.setLogicState(false);
+            mc1.setLogicState(false);
+            model.waitNS(1000);
         }
         resetAfterMasterClear();
     }
+
+    JtagLogicLevel mc0;
+    JtagLogicLevel mc1;
+
     private void resetAfterMasterClear() {
         // The following call to ChainControl.resetInBits() is vital!
         // If you forget, then the inBits member initializes 
index 01fa1cb..1094c97 100644 (file)
@@ -242,20 +242,25 @@ public class MarinaTest {
             model instanceof SimulationModel
             ? ((SimulationModel)model).createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDO")
             : new Netscan4("jtag3", 2);
+        JtagLogicLevel mc0=null;
+        JtagLogicLevel mc1=null;
         if (tester instanceof Netscan4) {
             ((Netscan4)tester).reset();
             // master clear
             // not sure if "GPIO1" means "index 0" or not
-            JtagLogicLevel mc0 = new JtagLogicLevel(tester, 0);
-            JtagLogicLevel mc1 = new JtagLogicLevel(tester, 1);
+            mc0 = new JtagLogicLevel(tester, 0);
+            mc1 = new JtagLogicLevel(tester, 1);
             mc0.setLogicState(true);
             mc1.setLogicState(true);
         }
+        /*
         Logger.setLogInits(true);
         tester.setLogSets(true);
         tester.setLogOthers(true);
         tester.setAllLogging(true);
         tester.printInfo = true;
+        */
+        tester.printInfo = false;
 
         ChainControls ccs = new ChainControls();
         PowerChannel pc = new ManualPowerChannel("pc", false);
@@ -290,6 +295,8 @@ public class MarinaTest {
         ccs.addChain(Marina.CONTROL_CHAIN, cc);
 
         marina = new Marina(ccs, model, !cmdArgs.jtagShift, indenter);
+        marina.mc0=mc0;
+        marina.mc1=mc1;
 
         if (model instanceof NanosimModel) {
             NanosimLogicSettable mc = (NanosimLogicSettable)
@@ -313,7 +320,7 @@ public class MarinaTest {
         if (model instanceof SimulationModel)
             ((SimulationModel)model).setNodeState(Marina.MASTER_CLEAR, 0);
         else
-            prln("FIXME: need to deassert master clear");
+            marina.masterClear();
         model.waitNS(1000);
 
         if (cmdArgs.testNum!=0 && cmdArgs.testNum!=1) {
@@ -983,6 +990,19 @@ public class MarinaTest {
                              false                  /* tokenOut    */
                              );
 
+    private static final Instruction SEND_TOKEN_IF_D_SET =
+        new Instruction.Move(dock,
+                             Predicate.FlagD,       /* predicate   */
+                             false,                 /* torpedoable */
+                             null_path,             /* path        */
+                             false,                 /* tokenIn     */
+                             false,                 /* dataIn      */
+                             false,                 /* latchData   */
+                             false,                 /* latchPath   */
+                             false,                 /* dataOut     */
+                             true                   /* tokenOut    */
+                             );
+
     private static final Instruction TORPEDOABLE_RECV_DATA =
         new Instruction.Move(dock,
                              Predicate.IgnoreFlagD, /* predicate   */
@@ -1994,16 +2014,22 @@ public class MarinaTest {
 
     private void testDFlagWhenTorpedoLyingInWait(Marina marina) {
         marina.fillSouthProperStopper(new Instruction[] {
+                setOlc(1),
                 RECV_DATA,
                 TORPEDOABLE_RECV_DATA,
-                marina.kesselsCounter ? null : FLAG_NOP,
-                SEND_DATA_IF_D_SET,
+                FLAG_NOP,
+                FLAG_NOP,
+                FLAG_NOP,
+                SEND_TOKEN_IF_D_SET,
             });
-        marina.instrIn.fillTorpedo();
-        model.waitNS(64 * CYCLE_TIME_NS);
+
+        expectTokensExactly(0);
+
+        // changing the order of these lines should work, but it does not
         marina.fillNorthProperStopper();
-        model.waitNS(64 * CYCLE_TIME_NS);
-        expectNorthFifoExactly(1);
+        marina.instrIn.fillTorpedo();
+
+        expectTokensExactly(1);
     }
 
     private void testSetOlcFollowedByDPredicated(Marina marina) {