Support multiple designs, IsolatedInDock, ProperStoppers with write enables
authorrkao <rkao>
Wed, 10 Sep 2008 21:37:58 +0000 (21:37 +0000)
committerrkao <rkao>
Wed, 10 Sep 2008 21:37:58 +0000 (21:37 +0000)
testCode/com/sun/vlsi/chips/marina/test/Counter.java
testCode/com/sun/vlsi/chips/marina/test/Design.java [new file with mode: 0644]
testCode/com/sun/vlsi/chips/marina/test/IsolatedInDock.java [new file with mode: 0644]
testCode/com/sun/vlsi/chips/marina/test/Marina.java
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java
testCode/com/sun/vlsi/chips/marina/test/MarinaUtils.java
testCode/com/sun/vlsi/chips/marina/test/ProperStopper.java

index fe4b241..96e2f1f 100644 (file)
@@ -4,16 +4,23 @@ import com.sun.async.test.ChainControl;
 
 
 public class Counter {
-       private final String path;
+       private final String dataChain, dataPath;
        private final ChainControl cc;
-       public Counter(String path, ChainControl cc) {
-               this.path = path;
+       public Counter(String cntrInst, String dataChain, ChainControl cc) {
+       this.dataChain = dataChain;
+       this.dataPath = dataChain+'.'+cntrInst;
                this.cc = cc;
        }
+       /** Read a new value from the Counter */
        public long getCount() {
+               cc.shift(dataChain, true, false);
                return 0;
                // do nothing because I counter schematics don't yet exist
-               //return cc.getOutBits(path).bitReverse().not().toLong();
+               //long cnt = cc.getOutBits(dataPath).bitReverse().not().toLong();
+       }
+       /** Set counter value to zero */
+       public void clearCount() {
+               
        }
        
 }
diff --git a/testCode/com/sun/vlsi/chips/marina/test/Design.java b/testCode/com/sun/vlsi/chips/marina/test/Design.java
new file mode 100644 (file)
index 0000000..6216863
--- /dev/null
@@ -0,0 +1,7 @@
+package com.sun.vlsi.chips.marina.test;
+
+import com.sun.async.test.JtagTester;
+
+public interface Design {
+       public void masterClear(JtagTester tester);
+}
diff --git a/testCode/com/sun/vlsi/chips/marina/test/IsolatedInDock.java b/testCode/com/sun/vlsi/chips/marina/test/IsolatedInDock.java
new file mode 100644 (file)
index 0000000..69ec064
--- /dev/null
@@ -0,0 +1,90 @@
+package com.sun.vlsi.chips.marina.test;
+/* -*- tab-width: 4 -*- */
+import com.sun.async.test.ChainControl;
+import com.sun.async.test.ChipModel;
+import com.sun.async.test.JtagTester;
+import com.sun.async.test.NanosimModel;
+
+/** The IsolatedInDock is a design consisting of an input dock with proper 
+ * stoppers on all of its input and output ports. The IsolatedInDock allows 
+ * us to run tests on a single input dock. */
+public class IsolatedInDock implements Design {
+    private static final String DATA_CHAIN =    "marina.isolatedInDock_data";      
+    private static final String CONTROL_CHAIN = "marina.isolatedInDock_control";
+       private static final String REPORT_CHAIN =  "marina.isolatedInDock_report";
+
+       // The name of the scan chain
+       // The instance path, from the top cell of the netlist, of the instance of infinityWithCover 
+    private final ChainControl cc;           // specifies the scan chain
+    private final ChipModel model;
+    public final ProperStopper datIn, tokOut, insIn, shipOut;
+
+    public IsolatedInDock(ChainControl cc, ChipModel model, Indenter indenter) {
+        this.cc = cc;
+        this.model = model;
+        datIn = new ProperStopper("datIn",
+                                         CONTROL_CHAIN, 
+                                         DATA_CHAIN,  
+                                         REPORT_CHAIN,
+                                         cc, model, indenter);
+        tokOut = new ProperStopper("tokOut", 
+                                                  CONTROL_CHAIN,
+                                                  DATA_CHAIN,
+                                                  REPORT_CHAIN,
+                                                  cc, model, indenter);
+        insIn = new ProperStopper("insIn", 
+                                     CONTROL_CHAIN,
+                                     DATA_CHAIN,
+                                     REPORT_CHAIN,
+                                     cc, model, indenter);
+        shipOut = new ProperStopper("shipOut",
+                                           CONTROL_CHAIN,
+                                           DATA_CHAIN,
+                                           REPORT_CHAIN,
+                                           cc, model, indenter);
+    }
+    public void masterClear(JtagTester tester) {
+       final double WIDTH = 10; // ns
+       NanosimModel nModel = (NanosimModel) model;
+               // Put a high going pulse on the internal chip master clear signal
+        nModel.setNodeVoltage("scanInD[9]",1.0);
+        nModel.setNodeVoltage("scanInC[9]",1.0);
+        nModel.setNodeVoltage("scanInR[9]",1.0);
+        nModel.waitNS(WIDTH);
+        nModel.setNodeVoltage("scanInD[9]",0.0);
+        nModel.setNodeVoltage("scanInC[9]",0.0);
+        nModel.setNodeVoltage("scanInR[9]",0.0);
+        
+        resetAfterMasterClear();
+    }
+    private void resetAfterMasterClear() {
+       // For reset, I want to clear all the stoppers simultaneously
+       datIn.clear();
+       tokOut.clear();
+       insIn.clear();
+       shipOut.clear();
+       
+       datIn.stop();
+       tokOut.stop();
+       insIn.stop();
+       shipOut.stop();
+       
+       datIn.resetAfterMasterClear();
+       tokOut.resetAfterMasterClear();
+       insIn.resetAfterMasterClear();
+       shipOut.resetAfterMasterClear();
+    }
+//    /** Shift the data scan chain. */
+//    public void shiftData(boolean readEnable, boolean writeEnable) {
+//     // Get current data of all stoppers
+//     cc.shift(DATA_CHAIN, readEnable, writeEnable);
+//    }
+//    /** Shift the control scan chain */
+//    public void shiftControl(boolean readEnable, boolean writeEnable) {
+//     cc.shift(CONTROL_CHAIN, readEnable, writeEnable);
+//    }
+//    /** Shift the report scan chain */
+//    public void shiftReport(boolean readEnable, boolean writeEnable) {
+//     cc.shift(REPORT_CHAIN, readEnable, writeEnable);
+//    }
+}
index addb433..f701e4d 100644 (file)
@@ -2,64 +2,93 @@ package com.sun.vlsi.chips.marina.test;
 /* -*- tab-width: 4 -*- */
 import com.sun.async.test.ChainControl;
 import com.sun.async.test.ChipModel;
+import com.sun.async.test.JtagLogicLevel;
+import com.sun.async.test.JtagTester;
+import com.sun.async.test.NanosimModel;
 
-public class Marina {
+/** 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. */
+public class Marina implements Design {
     private static final String DATA_CHAIN =    "marina.jtag_dockTest_data";      
     private static final String CONTROL_CHAIN = "marina.jtag_dockTest_control";
        private static final String REPORT_CHAIN =  "marina.jtag_dockTest_report";
 
        // The name of the scan chain
        // The instance path, from the top cell of the netlist, of the instance of infinityWithCover 
-       private final String instPath;
     private final ChainControl cc;           // specifies the scan chain
+    private final ChipModel model;
     public final ProperStopper stopper1, stopper2;
     public final Counter counter;
 
     public Marina(ChainControl cc, ChipModel model, boolean wholeChipNetlist, Indenter indenter) {
         this.cc = cc;
-        instPath = wholeChipNetlist ? ".bigGuts.infinity@1" : "";
-        stopper1 = new ProperStopper(CONTROL_CHAIN, instPath+".ps1", 
-                                             DATA_CHAIN, instPath+".ps1",
-                                             REPORT_CHAIN, instPath+".ps1",
-                                             cc, model, indenter);
-        stopper2 = new ProperStopper(CONTROL_CHAIN, instPath+".ps2", 
-                                             DATA_CHAIN, instPath+".ps2",
-                                             REPORT_CHAIN, instPath+".ps2",
-                                             cc, model, indenter);
-        counter = new Counter(DATA_CHAIN+instPath+".cnt", cc);
+        this.model = model;
+        stopper1 = new ProperStopper("ps1",
+                                            CONTROL_CHAIN, 
+                                            DATA_CHAIN,  
+                                            REPORT_CHAIN,
+                                            cc, model, indenter);
+        stopper2 = new ProperStopper("ps2", 
+                                                    CONTROL_CHAIN,
+                                                    DATA_CHAIN,
+                                                    REPORT_CHAIN,
+                                                    cc, model, indenter);
+        counter = new Counter("??", DATA_CHAIN, cc);
     }
-    public void resetAfterMasterClear() {
-       // For reset, I want to clear all the stoppers with
-       // a single shift
+    public void masterClear(JtagTester tester) {
+       final double WIDTH = 10;
+       if (model instanceof NanosimModel) {
+               NanosimModel nModel = (NanosimModel) model;
+               System.out.println("master clear");
+               // Put a low going pulse on the chip's master clear pin. This clears
+               // the master clear register. The master clear register's output is
+               // inverted. This inverse drivers the chip's internal master clear 
+               // signal.
+            nModel.setNodeVoltage("mc",0.0);
+               nModel.waitNS(WIDTH);
+            nModel.setNodeVoltage("mc",1.0);
+       } else {
+               JtagLogicLevel jll = new JtagLogicLevel(tester, 0);
+               jll.setLogicState(false);
+               model.wait(0.100f);
+               jll.setLogicState(true);
+            
+            // Set the master clear register. This resets the chip's internal
+            // master clear.
+            cc.setInBits("Infinity.jtag_mc", "1");
+            cc.shift("Infinity.jtag_mc", false, true);
+       }
+       resetAfterMasterClear();
+    }
+    
+
+    private void resetAfterMasterClear() {
+       // For reset, I want to simultaneously clear all the stoppers 
        stopper1.clear();
        stopper2.clear();
-       shiftControl(false, true);
        
        stopper1.stop();
        stopper2.stop();
-       shiftControl(false, true);
        
        stopper1.resetAfterMasterClear();
        stopper2.resetAfterMasterClear();
     }
-    /** Shift the data scan chain. */
-    public void shiftData() {
-       // Get current data of all stoppers
-       cc.shift(DATA_CHAIN, true, false);
-    }
-    /** Shift the control scan chain */
-    public void shiftControl(boolean readEnable, boolean writeEnable) {
-       cc.shift(CONTROL_CHAIN, readEnable, writeEnable);
-    }
-    /** Shift the report scan chain */
-    public void shiftReport(boolean readEnable, boolean writeEnable) {
-       cc.shift(REPORT_CHAIN, readEnable, writeEnable);
-    }
-    public void setRotator(boolean r1) {
-        cc.setInBits(CONTROL_CHAIN+instPath+".infinity@1.infinity@1.rot", r1);
-    }
+//    /** Shift the data scan chain. */
+//    public void shiftData(boolean readEnable, boolean writeEnable) {
+//     // Get current data of all stoppers
+//     cc.shift(DATA_CHAIN, readEnable, writeEnable);
+//    }
+//    /** Shift the control scan chain */
+//    public void shiftControl(boolean readEnable, boolean writeEnable) {
+//     cc.shift(CONTROL_CHAIN, readEnable, writeEnable);
+//    }
+//    /** Shift the report scan chain */
+//    public void shiftReport(boolean readEnable, boolean writeEnable) {
+//     cc.shift(REPORT_CHAIN, readEnable, writeEnable);
+//    }
     public void initCounterScanBits(boolean val) {
-        cc.setInBits(DATA_CHAIN+instPath+".infinity@1.infinity@0.cnt", val);
-        cc.setInBits(DATA_CHAIN+instPath+".infinity@1.infinity@5.cnt", val);
+        cc.setInBits(DATA_CHAIN+".infinity@1.infinity@0.cnt", val);
+        cc.setInBits(DATA_CHAIN+".infinity@1.infinity@5.cnt", val);
     }
 }
index 7e6a714..1d580a9 100644 (file)
@@ -1,13 +1,8 @@
 package com.sun.vlsi.chips.marina.test;
 /* -*- tab-width: 4 -*- */
 import java.io.File;
-import java.io.PrintStream;
 import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
-import java.util.Random;
 
 import com.sun.async.test.BitVector;
 import com.sun.async.test.ChainControl;
@@ -15,7 +10,6 @@ import com.sun.async.test.ChainTest;
 import com.sun.async.test.ChipModel;
 import com.sun.async.test.HP34401A;
 import com.sun.async.test.Infrastructure;
-import com.sun.async.test.JtagLogicLevel;
 import com.sun.async.test.JtagTester;
 import com.sun.async.test.ManualPowerChannel;
 import com.sun.async.test.NanosimModel;
@@ -25,40 +19,31 @@ import com.sun.async.test.Pst3202Channel;
 import com.sun.async.test.SiliconChip;
 import com.sun.async.test.SimulationModel;
 import com.sun.async.test.VoltageReadable;
+import com.sun.vlsi.chips.marina.test.MarinaUtils.CmdArgs;
+import com.sun.vlsi.chips.marina.test.MarinaUtils.Station;
+import com.sun.vlsi.chips.marina.test.MarinaUtils.CmdArgs.Mode;
 
 /**
  * Tests for Marina
- * User: Russell Kao
  */
 public class MarinaTest {
        //--------------------------  constants -----------------------------------
        // COLUMN_LATENCY is a delay that is larger than the latency through an Infinity column
        private static final int COLUMN_LATENCY = 10; // nanoseconds
-       private final MarinaUtils.Station station;
-       
-       private enum Select {all, even, odd};
-       
+
        //--------------------------------  types ---------------------------------
-    private static class RingResult {
-       public final List<Double> thruput, current, vddErr;
-       public RingResult(List<Double> t,  List<Double> c,  List<Double> v) {
-               thruput=t; current=c; vddErr=v;
-       }
-       public int size() {return Math.max(thruput.size(), current.size());}
-    }
 
        //--------------------------  private data --------------------------------
        private static long startTime;
 
        private Indenter indenter = new Indenter();
-       private final Marina mar;
-       private final ChipModel model;
-       private final ChainControl cc;
-       private final JtagTester tester;
-       private final boolean wholeChipNetlist;
+       private Design design;
+       private ChipModel model;
+       private ChainControl cc;
+       private JtagTester tester;
+       private CmdArgs cmdArgs;
        private PowerChannel corePowerSupply, padsPowerSupply;
     private VoltageReadable coreVoltmeter, voltmeterForCurrent;
-    private final String dataOutDir;
        
        //--------------------------  private methods -----------------------------
     /** @return true if simulation. Return false if we're testing silicon. */
@@ -81,17 +66,20 @@ public class MarinaTest {
        }
     
        // Tell user what we're about to do
-       private static void reportTask(MarinaUtils.CmdArgs args) {
+       private static void reportTask(CmdArgs args) {
                System.out.println("Begin testing Marina");
         switch (args.mode) {
-        case SIM_EXPERIMENT_SCHEMATIC:
-               System.out.println("  Simulation of Marina from schematics");
+        case ISOLATED_IN_DOCK:
+               System.out.println("  Simulate isolated input dock");
+               break;
+        case ISOLATED_OUT_DOCK:
+               System.out.println("  Simulate isolated output dock");
                break;
-        case SIM_EXPERIMENT_LAYOUT:
-               System.out.println("  Simulation of Marina from layout");
+        case WHOLE_CHIP_SCHEMATIC_PARASITICS:
+               System.out.println("  Simulate whole chip, schematic parasitics");
                break;
-        case SIM_CHIP_SCHEMATIC:
-               System.out.println("  Simulation of full chip from schematics");
+        case WHOLE_CHIP_LAYOUT_PARASITICS:
+               System.out.println("  Simulate whole chip, layout parasitics");
                break;
         case TEST_SILICON:
                System.out.println("  Test silicon");
@@ -101,13 +89,38 @@ public class MarinaTest {
                return;
         }
        }
+       private void setUpSuppliesAndMeters(Station station) {
+               // set up power supplies and meters
+               if (!sim()) {
+                       prln("Testing station: "+station);
+                 Infrastructure.gpibControllers = new int[] {0};
+                 switch (cmdArgs.station) {
+                 case ONE:
+                               corePowerSupply = new Pst3202Channel("ch1", "HPST3202", 1);
+                           padsPowerSupply = new Pst3202Channel("ch2", "HPST3202", 2);
+                           break;
+                 case TWO:
+                               corePowerSupply = new Pst3202Channel("ch1", "HPST3202B", 1);
+                           padsPowerSupply = new Pst3202Channel("ch2", "HPST3202B", 2);
+                       break;
+                 default:
+                       fatal(true, "Unrecognized station: "+cmdArgs.station);
+                 }
+                 corePowerSupply.setCurrent((float)1.7);
+                 corePowerSupply.setVoltageWait((float)1.0);
+                 
+                 padsPowerSupply.setCurrent((float)0.100);
+                 padsPowerSupply.setVoltageWait((float)1.8);
+                 
+                 coreVoltmeter = new HP34401A(station.coreVoltmeter);
+                 voltmeterForCurrent = new HP34401A(station.currentVoltmenter);
+               }
+       }
        
-       private static void standAlone(String[] args) {
-        MarinaUtils.CmdArgs cmdArgs = new MarinaUtils.CmdArgs(args);
+       private MarinaTest(String[] args) {
+        cmdArgs = new MarinaUtils.CmdArgs(args);
         reportTask(cmdArgs);
-        ChipModel model;
-        JtagTester tester;
-        boolean sim = cmdArgs.mode != MarinaUtils.CmdArgs.Mode.TEST_SILICON;
+        boolean sim = cmdArgs.mode != Mode.TEST_SILICON;
         if (sim) {
                model = new NanosimModel();
                tester = ((SimulationModel)model).createJtagTester("TCK", "TMS", "TRSTb", "TDI", "TDO");
@@ -117,91 +130,61 @@ public class MarinaTest {
                tester = new Netscan4(ip, cmdArgs.station.jtagChannel);
         }
         tester.printInfo = false;
-        String xmlFileName = cmdArgs.wholeChipNetlist() ? 
-                           "../testCode/marinaWholeChip.xml"
-                       :
-                               "../testCode/marina.xml";
-        
         int khz = sim ? 1000000 : 1000;
-        ChainControl cc = new ChainControl(xmlFileName, tester, 1.8f, khz);
-        
-        
-        PowerChannel pc = new ManualPowerChannel("pc", false);
-        ChainTest ct = new ChainTest(cc, pc);
-        
-        String dataOutDir = cmdArgs.chipNum==-1 ? "" : ("chip"+cmdArgs.chipNum+"/infinity/");
-        
-        MarinaTest it = new MarinaTest(model, cc, tester, cmdArgs.wholeChipNetlist(),
-                                                  cmdArgs.station, dataOutDir); 
+
         String netListName;
         switch (cmdArgs.mode) {
-        case SIM_EXPERIMENT_SCHEMATIC:
-               netListName = "marina.spi";           break;
-        case SIM_EXPERIMENT_LAYOUT:
-               netListName = "marinaFromLay.spi";        break;
-        case SIM_CHIP_SCHEMATIC:
+        case ISOLATED_IN_DOCK:
+               netListName = "isolatedInDock.spi";
+            cc = new ChainControl("../testCode/isolatedInDock.xml", tester, 1.8f, khz);
+            design = new IsolatedInDock(cc, model, indenter);
+               break;
+        case ISOLATED_OUT_DOCK:
+               netListName = "isolatedOutDock.spi";
+            cc = new ChainControl("../testCode/isolatedOutDock.xml", tester, 1.8f, khz);
+            design = null;
+               break;
+        case WHOLE_CHIP_SCHEMATIC_PARASITICS:
+               netListName = "marina_pads_guts.spi"; 
+            cc = new ChainControl("???", tester, 1.8f, khz);
+            design = null;
+               break;
+        case WHOLE_CHIP_LAYOUT_PARASITICS:
+               netListName = "marina_pads_guts.spi"; 
+            cc = new ChainControl("???", tester, 1.8f, khz);
+            design = null;
+               break;
         case TEST_SILICON:
-               netListName = "marina_pads_guts.spi"; break;
+               netListName = "marina_pads_guts.spi"; 
+            cc = new ChainControl("???", tester, 1.8f, khz);
+            design = null;
+               break;
         default:
                fatal(true, "unrecognized CmdArgs.Mode");
                return;
         }
+        cc.noTestSeverity = Infrastructure.SEVERITY_NOMESSAGE;
+        
+        PowerChannel pc = new ManualPowerChannel("pc", false);
+        ChainTest ct = new ChainTest(cc, pc);
+        
+        setUpSuppliesAndMeters(cmdArgs.station);
         
         if (sim) ((SimulationModel)model).start("nanosim -c cfg", netListName, 0, true);
         ct.testAllChains("marina", Infrastructure.SEVERITY_WARNING);
 
-        it.doOneTest(cmdArgs.testNum);
+        doOneTest(cmdArgs.testNum);
         
         if (sim) ((SimulationModel)model).finish();
-       }
+}
+
        /** In the absence of looping, the longest path through Infinity is 4 column delays */
        private void waitUntilQuiescent() {
                model.waitNS(4*COLUMN_LATENCY);
        }
-    private void masterClear() {
-       final double WIDTH = 10;
-       if (model instanceof NanosimModel) {
-               NanosimModel nModel = (NanosimModel) model;
-               System.out.println("master clear");
-               if (wholeChipNetlist) {
-                       // Put a low going pulse on the chip's master clear pin. This clears
-                       // the master clear register. The master clear register's output is
-                       // inverted. This inverse drivers the chip's internal master clear 
-                       // signal.
-                nModel.setNodeVoltage("mc",0.0);
-                       nModel.waitNS(WIDTH);
-                nModel.setNodeVoltage("mc",1.0);
-               } else {
-                       // Put a high going pulse on the internal chip master clear signal
-                nModel.setNodeVoltage("scanInD[9]",1.0);
-                nModel.setNodeVoltage("scanInC[9]",1.0);
-                nModel.setNodeVoltage("scanInR[9]",1.0);
-                nModel.waitNS(WIDTH);
-                nModel.setNodeVoltage("scanInD[9]",0.0);
-                nModel.setNodeVoltage("scanInC[9]",0.0);
-                nModel.setNodeVoltage("scanInR[9]",0.0);
-               }
-       } else {
-               JtagLogicLevel jll = new JtagLogicLevel(tester, 0);
-               jll.setLogicState(false);
-               model.wait(0.100f);
-               jll.setLogicState(true);
-            
-            // Set the master clear register. This resets the chip's internal
-            // master clear.
-            cc.setInBits("Infinity.jtag_mc", "1");
-            cc.shift("Infinity.jtag_mc", false, true);
-       }
-    }
     
     private double readCurrent() {
-       return voltmeterForCurrent.readVoltage() / station.ammeterShuntResistance;
-    }
-    
-    /** You must master clear before calling resetForTest */
-    private void resetAfterMasterClear() {
-       prln("reset after master clear");
-       mar.resetAfterMasterClear();
+       return voltmeterForCurrent.readVoltage() / cmdArgs.station.ammeterShuntResistance;
     }
     
     /** Generate List of BitVectors where Token=true, high 25 data bits  
@@ -223,15 +206,14 @@ public class MarinaTest {
        return ans;
     }
     private void stopToStop(ProperStopper s1, ProperStopper s2, 
+                               Counter ctr,
                                List<BitVector> din) {
        prln("Begin stopToStop");
        adjustIndent(2);
        
        s1.stop();
-       mar.shiftControl(false, true);
        
-//     mar.shiftData();
-//     long ctrAStart = mar.counter.getCount();
+       long ctrStart = ctr==null ? 0 : ctr.getCount();
        
        s1.fillMany(din);
        waitUntilQuiescent();
@@ -240,16 +222,14 @@ public class MarinaTest {
         
         MarinaUtils.compareItemsOrdered(din, dout);
         
-//     mar.shiftData();
-//        long ctrAEnd = mar.counter.getCount();
-//        long deltaA = ctrAEnd - ctrAStart;
-//        
-//        long sz = din.size();
-//        long expectA = ctrAChg ? sz : 0;
-//        fatal(deltaA!=expectA, 
-//               "counter A delta wrong: expected delta: "+expectA+
-//               " counter before:"+ctrAStart+" counter after:"+ctrAEnd);
-        
+        if (ctr!=null) {
+               long ctrEnd = ctr.getCount();
+               long delta = ctrEnd - ctrStart;
+            long expect = din.size();
+            fatal(delta!=expect, 
+                 "counter delta wrong: expected delta: "+expect+
+                 " counter before:"+ctrStart+" counter after:"+ctrEnd);
+        }
         
         adjustIndent(-2);
        prln("End stopToStop");
@@ -258,78 +238,65 @@ public class MarinaTest {
      * is then run to allow the burst to flow. */
     private void stopToStopBurst(ProperStopper src, ProperStopper gate, 
                                     ProperStopper dst,
+                                    Counter ctr,
                                     List<BitVector> din) {
                prln("Begin stopToStopBurst test");
                adjustIndent(2);
                
                src.stop();
                gate.stop();
-               mar.shiftControl(false, true);
                
-//     mar.shiftData();
-//     long ctrAStart = mar.counter.getCount();
+       long ctrStart = ctr==null ? 0 : ctr.getCount();
                
                src.fillMany(din);
                waitUntilQuiescent();
 
                // open the gate to start the burst
                gate.run();
-               mar.shiftControl(false, true);
                waitUntilQuiescent();
                
                List<BitVector> dout = dst.drainMany();
                
                MarinaUtils.compareItemsOrdered(din, dout);
                
-//     mar.shiftData();
-//        long ctrAEnd = mar.counter.getCount();
-//        long deltaA = ctrAEnd - ctrAStart;
-//        
-//        long sz = din.size();
-//        long expectA = ctrAChg ? sz : 0;
-//        fatal(deltaA!=expectA, 
-//               "counter A delta wrong: expected delta: "+expectA+
-//               " counter before:"+ctrAStart+" counter after:"+ctrAEnd);
-        
+               if (ctr!=null) {
+               long ctrEnd = ctr.getCount();
+               long delta = ctrEnd - ctrStart;
+               
+               long expectA = din.size();
+               fatal(delta!=expectA, 
+                         "counter delta wrong: expected delta: "+expectA+
+                         " counter before:"+ctrStart+" counter after:"+ctrEnd);
+               }
                
                adjustIndent(-2);
                prln("End stopToStopBurst test");
 }
 
-    private void stopToStopOne(ProperStopper s1, ProperStopper s2, int adr) {
+    private void stopToStopOne(ProperStopper s1, ProperStopper s2, 
+                                  Counter ctr, int adr) {
        prln("Begin stopToStopOne");
        adjustIndent(2);
        
        List<BitVector> din = makeIncrDataConstAdr(1, adr);
-       stopToStop(s1, s2, din);
+       stopToStop(s1, s2, ctr, din);
 
        adjustIndent(-2);
        prln("End stopToStopOne");
     }
     
-    private void stopToStopThree(ProperStopper s1, ProperStopper s2, int adr) {
+    private void stopToStopThree(ProperStopper s1, ProperStopper s2, 
+                                    Counter ctr, int adr) {
        prln("Begin stopToStopOne");
        adjustIndent(2);
        
        List<BitVector> din = makeIncrDataConstAdr(3, adr);
-       stopToStop(s1, s2, din);
+       stopToStop(s1, s2, ctr, din);
 
        adjustIndent(-2);
        prln("End stopToStopOne");
     }
 
-    private BitVector extractAddr(BitVector dataTokAddr) {
-       fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
-       return dataTokAddr.get((37+1), 14);
-    }
-    private BitVector extractToken(BitVector dataTokAddr) {
-       fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
-       return dataTokAddr.get(37, 1);
-    }
-    private BitVector extractData(BitVector dataTokAddr) {
-       fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
-       return dataTokAddr.get(0, 37);
-    }
     private int indexOf(BitVector o, List<BitVector> dIn) {
                for (int i=0; i<dIn.size(); i++) {
                        if (o.equals(dIn.get(i)))  return i;
@@ -351,34 +318,21 @@ public class MarinaTest {
        return ans;
     }
 
-    // If dataOutDir is not an empty string, then create an output
-    // directory for storing test results.
-    private void createDataOutputDir(String dataOutDir) {
-       if (!dataOutDir.equals("")) {
-               File dir = new File(dataOutDir);
-               if (!dir.exists()) {
-                       fatal(!dir.mkdirs(),
-                             "couldn't make data output directory: "+dataOutDir);
-               }
-       }
-    }
-
     //=========================================================================
     // Put top level tests here
-    private void stopToStopOneItem() {
-       stopToStopOne(mar.stopper1, mar.stopper2, -1);
+    private void stopToStopOneItem(IsolatedInDock inDock) {
+       stopToStopOne(inDock.datIn, inDock.tokOut, null, -1);
     }
-    private void stopToStopThreeItems() {
-       stopToStopThree(mar.stopper1, mar.stopper2, -1);
+    private void stopToStopThreeItems(IsolatedInDock inDock) {
+       stopToStopThree(inDock.datIn, inDock.tokOut, null, -1);
     }
        private void doOneTest(int testNum) {
         prln("MarinaTest: performing test: "+testNum);
-        masterClear();
-        resetAfterMasterClear();
+        design.masterClear(tester);
         
                switch (testNum) {
-               case 0:                 stopToStopOneItem();               break;
-               case 1:                 stopToStopThreeItems();                    break;
+               case 0:                 stopToStopOneItem((IsolatedInDock)design);       break;
+               case 1:                 stopToStopThreeItems((IsolatedInDock)design);    break;
                default:
                        fatal(true, "Test number: "+testNum+" doesn't exist.");
                        break;
@@ -388,51 +342,10 @@ public class MarinaTest {
 
     //============================ for public use =============================
 
-       public MarinaTest(ChipModel model, ChainControl cc, JtagTester tester, 
-                                   boolean wholeChipNetlist,
-                        MarinaUtils.Station station,
-                        String dataOutDir) {
-               this.model = model;
-               this.cc = cc;
-               this.tester = tester;
-               this.wholeChipNetlist = wholeChipNetlist;
-               this.mar = new Marina(cc, model, wholeChipNetlist, indenter);
-               this.station = station;
-               this.dataOutDir = dataOutDir;
-               createDataOutputDir(dataOutDir);
-               
-               cc.noTestSeverity = Infrastructure.SEVERITY_NOMESSAGE;
-               
-               // set up power supplies and meters
-               if (!sim()) {
-                       prln("Testing station: "+station);
-               Infrastructure.gpibControllers = new int[] {0};
-               switch (station) {
-               case ONE:
-                               corePowerSupply = new Pst3202Channel("ch1", "HPST3202", 1);
-                           padsPowerSupply = new Pst3202Channel("ch2", "HPST3202", 2);
-                           break;
-               case TWO:
-                               corePowerSupply = new Pst3202Channel("ch1", "HPST3202B", 1);
-                           padsPowerSupply = new Pst3202Channel("ch2", "HPST3202B", 2);
-                       break;
-               default:
-                       fatal(true, "Unrecognized station: "+station);
-               }
-                   corePowerSupply.setCurrent((float)1.7);
-                   corePowerSupply.setVoltageWait((float)1.0);
-                   
-                   padsPowerSupply.setCurrent((float)0.100);
-                   padsPowerSupply.setVoltageWait((float)1.8);
-                   
-                   coreVoltmeter = new HP34401A(station.coreVoltmeter);
-                   voltmeterForCurrent = new HP34401A(station.currentVoltmenter);
-               }
-       }
        
     public static void main(String[] args) {
        startTime = System.currentTimeMillis();
-               standAlone(args);
+               new MarinaTest(args);
                printTestTime();
     }
 
index 747a971..41c0200 100644 (file)
@@ -8,7 +8,7 @@ import java.util.ArrayList;
 
 public class MarinaUtils {
        /** Caution: Ivan changes the order of the ProperStopper control bits 
-        * changes from chip to chip.  Here is the current order for Marina
+        * from chip to chip.  Here is the current order for Marina
         * as of 14 Aug 2008: 
         *  Block, Fill, Go, Silent, Clear
         *  The old bit order for Infinity was: Fill, Block, Clear, Silent, Go */
@@ -32,30 +32,28 @@ public class MarinaUtils {
     public static enum StateWireState {FULL, EMPTY};
 
     public static class CmdArgs {
-               public enum Mode {SIM_EXPERIMENT_SCHEMATIC,
-                                                 SIM_EXPERIMENT_LAYOUT,
-                                                 SIM_CHIP_SCHEMATIC,
-                          SIM_CHIP_LAYOUT,
+               public enum Mode {ISOLATED_IN_DOCK,
+                                                 ISOLATED_OUT_DOCK,
+                          WHOLE_CHIP_SCHEMATIC_PARASITICS,
+                          WHOLE_CHIP_LAYOUT_PARASITICS,
                           TEST_SILICON};
-               public Mode mode = Mode.SIM_EXPERIMENT_SCHEMATIC;
+               public Mode mode = Mode.ISOLATED_IN_DOCK;
                public int testNum, ringNum, numTokensOther, chipNum=-1;
                public Station station=Station.ONE;
         public float vdd, temp;
         public boolean init;
 
-        public boolean wholeChipNetlist() {return mode==Mode.SIM_CHIP_SCHEMATIC ||
-                                                  mode==Mode.SIM_CHIP_LAYOUT ||
+        public boolean wholeChipNetlist() {return mode==Mode.WHOLE_CHIP_SCHEMATIC_PARASITICS ||
+                                                     mode==Mode.WHOLE_CHIP_LAYOUT_PARASITICS ||
                                                   mode==Mode.TEST_SILICON;}
                private static void usage() {
                        System.out.println("Options: -testNum <int>            select which test to run");
             System.out.println("         -vdd <float>");
             System.out.println("         -temp <float>");
-            System.out.println("         -ringNum <int>            1 for Left Ring and 2 for Right Ring (only for crosser experiment)");
-            System.out.println("         -numTokensOther <int>     from 0:13, occupancy of ring NOT under throughput analysis");
-            System.out.println("         -exptSch                  simulate netlist of experiment only, parasitics from schematic");
-            System.out.println("         -exptSch                  simulate netlist of experiment only, parasitics from schematic");
-                       System.out.println("         -exptLay                  simulate netlist of experiment only, parasitics from layout");
+            System.out.println("         -isoIn                    simulate netlist of isolated input dock only, parasitics from schematic");
+            System.out.println("         -isoOut                   simulate netlist of isolated output dock only, parasitics from schematic");
                        System.out.println("         -chipSch                  simulate netlist of entire chip, parasitics from schematic");
+                       System.out.println("         -chipLay                  simulate netlist of entire chip, parasitics from layout");
                        System.out.println("         -silicon                  test the silicon");
                        System.out.println("         -chipNum <int>            store test results according to chip number");
                        System.out.println("         -station <int>            select test station");
@@ -81,14 +79,6 @@ public class MarinaUtils {
                                        i++;
                                        if (i>=nbArgs) usage();
                                        temp = Float.parseFloat(args[i]);
-                               } else if (args[i].equals("-ringNum")) {
-                                       i++;
-                                       if (i>=nbArgs) usage();
-                                       ringNum = Integer.parseInt(args[i]);
-                               } else if (args[i].equals("-numTokensOther")) {
-                                       i++;
-                                       if (i>=nbArgs) usage();
-                                       numTokensOther = Integer.parseInt(args[i]);
                                } else if (args[i].equals("-chipNum")) {
                                        i++;
                                        if (i>=nbArgs) usage();
@@ -102,13 +92,11 @@ public class MarinaUtils {
                                        default: System.out.println("Bad station: "+args[i]); usage();
                                        }
                                } else if (args[i].equals("-exptSch")) {
-                                       mode = CmdArgs.Mode.SIM_EXPERIMENT_SCHEMATIC;
+                                       mode = CmdArgs.Mode.ISOLATED_IN_DOCK;
                                } else if (args[i].equals("-exptLay")) {
-                                       mode = CmdArgs.Mode.SIM_EXPERIMENT_LAYOUT;
-                               } else if (args[i].equals("-chipSch")) {
-                                       mode = CmdArgs.Mode.SIM_CHIP_SCHEMATIC;
+                                       mode = CmdArgs.Mode.ISOLATED_OUT_DOCK;
                                } else if (args[i].equals("-chipLay")) {
-                                       mode = CmdArgs.Mode.SIM_CHIP_LAYOUT;
+                                       mode = CmdArgs.Mode.WHOLE_CHIP_SCHEMATIC_PARASITICS;
                                } else if (args[i].equals("-silicon")) {
                                        mode = CmdArgs.Mode.TEST_SILICON;
                                } else {
@@ -445,4 +433,17 @@ public class MarinaUtils {
               dta.get(37,1).getState() + " " +
               dta.get(38,14).getState();
     }
+    public static BitVector extractAddr(BitVector dataTokAddr) {
+       fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
+       return dataTokAddr.get((37+1), 14);
+    }
+    public static BitVector extractToken(BitVector dataTokAddr) {
+       fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
+       return dataTokAddr.get(37, 1);
+    }
+    public static BitVector extractData(BitVector dataTokAddr) {
+       fatal(dataTokAddr.getNumBits()!=37+1+14, "wrong length for data token addr");
+       return dataTokAddr.get(0, 37);
+    }
+
 }
\ No newline at end of file
index 1bbce01..d4482c6 100644 (file)
@@ -6,15 +6,20 @@ import com.sun.async.test.BitVector;
 import com.sun.async.test.ChainControl;
 import com.sun.async.test.ChipModel;
 import com.sun.async.test.Infrastructure;
+import com.sun.async.test.NanosimModel;
 import com.sun.vlsi.chips.marina.test.MarinaUtils.StateWireState;
 
 public class ProperStopper {
-       private boolean traceFill = true;
+    private final String captureClockRelPath = "aFillSta@0.all1in52@1.data1in3@0";
+    private final String captureClockName = "wrr";
+
+    private boolean traceFill = true;
        private boolean traceDrain = true;
        
     private final String controlChain, controlPath, 
                          dataChain, dataPath, 
                          reportChain, reportPath;
+    private final String captureClock;
     private final ChainControl cc;
     private final ChipModel model;
        private final Indenter indenter;
@@ -24,6 +29,20 @@ public class ProperStopper {
        }
        private void prln(String msg) {indenter.prln(msg);}
        private void adjustIndent(int n) {indenter.adjustIndent(n);}
+       
+       /** NanosimModel.setNodeState() requires special path names.  
+        * Each instance name in the path must begin with the character 'x'.
+        * Return a path with the added X's. */
+       private String prefixInstNamesInPathWithX(String path) {
+               StringBuffer sb = new StringBuffer();
+               sb.append('x');
+               for (int i=0; i<path.length(); i++) {
+                       char c = path.charAt(i);
+                       sb.append(c);
+                       if (c=='.')  sb.append('x');
+               }
+               return sb.toString();
+       }
 
     private BitVector getDatTokAdr() {
        // strip the two write enable bits
@@ -35,6 +54,14 @@ public class ProperStopper {
     }
     private void shiftData(boolean readEnable, boolean writeEnable) {
        cc.shift(dataChain, readEnable, writeEnable);
+       if (writeEnable) {
+               if (model instanceof NanosimModel) {
+                       NanosimModel nanoModel = (NanosimModel) model;
+                       nanoModel.setNodeState(captureClock, 1);
+                       nanoModel.waitNS(1);
+                       nanoModel.setNodeState(captureClock, 0);
+               }
+       }
     }
     private void shiftReport(boolean readEnable, boolean writeEnable) {
        cc.shift(reportChain, readEnable, writeEnable);
@@ -49,58 +76,61 @@ public class ProperStopper {
     /** Put stopper in RUN state */
     public void run() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.RUN.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in IDLE state */
     public void idle() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.IDLE.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in FILL state */
     public void fill() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.FILL.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in BLOCK state */
     public void block() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.BLOCK.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in STOP state */
     public void stop() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.STOP.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in CLEAR state */
     public void clear() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.CLEAR.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in SOURCE state */
     public void source() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.SOURCE.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in STOPSOURCE state */
     public void stopSource() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.STOPSOURCE.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in SINK state */
     public void sink() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.SINK.bits());
+       shiftControl(false, true);
     }
     /** Put stopper in STOPSINK state */
     public void stopSink() {
        cc.setInBits(controlPath, MarinaUtils.RingIfc.STOPSINK.bits());
+       shiftControl(false, true);
     }
     /** Stop a running stopper in order to add items.  Ensure that we don't
      * lose the item in the fill stage.  Wait long enough for ring to quiesce.
      * Exit state: idle */
     public void stopToFill() {
        stop();                                 // go = 0
-       shiftControl(false, true);
-
        idle();                                 // block = 1
-       shiftControl(false, true);
-
        block();                                // go = 1
-       shiftControl(false, true);
-
        idle();                                 // go = 0
-       shiftControl(false, true);
     }
     /** get value of the state wire preceeding the fill stage */
     public StateWireState getPrevStateWire() {
@@ -134,17 +164,20 @@ public class ProperStopper {
        return sb.toString();
     }
     /** construct a ProperStopper */
-    public ProperStopper(String controlChain, String controlInst, 
-                                        String dataChain, String dataInst, 
-                            String reportChain, String reportInst, 
+    public ProperStopper(String propInst,
+                                        String controlChain, String dataChain, 
+                            String reportChain,
                             ChainControl cc, ChipModel model,
                             Indenter indenter) {
        this.controlChain = controlChain;
-       this.controlPath = controlChain+controlInst;
+       this.controlPath = controlChain+'.'+propInst;
        this.dataChain = dataChain;
-       this.dataPath = dataChain+dataInst;
+       this.dataPath = dataChain+'.'+propInst;
        this.reportChain = reportChain;
-       this.reportPath = reportChain+reportInst;
+       this.reportPath = reportChain+'.'+propInst;
+       this.captureClock = 
+               prefixInstNamesInPathWithX(propInst+'.'+captureClockRelPath)
+               +'.'+captureClockName;
        this.cc = cc;
        this.model = model;
        this.indenter = indenter;
@@ -184,7 +217,6 @@ public class ProperStopper {
        if (traceFill) prln("writing data: "+MarinaUtils.formatDataTokAddr(dta));
        
        idle();                                 // block = 1, go = 0
-       shiftControl(false, true);
 
        BitVector wrEn = new BitVector(2, "write enable");
        wrEn.setFromLong(3);
@@ -192,13 +224,9 @@ public class ProperStopper {
        shiftData(false, true);
        
        fill();                                 // fill = 1
-       shiftControl(false, true);
        idle();                                 // fill = 0
-       shiftControl(false, true);
        block();                                // go = 1
-       shiftControl(false, true);
        idle();
-       shiftControl(false, true);
        
        model.waitNS(5);
 
@@ -232,7 +260,6 @@ public class ProperStopper {
      * exit state: stop */
     public BitVector drain() {
        stop();                                 // all zero, block = 0, go = 0
-       shiftControl(false, true);
        
        // make sure an item is available
        shiftReport(true, false);
@@ -243,13 +270,9 @@ public class ProperStopper {
        BitVector ans = getDatTokAdr();
 
        idle();                                 // block = 1
-       shiftControl(false, true);
        clear();                                // clear = 1
-       shiftControl(false, true);
        idle();                                 // clear = 0
-       shiftControl(false, true);
        stop();                                 // block = 0
-       shiftControl(false, true);
 
        if (traceDrain) prln("drainStopper data: "+MarinaUtils.formatDataTokAddr(ans));
        return ans;