super(propInst, controlChain, dataChain, reportChain, cc, model, clockHack, indenter);
}
- public void fill(BitVector instr) {
- if (instr.getNumBits()==MarinaPacket.PACKET_WIDTH) {
- super.fill(instr);
- } else {
- MarinaUtils.expectLength(instr, MarinaPacket.WORD_WIDTH);
- /*
- MarinaUtils.expectLength(instr, INSTRUCTION_LENGTH);
- 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();
}
/** put one Instruction into InstructionStopper */
- public void fill(Instruction instr) {
- fill(MarinaUtils.berkToSun(MarinaTest.marinaFleet.encodeInstruction(MarinaTest.marinaFleet.getOnlyInputDock(), instr)));
+ public void fill(Instruction inst) {
+ super.fill(new MarinaPacket(inst));
}
/* put a torpedo into the InstructionStopper */
import com.sun.async.test.ChipModel;
import com.sun.async.test.JtagTester;
import com.sun.async.test.NanosimModel;
+import edu.berkeley.fleet.api.Dock;
+import edu.berkeley.fleet.api.Instruction;
+import edu.berkeley.fleet.marina.MarinaFleet;
/**
* This class encapsulates a "packet" -- a data item in flight plus
public final BitVector data;
public final boolean tokenhood;
public final BitVector path;
+ private final boolean is_instruction;
private static final BitVector null_path = new BitVector(PATH_WIDTH, "null_path");
static {
this.data = new BitVector(WORD_WIDTH, "marina packet data");
this.path = new BitVector(PATH_WIDTH, "marina packet path");
this.tokenhood = !singleBitVector.get(0);
+ this.is_instruction = false;
for(int i=0; i<PATH_WIDTH; i++) path.set(i, singleBitVector.get(i+1));
for(int i=0; i<WORD_WIDTH; i++) data.set(i, singleBitVector.get(i+PATH_WIDTH+1));
}
this.data = data;
this.tokenhood = tokenhood;
this.path = path;
+ this.is_instruction = false;
}
/** another constructor which uses an all-zeroes path, for convenience */
- public MarinaPacket(BitVector data, boolean tokenhood) {
- this(data, tokenhood, null_path);
+ public MarinaPacket(Instruction inst) {
+ BitVector instr =
+ MarinaUtils.berkToSun(MarinaTest.marinaFleet.encodeInstruction(MarinaTest.marinaFleet.getOnlyInputDock(), inst));
+ MarinaUtils.expectLength(instr, MarinaPacket.WORD_WIDTH);
+
+ //
+ // Due to what Ivan calls "geometric inconvenience", incoming
+ // bit 19 is dropped, and all the higher bits are shifted
+ // downward by one position. So we have to compensate for
+ // this by inserting a bogus bit at position #19.
+ //
+ BitVector pad = new BitVector(1, "pad");
+ pad.setFromLong(0);
+ this.data = instr.get(0, 18).cat(pad).cat(instr.get(18,18));
+ this.path = null_path;
+ this.tokenhood = false;
+ this.is_instruction = true;
}
/** convert a packet into a single BitVector, suitable for insertion in the north proper stopper */
return
"tokenhood="+(tokenhood ? "token" : "data")
+ ", path["+PATH_WIDTH+":1]=" + path.bitReverse().getState()
- + ", data["+WORD_WIDTH+":1]=" + data.bitReverse().getState();
+ + ", data["+WORD_WIDTH+":1]=" +
+ (is_instruction
+ ? (data.get(19,18).bitReverse().getState()+"_"+data.get(0,18).bitReverse().getState())
+ : data.bitReverse().getState());
}
}
\ No newline at end of file
* Fill stage must be empty.
* You must stop stopper before calling fill.
* exit state: block */
- public void fill(BitVector dta) {
- if (traceFill) prln("Begin fill. stopper="+name);
+ private void fill_(BitVector dta) {
adjustIndent(2);
int n = dta.getNumBits();
StateWireState myState = getFillStateWire();
fatal(myState!=StateWireState.EMPTY, "fill: fill stage already full");
- if (traceFill) prln("writing data: "+new MarinaPacket(dta));
-
idle(); // block = 1, go = 0
BitVector wrEn = new BitVector(2, "write enable");
if (traceFill) prln("End fill");
}
+ public void fill(BitVector dat) {
+ if (traceFill) prln("Begin fill. stopper="+name);
+ if (traceFill) prln("writing data: "+new MarinaPacket(dat));
+ fill_(dat);
+ }
+
public void fill(MarinaPacket mp) {
- fill(mp.toSingleBitVector());
+ if (traceFill) prln("Begin fill. stopper="+name);
+ if (traceFill) prln("writing data: "+mp);
+ fill_(mp.toSingleBitVector());
}
/** Insert items from a list, one by one.