add Fleet.getMaxCodeBagSize() and makeCodeBagDescriptor()
[fleet.git] / src / edu / berkeley / fleet / loops / Program.java
index 8cd4b01..597549d 100644 (file)
@@ -119,15 +119,14 @@ public class Program {
         // 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);