cleanup of Marina test code
[fleet.git] / src / edu / berkeley / fleet / marina / ProperStopper.java
index b97d491..3f47881 100644 (file)
@@ -19,7 +19,6 @@ public class ProperStopper {
     private static final int FILL_STATE_IN_NDX = 2;
     private static final int STOPPED_IN_NDX = 3;
         
-    private final String name;
     //private final String captureClockRelPath = "fillStag@1.gaspFill@0.fillScan@1";
     private final String captureClockRelPath = "fillStag@1";
     // test library direct write mode doesn't understand per register write 
@@ -35,9 +34,9 @@ public class ProperStopper {
     private boolean traceDrain = false;
         
     private final String controlPath, dataPath, reportPath;
-    private final ChainControl controlChain;
-    private final ChainControl dataChain;
-    private final ChainControl reportChain;
+    protected final ChainControl controlChain;
+    protected final ChainControl dataChain;
+    protected final ChainControl reportChain;
     private final String captureClock;
     private final ChipModel model;
     private final Indenter indenter;
@@ -146,7 +145,7 @@ public class ProperStopper {
         setFillDrainControl(CommandCodes.IDLE);
     }
     /** Put stopper in FILL state */
-    public void fill() {
+    private void fillMode() {
         setFillDrainControl(CommandCodes.FILL);
     }
     /** Put stopper in BLOCK state */
@@ -231,8 +230,7 @@ public class ProperStopper {
     }
 
     /** construct a ProperStopper */
-    public ProperStopper(String name,
-                         String propInst,
+    public ProperStopper(String propInst,
                          ChainControl controlChain,
                          ChainControl dataChain,
                          ChainControl reportChain,
@@ -240,7 +238,7 @@ public class ProperStopper {
                          boolean clockHack,
                          Indenter indenter,
                          String pathToCounter) {
-        this.name = name;
+        propInst += ".properSt@1";
         this.controlPath = Marina.CONTROL_CHAIN+'.'+propInst;
         this.dataPath = Marina.DATA_CHAIN+'.'+propInst;
         this.reportPath = Marina.REPORT_CHAIN+'.'+propInst;
@@ -287,7 +285,7 @@ public class ProperStopper {
         dataChain.setInBits(dataPath, wrEn.cat(dta));
         shiftData(false, true);
         
-        fill();                                 // fill = 1
+        fillMode();                                 // fill = 1
         idle();                                 // fill = 0
         block();                                // go = 1
         //      idle();
@@ -305,14 +303,22 @@ public class ProperStopper {
         if (traceFill) prln("End fill");
     }
 
+    public void fill() {
+        BitVector data = new BitVector(37, "empty");
+        BitVector addr = new BitVector(14, "empty");
+        for(int i=0; i<data.getNumBits(); i++) data.set(i, false);
+        for(int i=0; i<addr.getNumBits(); i++) addr.set(i, false);
+        fill(new MarinaPacket(data, false, addr));
+    }
+
     public void fill(BitVector dat) {
-        if (traceFill) prln("Begin fill. stopper="+name);
+        if (traceFill) prln("Begin fill.");
         if (traceFill) prln("writing data: "+new MarinaPacket(dat));
         fill_(dat);
     }
 
     public void fill(MarinaPacket mp) {
-        if (traceFill) prln("Begin fill. stopper="+name);
+        if (traceFill) prln("Begin fill.");
         if (traceFill) prln("writing data: "+mp);
         fill_(mp.toSingleBitVector());
     }
@@ -321,7 +327,7 @@ public class ProperStopper {
      * You must stop stopper before calling fillMany()
      * exit state: block */
     public void fillMany(List<BitVector> data) {
-        prln("Begin fillMany. stopper="+name+" numWords="+data.size());
+        prln("Begin fillMany. numWords="+data.size());
         adjustIndent(2);
         int cnt = 0;
         for (BitVector bv : data) {
@@ -361,7 +367,7 @@ public class ProperStopper {
         idle();                                 // clear = 0
         stop();                                 // block = 0
 
-        if (traceDrain) prln("drain stopper="+name+" data="+new MarinaPacket(ans));
+        if (traceDrain) prln("drain  data="+new MarinaPacket(ans));
         return ans;
     }