add Fleet.getMaxCodeBagSize() and makeCodeBagDescriptor()
[fleet.git] / src / edu / berkeley / fleet / two / FleetTwoFleet.java
index 7936ad0..7e3ee4f 100644 (file)
@@ -261,6 +261,19 @@ public abstract class FleetTwoFleet extends Fleet {
     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();