First merge with Adam
authorrkao <rkao>
Tue, 28 Oct 2008 22:18:15 +0000 (22:18 +0000)
committerrkao <rkao>
Tue, 28 Oct 2008 22:18:15 +0000 (22:18 +0000)
testCode/com/sun/vlsi/chips/marina/test/InstructionStopper.java [new file with mode: 0644]
testCode/com/sun/vlsi/chips/marina/test/IsolatedInDock.java
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java
testCode/com/sun/vlsi/chips/marina/test/ProperStopper.java
testCode/isolatedInDock.spi

diff --git a/testCode/com/sun/vlsi/chips/marina/test/InstructionStopper.java b/testCode/com/sun/vlsi/chips/marina/test/InstructionStopper.java
new file mode 100644 (file)
index 0000000..7e1b26b
--- /dev/null
@@ -0,0 +1,35 @@
+package com.sun.vlsi.chips.marina.test;
+
+import com.sun.async.test.BitVector;
+import com.sun.async.test.ChainControl;
+import com.sun.async.test.ChipModel;
+
+/** InstructionStopper is a scaffold that lets us create a 37 bit propperStopper
+ * by using a 52 bit propperStopper and throwing away the unused bits. */
+public class InstructionStopper extends ProperStopper {
+       public InstructionStopper(String propInst,
+                                         String controlChain, String dataChain,
+                                         String reportChain,
+                                         ChainControl cc, ChipModel model,
+                                         Indenter indenter) {
+               super(propInst, controlChain, dataChain, reportChain, cc, model, indenter);
+               
+       }
+       @Override
+    public void fill(BitVector instr) {
+               int n = instr.getNumBits();
+       fatal(n!=37, "InstructionStopper.fill: wrong num bits: "+n+", expect: 37");
+       BitVector t = new BitVector(1, "token");   t.setFromLong(0);
+       BitVector a = new BitVector(14, "addr");   a.setFromLong(0);
+       super.fill(instr.cat(t).cat(a));
+    }
+       @Override 
+       public BitVector drain() {
+               BitVector dta = super.drain();
+               return dta.get(0, 37);
+       }
+       @Override
+       public String formatDataTokAddr(BitVector dta) {
+               return dta.get(0, 37).getState();
+       }
+}
index dccf73f..d0f699c 100644 (file)
@@ -32,7 +32,7 @@ public class IsolatedInDock implements Design {
                                                   DATA_CHAIN,
                                                   REPORT_CHAIN,
                                                   cc, model, indenter);
-        insIn = new ProperStopper("insIn", 
+        insIn = new InstructionStopper("insIn", 
                                      CONTROL_CHAIN,
                                      DATA_CHAIN,
                                      REPORT_CHAIN,
index e766b0d..33795fc 100644 (file)
@@ -4,6 +4,9 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
+import edu.berkeley.fleet.marina.*;
+import edu.berkeley.fleet.api.*;
+
 import com.sun.async.test.BitVector;
 import com.sun.async.test.ChainControl;
 import com.sun.async.test.ChainTest;
@@ -330,12 +333,52 @@ public class MarinaTest {
        prln("Begin sendInstructions");
        adjustIndent(2);
        
-       List<BitVector> din = makeIncrDataConstAdr(3, 0);
+       List<BitVector> din = new ArrayList<BitVector>();
+
+       BitVector count = new BitVector(37,"count");
+       BitVector one = new BitVector(37, "one");
+       count.setFromLong(0);
+       one.setFromLong(1);
+       for (int i=0; i<3; i++) {
+               din.add(count);
+               count = count.add(one);
+       }
+
        inDock.insIn.fillMany(din);
 
        adjustIndent(-2);
        prln("End sendInstructions");
     }
+    private void sendToken(IsolatedInDock inDock) {
+       prln("Begin sendToken");
+       adjustIndent(2);
+       
+        MarinaFleet marina = new MarinaFleet();
+        Dock dock = marina.getOnlyInputDock();
+        Instruction sendTokenInstruction =
+            new Instruction.Move(dock,
+                                 null,    /* path      */
+                                 false,   /* tokenIn   */
+                                 false,   /* dataIn    */
+                                 false,   /* latchData */
+                                 false,   /* latchPath */
+                                 false,   /* dataOut   */
+                                 true     /* tokenOut  */
+                                 );
+        edu.berkeley.fleet.api.BitVector bits =
+            marina.encodeInstruction(dock, /* dispatch dock -- irrelevant for MARINA */
+                                     sendTokenInstruction);
+
+        BitVector bitVector = new BitVector(bits.length(), "instr");
+        for(int i=0; i<bits.length(); i++) bitVector.set(i, bits.get(i));
+
+        inDock.insIn.fill(bitVector.bitReverse());
+        
+        /* FIXME: check to see if the token actually emerges! */
+
+       adjustIndent(-2);
+       prln("End sendToken");
+    }
        private void doOneTest(int testNum) {
         prln("MarinaTest: performing test: "+testNum);
         design.masterClear(tester);
@@ -344,6 +387,7 @@ public class MarinaTest {
                case 0:                 stopToStopOneItem((IsolatedInDock)design);       break;
                case 1:                 stopToStopThreeItems((IsolatedInDock)design);    break;
                case 2:                 sendInstructions((IsolatedInDock)design);                break;
+               case 3:                 sendToken((IsolatedInDock)design);               break;
                default:
                        fatal(true, "Test number: "+testNum+" doesn't exist.");
                        break;
index 1d0aa97..9ee880f 100644 (file)
@@ -10,6 +10,7 @@ import com.sun.async.test.NanosimModel;
 import com.sun.vlsi.chips.marina.test.MarinaUtils.StateWireState;
 
 public class ProperStopper {
+       private final String name;
     private final String captureClockRelPath = "aFillSta@0.all1in52@1.data1in3@0";
     private final String captureClockName = "wrr";
 
@@ -24,7 +25,7 @@ public class ProperStopper {
     private final ChipModel model;
        private final Indenter indenter;
 
-       private static void fatal(boolean pred, String msg) {
+       protected static void fatal(boolean pred, String msg) {
                if (pred) Infrastructure.fatal(msg);
        }
        private void prln(String msg) {indenter.prln(msg);}
@@ -46,7 +47,7 @@ public class ProperStopper {
 
     private BitVector getDatTokAdr() {
        // strip the two write enable bits
-       return cc.getOutBits(dataPath).get(2, 52);
+       return cc.getOutBits(dataPath).get(2, 52).bitReverse();
     }
     
     private void shiftControl(boolean readEnable, boolean writeEnable) {
@@ -72,6 +73,13 @@ public class ProperStopper {
     }
     
     //-------------------------- public methods ----------------------------
+    
+    /** Allow subclasses to override the formating of the data. For example,
+     * the Instruction stopper only uses the 37 bits of data so it only 
+     * wants to print the 37 instruction bits */
+    public String formatDataTokAddr(BitVector dta) {
+       return MarinaUtils.formatDataTokAddr(dta);
+    }
 
     /** Put stopper in RUN state */
     public void run() {
@@ -169,6 +177,7 @@ public class ProperStopper {
                             String reportChain,
                             ChainControl cc, ChipModel model,
                             Indenter indenter) {
+       this.name = propInst;
        this.controlChain = controlChain;
        this.controlPath = controlChain+'.'+propInst;
        this.dataChain = dataChain;
@@ -202,25 +211,25 @@ public class ProperStopper {
      * You must stop stopper before calling fill.
      * exit state: idle */
     public void fill(BitVector dta) {
-       if (traceFill) prln("Begin fillStopper");
+       if (traceFill) prln("Begin fill stopper: "+name);
        adjustIndent(2);
        
        int n = dta.getNumBits();
-       fatal(n!=(37+1+14), "fillStopper: wrong num bits: "+n);
+       fatal(n!=(37+1+14), "fill: wrong num bits: "+n);
        
        // make sure fill stage is empty
        shiftReport(true, false);
        StateWireState myState = getMyStateWire();
        fatal(myState!=StateWireState.EMPTY, 
-                 "fillStopper: fill stage already full");
+                 "fill: fill stage already full");
        
-       if (traceFill) prln("writing data: "+MarinaUtils.formatDataTokAddr(dta));
+       if (traceFill) prln("writing data: "+formatDataTokAddr(dta));
        
        idle();                                 // block = 1, go = 0
 
        BitVector wrEn = new BitVector(2, "write enable");
        wrEn.setFromLong(3);
-       cc.setInBits(dataPath, wrEn.cat(dta));
+       cc.setInBits(dataPath, wrEn.cat(dta.bitReverse()));
        shiftData(false, true);
        
        fill();                                 // fill = 1
@@ -235,10 +244,10 @@ public class ProperStopper {
        
        // if data chain is shifted in the future, don't write!
        wrEn.setFromLong(0);
-       cc.setInBits(dataPath, wrEn.cat(dta));
+       cc.setInBits(dataPath, wrEn.cat(dta.bitReverse()));
        
        adjustIndent(-2);
-       if (traceFill) prln("End fillStopper");
+       if (traceFill) prln("End fill stopper: "+name);
     }
     /** Insert items from a list, one by one. 
      * You must stop stopper before calling fillMany()
@@ -274,7 +283,7 @@ public class ProperStopper {
        idle();                                 // clear = 0
        stop();                                 // block = 0
 
-       if (traceDrain) prln("drainStopper data: "+MarinaUtils.formatDataTokAddr(ans));
+       if (traceDrain) prln("drain stopper: "+name+" data: "+formatDataTokAddr(ans));
        return ans;
     }
     /** Remove as many items as possible from the fill stage.
index dfe8ffa..e5672d4 100644 (file)
@@ -1,8 +1,8 @@
 *** SPICE deck for cell isolatedInDock{sch} from library marina
 *** Created on Fri Sep 05, 2008 15:05:59
 *** Last revised on Thu Sep 11, 2008 14:57:39
-*** Written on Thu Sep 11, 2008 15:43:10 by Electric VLSI Design System, 
-*version 8.08e
+*** Written on Thu Oct 23, 2008 16:23:29 by Electric VLSI Design System, 
+*version 8.08i
 *** Layout tech: cmos90, foundry TSMC
 *** UC SPICE *** , MIN_RESIST 50.0, MIN_CAPAC 0.04FF
 .OPTIONS NOMOD NOPAGE
@@ -493,12 +493,6 @@ XNMOS@0 out in gnd NMOSx-X_100
 XPMOS@0 out in vdd PMOSx-X_100
 .ENDS inv-X_100
 
-*** CELL: orangeTSMC090nm:PMOSx{sch}
-.SUBCKT PMOSx-X_40 d g s
-MPMOSf@0 d g s vdd pch W='240*(1+ABP/sqrt(240*2))' L='2'  
-+DELVTO='AVT0P/sqrt(240*2)'
-.ENDS PMOSx-X_40
-
 *** CELL: orangeTSMC090nm:NMOSx{sch}
 .SUBCKT NMOSx-X_40 d g s
 MNMOSf@0 d g s gnd nch W='120*(1+ABN/sqrt(120*2))' L='2' 
@@ -517,12 +511,12 @@ Xnms2@0 d g g2 nms2-X_20
 Xnms2@1 d g2 g nms2-X_20
 .ENDS nms2_sy-X_40
 
-*** CELL: redFour:nand2_sy{sch}
-.SUBCKT nand2_sy-X_40 ina inb out
-XPMOS@0 out inb vdd PMOSx-X_40
-XPMOS@1 out ina vdd PMOSx-X_40
+*** CELL: redFour:nand2LT_sy{sch}
+.SUBCKT nand2LT_sy-X_40 ina inb out
+XPMOS@0 out ina vdd PMOSx-X_20
+XPMOS@1 out inb vdd PMOSx-X_20
 Xnms2_sy@0 out ina inb nms2_sy-X_40
-.ENDS nand2_sy-X_40
+.ENDS nand2LT_sy-X_40
 
 *** CELL: orangeTSMC090nm:wire{sch}
 .SUBCKT wire-C_0_011f-414-R_34_667m a b
@@ -561,7 +555,7 @@ Xwire@0 a b wire-C_0_011f-927-R_34_667m
 Xinv@5 net@146 out inv-X_100
 Xinv@6 inB net@135 inv-X_20
 Xinv@7 inA net@139 inv-X_20
-Xnand2_sy@1 net@140 net@136 net@144 nand2_sy-X_40
+Xnand2LT_@0 net@140 net@136 net@144 nand2LT_sy-X_40
 Xwire90@4 net@135 net@136 wire90-414-layer_1-width_3
 Xwire90@5 net@144 net@146 wire90-927-layer_1-width_3
 Xwire90@6 net@139 net@140 wire90-414-layer_1-width_3
@@ -1128,11 +1122,11 @@ Xwire@0 a b wire-C_0_011f-555_8-R_34_667m
 
 *** CELL: latchesK:latch2in60C{sch}
 .SUBCKT latch2in60C hcl[A] hcl[B] inA[1] inB[1] outS[1]
-Xhi2inLat@0 hcl[A] hcl[B] inA[1] inB[1] dataBar raw2inLatchF
+Xhi2inLat@0 hcl[A] hcl[B] inA[1] inB[1] net@14 raw2inLatchF
 XinvLT@0 net@15 net@18 invLT-X_5
 XinvLT@1 net@16 net@19 inv-X_20
 XinvLT@2 net@17 outS[1] inv-X_60
-Xwire90@0 dataBar net@15 wire90-295_8-layer_1-width_3
+Xwire90@0 net@14 net@15 wire90-295_8-layer_1-width_3
 Xwire90@1 net@18 net@16 wire90-242_1-layer_1-width_3
 Xwire90@2 net@19 net@17 wire90-555_8-layer_1-width_3
 .ENDS latch2in60C
@@ -1164,6 +1158,12 @@ Xls[13] fire ain[13] aout[13] p1p p2p rd xin[13] xin[14] wrA latchWscan
 Xls[14] fire ain[14] aout[14] p1p p2p rd xin[14] sout wrA latchWscan
 .ENDS addr1in14scan
 
+*** CELL: orangeTSMC090nm:PMOSx{sch}
+.SUBCKT PMOSx-X_40 d g s
+MPMOSf@0 d g s vdd pch W='240*(1+ABP/sqrt(240*2))' L='2'  
++DELVTO='AVT0P/sqrt(240*2)'
+.ENDS PMOSx-X_40
+
 *** CELL: redFour:inv{sch}
 .SUBCKT inv-X_40 in out
 XNMOS@0 out in gnd NMOSx-X_40