Decoded instructions are 36 bits
authorrkao <rkao>
Thu, 30 Oct 2008 22:04:02 +0000 (22:04 +0000)
committerrkao <rkao>
Thu, 30 Oct 2008 22:04:02 +0000 (22:04 +0000)
testCode/com/sun/vlsi/chips/marina/test/InstructionStopper.java
testCode/com/sun/vlsi/chips/marina/test/MarinaTest.java

index 7e1b26b..8164f3b 100644 (file)
@@ -4,9 +4,10 @@ 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
+/** InstructionStopper is a scaffold that lets us create a 36 bit propperStopper
  * by using a 52 bit propperStopper and throwing away the unused bits. */
 public class InstructionStopper extends ProperStopper {
+       public static final int INSTR_SZ = 36;
        public InstructionStopper(String propInst,
                                          String controlChain, String dataChain,
                                          String reportChain,
@@ -18,7 +19,13 @@ public class InstructionStopper extends ProperStopper {
        @Override
     public void fill(BitVector instr) {
                int n = instr.getNumBits();
-       fatal(n!=37, "InstructionStopper.fill: wrong num bits: "+n+", expect: 37");
+       fatal(n!=INSTR_SZ, "InstructionStopper.fill: wrong num bits: "+n+", expect: "+INSTR_SZ);
+               fatal(INSTR_SZ>37, "Instructions can't be more than 37 bits");
+               if (INSTR_SZ<37) {
+                       BitVector pad = new BitVector(37-INSTR_SZ, "pad");
+                       pad.setFromLong(0);
+                       instr = instr.cat(pad);
+               }
        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));
@@ -26,10 +33,10 @@ public class InstructionStopper extends ProperStopper {
        @Override 
        public BitVector drain() {
                BitVector dta = super.drain();
-               return dta.get(0, 37);
+               return dta.get(0, INSTR_SZ);
        }
        @Override
        public String formatDataTokAddr(BitVector dta) {
-               return dta.get(0, 37).getState();
+               return dta.get(0, INSTR_SZ).getState();
        }
 }
index 33795fc..48af389 100644 (file)
@@ -31,6 +31,8 @@ import com.sun.vlsi.chips.marina.test.MarinaUtils.CmdArgs.Mode;
  */
 public class MarinaTest {
        //--------------------------  constants -----------------------------------
+       public static final int INSTR_SZ = 36;
+
        // COLUMN_LATENCY is a delay that is larger than the latency through an Infinity column
        private static final int COLUMN_LATENCY = 10; // nanoseconds
 
@@ -369,10 +371,10 @@ public class MarinaTest {
             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));
+        BitVector bitVector = new BitVector(INSTR_SZ, "instr");
+        for(int i=0; i<INSTR_SZ; i++) bitVector.set(i, bits.get(i));
 
-        inDock.insIn.fill(bitVector.bitReverse());
+        inDock.insIn.fill(bitVector);
         
         /* FIXME: check to see if the token actually emerges! */