/** the width of the immediate field in the "set data latch" instruction */
public abstract int getSetWidth();
+
+ /** FIXME: this will soon become a property of individual memories rather than the entire Fleet */
+ public abstract int getMaxCodeBagSize();
+
+ /** FIXME: this will soon become a property of individual memories rather than the entire Fleet */
+ public abstract BitVector makeCodeBagDescriptor(long offset, long length);
/**
* Encodes an instruction as a BitVector
// being dispatched than the maximum number that fit in the
// data fifo at that dock.
- int MAX_BAG_SIZE = (1<<6)-1;
+ int MAX_BAG_SIZE = fleet.getMaxCodeBagSize();
// FUZZ is an estimate of the number of instructions required
// to dispatch a code bag descriptor
int FUZZ = 4;
if (instructions.length <= MAX_BAG_SIZE) {
- BitVector descriptor = new BitVector(fleet.getWordWidth());
- descriptor.set( (leastUnallocatedAddress<<6) | instructions.length );
+ BitVector descriptor = fleet.makeCodeBagDescriptor(leastUnallocatedAddress, instructions.length);
leastUnallocatedAddress += instructions.length;
for(Instruction i : instructions)
all_instructions.add(i);
public int getShiftWidth() { return SHIFT.valmaskwidth; }
public int getSetWidth() { return SET_IMMEDIATE.valmaskwidth+1; }
+
+ public int getMaxCodeBagSize() {
+ return (1<<CBD_SIZE.valmaskwidth)-1;
+ }
+ public BitVector makeCodeBagDescriptor(long offset, long length) {
+ BitVector descriptor = new BitVector(getWordWidth());
+ CBD_OFFSET.setval(descriptor, offset);
+ CBD_SIZE.setval(descriptor, length);
+ return descriptor;
+ }
+
+
+
// FIXME: should use BitVector here
public Instruction readInstruction(long inst, Dock dispatchFrom) {
Dock dock = getPathByAddr(dispatchFrom, DISPATCH_PATH.getvalAsBitVector(inst)).getDestination().getDock();