get rid of ChainControls
[fleet.git] / src / edu / berkeley / fleet / marina / Marina.java
index 9ef38ac..28e293c 100644 (file)
@@ -75,8 +75,8 @@ public class Marina {
         private int value;
         private Ilc() {
             shiftReport(true, false);
-            BitVector odd  = cc.getOutBits(REPORT_CHAIN+"."+ILC_PATH_ODD).bitReverse().not();
-            BitVector even = cc.getOutBits(REPORT_CHAIN+"."+ILC_PATH_EVEN).bitReverse().not();
+            BitVector odd  = reportChain.getOutBits(REPORT_CHAIN+"."+ILC_PATH_ODD).bitReverse().not();
+            BitVector even = reportChain.getOutBits(REPORT_CHAIN+"."+ILC_PATH_EVEN).bitReverse().not();
             BitVector ret  = new BitVector(8, "olc");
             for(int i=0; i<4; i++) {
                 ret.set(i*2+1, odd.get(i));
@@ -105,7 +105,11 @@ public class Marina {
 
     // The name of the scan chain
     // The instance path, from the top cell of the netlist, of the instance of infinityWithCover 
-    public final ChainControls cc;           // specifies the scan chain
+    public final ChainControl controlChain;
+    public final ChainControl dataChain;
+    public final ChainControl dukeChain;
+    public final ChainControl reportChain;
+
     private final ChipModel model;
     public final ProperStopper data;
     public final InstructionStopper instrIn;
@@ -115,35 +119,48 @@ public class Marina {
     
     /** Shift the report scan chain */
     public void shiftReport(boolean readEnable, boolean writeEnable) {
-        cc.shift(REPORT_CHAIN, readEnable, writeEnable);
+        reportChain.shift(REPORT_CHAIN, readEnable, writeEnable);
     }
     
     /** Shift the report scan chain */
     private void shiftControl(boolean readEnable, boolean writeEnable) {
-        cc.shift(CONTROL_CHAIN, readEnable, writeEnable);
+        controlChain.shift(CONTROL_CHAIN, readEnable, writeEnable);
     }
         
     /** Shift the data scan chain */
     private void shiftData(boolean readEnable, boolean writeEnable) {
-        cc.shift(DATA_CHAIN, readEnable, writeEnable);
+        dataChain.shift(DATA_CHAIN, readEnable, writeEnable);
     }
 
     /** Shift the data scan chain */
     public void shiftDuke(boolean readEnable, boolean writeEnable) {
-        cc.shift(DUKE_CHAIN, readEnable, writeEnable);
+        dukeChain.shift(DUKE_CHAIN, readEnable, writeEnable);
     }
 
-    public Marina(ChainControls cc, ChipModel model, boolean clockHack, Indenter indenter) {
-        this.cc = cc;
+    public Marina(ChainControl controlChain,
+                  ChainControl dataChain,
+                  ChainControl dukeChain,
+                  ChainControl reportChain,
+                  ChipModel model, boolean clockHack, Indenter indenter) {
+        this.controlChain = controlChain;
+        this.dataChain = dataChain;
+        this.dukeChain = dukeChain;
+        this.reportChain = reportChain;
         this.model = model;
         this.indenter = indenter;
         data = new ProperStopper("north fifo",
                                  prefix+"northFif@1.fillDrai@1.properSt@1",
-                                 cc, model, clockHack, indenter,
+                                 controlChain,
+                                 dataChain,
+                                 reportChain,
+                                 model, clockHack, indenter,
                                  prefix+"northFif@1.fillDrai@1.instruct@0.cntScnTh@1.cntScnOn@1");
         instrIn = new InstructionStopper("south fifo",
                                          prefix+"southFif@1.tapPropS@1.properSt@1", 
-                                         cc, model, clockHack, indenter,
+                                         controlChain,
+                                         dataChain,
+                                         reportChain,
+                                         model, clockHack, indenter,
                                          prefix+"southFif@1.tapPropS@1.instruct@0.cntScnTh@1.cntScnOn@1");
     }
 
@@ -153,7 +170,7 @@ public class Marina {
     public void stopAndResetCounters() {
         instrIn.setCounterEnable(false);
         data.setCounterEnable(false);
-        cc.shift(DATA_CHAIN, true, false);        
+        dataChain.shift(DATA_CHAIN, true, false);        
         northCount = data.getCounterValue();
         southCount = instrIn.getCounterValue();
         data.setCounterValue(0);
@@ -307,7 +324,10 @@ public class Marina {
         // If you forget, then the inBits member initializes 
         // with random data. Then when you do your first write,
         // some bits are written randomly.
-        cc.resetInBits();
+        dataChain.resetInBits();
+        dukeChain.resetInBits();
+        reportChain.resetInBits();
+        controlChain.resetInBits();
 
         // For reset, I want to clear all the stoppers simultaneously
         data.clear();
@@ -330,7 +350,7 @@ public class Marina {
         if (omegaCounter) {
             BitVector bits = null;
             for(int i=0; i<4; i++) {
-                BitVector x = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
+                BitVector x = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
                 //System.out.println("bits are: " + x);
                 bits = bits==null ? x : bits.cat(x);
             }
@@ -365,7 +385,7 @@ public class Marina {
         } else if (kesselsCounter) {
             BitVector bits = null;
             for(int i=0; i<4; i++) {
-                BitVector x = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
+                BitVector x = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_KESSEL+i);
                 //System.out.println("bits are: " + x);
                 bits = bits==null ? x : bits.cat(x);
             }
@@ -402,8 +422,8 @@ public class Marina {
                                );
             return (first+second);
         } else {
-            BitVector odd = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_ODD).bitReverse();
-            BitVector even = cc.getOutBits(REPORT_CHAIN+"."+OLC_PATH_EVEN).bitReverse();
+            BitVector odd = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_ODD).bitReverse();
+            BitVector even = reportChain.getOutBits(REPORT_CHAIN+"."+OLC_PATH_EVEN).bitReverse();
             odd = odd.not();
             even = even.not();
             BitVector bv = new BitVector(6, "olc");
@@ -422,12 +442,12 @@ public class Marina {
     /** Get the A flag */
     public boolean getFlagA() {
         shiftReport(true, false);
-        return cc.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(A_FLAG_NDX);
+        return reportChain.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(A_FLAG_NDX);
     }
     /** Get the B flag */
     public boolean getFlagB() {
         shiftReport(true, false);
-        return cc.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(B_FLAG_NDX);
+        return reportChain.getOutBits(REPORT_CHAIN+"."+FLAGS_PATH).get(B_FLAG_NDX);
     }
     /** return value of instruction counter. Instruction counter counts 
      * the instructions flowing through 1/2 of alternating FIFO.
@@ -435,7 +455,7 @@ public class Marina {
      * regardless of readEnable or writeEnable! */
     public long getInstructionCounter() {
         shiftData(true, false);
-        BitVector count = cc.getOutBits(DATA_CHAIN+"."+INSTRUCTION_COUNTER_PATH);
+        BitVector count = dataChain.getOutBits(DATA_CHAIN+"."+INSTRUCTION_COUNTER_PATH);
         int sz = count.getNumBits(); 
         MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
                          " expected: "+COUNTER_LENGTH);
@@ -447,7 +467,7 @@ public class Marina {
      * regardless of readEnable or writeEnable! */
     public long getDataCounter() {
         shiftData(true, false);
-        BitVector count = cc.getOutBits(DATA_CHAIN+"."+DATA_COUNTER_PATH);
+        BitVector count = dataChain.getOutBits(DATA_CHAIN+"."+DATA_COUNTER_PATH);
         int sz = count.getNumBits(); 
         MarinaTest.fatal(sz!=COUNTER_LENGTH, "wrong number of counter bits: "+sz+
                          " expected: "+COUNTER_LENGTH);
@@ -469,16 +489,16 @@ public class Marina {
     /** Enable the transmission of instructions from the instruction
      * ring test structure to the EPI FIFO. */
     public void enableInstructionSend(boolean b) {
-        BitVector bv = cc.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+        BitVector bv = controlChain.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
         bv.set(INSTRUCTION_SEND_NDX, b);
-        cc.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv); 
+        controlChain.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv); 
         shiftControl(false, true);
     } 
     /** Enable the recirculation of instructions within the South FIFO */
     public void enableInstructionRecirculate(boolean b) {
-        BitVector bv = cc.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+        BitVector bv = controlChain.getInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
         bv.set(INSTRUCTION_RECIRCULATE_NDX, b);
-        cc.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv); 
+        controlChain.setInBits(CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv); 
         shiftControl(false, true);
     }
     /** get the number of tokens in the token FIFO.
@@ -488,12 +508,12 @@ public class Marina {
     public int getNumTokens() {
         shiftReport(true, false);
         // get the token successor and token FIFO wires
-        BitVector bv = cc.getOutBits(REPORT_CHAIN+"."+TOK_FIFO_PATH);
+        BitVector bv = reportChain.getOutBits(REPORT_CHAIN+"."+TOK_FIFO_PATH);
         int sz = bv.getNumBits();
         MarinaTest.fatal(sz!=3, "wrong token FIFO size: "+sz+" expected: 3");
         
         // get the token predecessor wire
-        BitVector pred = cc.getOutBits(REPORT_CHAIN+"."+TOK_PRED_PATH);
+        BitVector pred = reportChain.getOutBits(REPORT_CHAIN+"."+TOK_PRED_PATH);
         sz = pred.getNumBits();
         MarinaTest.fatal(sz!=1, "wrong token predecessor size: "+sz+" expected: 1");