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,
@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));
@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();
}
}
*/
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
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! */