formatting changes
authorAdam Megacz <adam.megacz@sun.com>
Tue, 24 Mar 2009 18:42:36 +0000 (18:42 +0000)
committerAdam Megacz <adam.megacz@sun.com>
Tue, 24 Mar 2009 18:42:36 +0000 (18:42 +0000)
testCode/com/sun/vlsi/chips/marina/test/InstructionStopper.java
testCode/com/sun/vlsi/chips/marina/test/Marina.java
testCode/com/sun/vlsi/chips/marina/test/ProperStopper.java

index be47309..58ef88d 100644 (file)
@@ -33,12 +33,13 @@ public class InstructionStopper extends ProperStopper {
             super.fill(instr);
         } else {
             MarinaUtils.expectLength(instr, INSTRUCTION_LENGTH);
-            BitVector pad = new BitVector(37-INSTRUCTION_LENGTH, "pad");
+            BitVector pad = new BitVector(MarinaPacket.WORD_WIDTH-INSTRUCTION_LENGTH, "pad");
             pad.setFromLong(0);
             super.fill(new MarinaPacket(instr.cat(pad), false));
         }
     }
 
+    // FIXME: I really don't like this --Adam
     public BitVector drainNoCheck() {
         BitVector dta = super.drainNoCheck();
         return dta.get(15, INSTRUCTION_LENGTH);
index 15bef38..e6d9e38 100644 (file)
@@ -12,6 +12,7 @@ import edu.berkeley.fleet.api.Instruction;
  * Right now, it doesn't do much of anything. It just helps me exercise
  * my test infrastructure. */
 public class Marina {
+
     public static final String DATA_CHAIN =    "marina.marina_data";      
     public static final String CONTROL_CHAIN = "marina.marina_control";
     public static final String REPORT_CHAIN =  "marina.marina_report";
index 6f3d80e..2b21551 100644 (file)
@@ -42,11 +42,9 @@ public class ProperStopper {
     private final ChipModel model;
     private final Indenter indenter;
 
-    protected static void fatal(boolean pred, String msg) {
-        if (pred) Infrastructure.fatal(msg);
-    }
-    private void prln(String msg) {indenter.prln(msg);}
-    private void adjustIndent(int n) {indenter.adjustIndent(n);}
+    protected static void fatal(boolean pred, String msg) { if (pred) Infrastructure.fatal(msg); }
+    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'.
@@ -143,6 +141,7 @@ public class ProperStopper {
     public void stopSink() {
         setFillDrainControl(CommandCodes.STOPSINK.bits());
     }
+
     /** Stop a running stopper in order to add items.  Ensure that we don't
      * lose the item in the fill stage.  
      * Exit state: block */
@@ -152,6 +151,7 @@ public class ProperStopper {
         block();                                // go = 1
         //      idle();                                 // go = 0
     }
+
     /** get value of the state wire preceding the fill stage */
     public StateWireState getPrevStateWire() {
         shiftReport(true, false);
@@ -160,6 +160,7 @@ public class ProperStopper {
         fatal(n!=4, "Bad number of Stopper report bits: "+n);
         return boolToState(cc.getOutBits(reportPath).get(PREV_STATE_IN_NDX));
     }
+
     /** get the value of drain stage fill wire.
      * The fill wire will be interesting if we doubt that the
      * scan chain works. */
@@ -167,16 +168,19 @@ public class ProperStopper {
         shiftReport(true, false);
         return cc.getOutBits(reportPath).get(FILL_STROBE_IN_NDX);
     }
+
     /** get value of state wire between the fill and drain stages */
     public StateWireState getFillStateWire() {
         shiftReport(true, false);
         return boolToState(cc.getOutBits(reportPath).get(FILL_STATE_IN_NDX));
     }
+
     /** get value of drain stage stopped wire */
     public boolean getStopped() {
         shiftReport(true, false);
         return cc.getOutBits(reportPath).get(STOPPED_IN_NDX);
     }
+
     public String getReportString() {
         StringBuffer sb = new StringBuffer();
         sb.append("Stopper's prev state: ");
@@ -187,6 +191,7 @@ public class ProperStopper {
         sb.append(getStopped()+"\n");
         return sb.toString();
     }
+
     /** construct a ProperStopper */
     public ProperStopper(String propInst,
                          String controlChain, String dataChain, 
@@ -209,18 +214,14 @@ public class ProperStopper {
         this.clockHack = clockHack;
         this.indenter = indenter;
     }
+
     /** Reset ProperStopper after the JTAG TRST has been pulsed */
     public void resetAfterMasterClear() {
         BitVector we = new BitVector(2, "write enable");
-        BitVector data = new BitVector(37, "data");
-        BitVector tag = new BitVector(1, "tag");
-        BitVector addr = new BitVector(14, "addr");
+        BitVector packet = new BitVector(MarinaPacket.PACKET_WIDTH, "packet");
         we.setFromLong(0);
-        data.setFromLong(0);
-        tag.setFromLong(0);
-        addr.setFromLong(0);
-        BitVector wdta = we.cat(data).cat(tag).cat(addr);
-        
+        packet.setFromLong(0);
+        BitVector wdta = we.cat(packet);
         cc.setInBits(dataPath, wdta);
     }
     
@@ -237,8 +238,7 @@ public class ProperStopper {
         
         // make sure fill stage is empty
         StateWireState myState = getFillStateWire();
-        fatal(myState!=StateWireState.EMPTY, 
-              "fill: fill stage already full");
+        fatal(myState!=StateWireState.EMPTY, "fill: fill stage already full");
         
         if (traceFill) prln("writing data: "+new MarinaPacket(dta));
         
@@ -285,6 +285,7 @@ public class ProperStopper {
         adjustIndent(-2);
         prln("end fillMany");
     }
+
     /** Remove one item from fill stage. Return that item.
      * An item must be available.
      * drain() will stop cleanly.
@@ -298,6 +299,7 @@ public class ProperStopper {
 
         return drainNoCheck();
     }
+
     /** Remove one item from fill stage. Return that item.
      * Assume that an item is available. 
      * entry state: stop
@@ -316,6 +318,7 @@ public class ProperStopper {
         if (traceDrain) prln("drain stopper="+name+" data="+new MarinaPacket(ans));
         return ans;
     }
+
     /** Remove as many items as possible from the fill stage.
      * drainStopperMany() will stop cleanly.
      * exit state: stop */