add Fleet.getMaxCodeBagSize() and makeCodeBagDescriptor()
[fleet.git] / src / edu / berkeley / fleet / api / Fleet.java
index 299f59d..361f5af 100644 (file)
@@ -35,20 +35,26 @@ public abstract class Fleet implements Iterable<Ship> {
 
     /** 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);
     
     /**
-     *  Read a machine-formatted instruction from a file.
-     *   @is           The stream to read from.
-     *   @dispatchFrom The dock from which the instructions being read are to be dispatched (required for decoding)
+     *  Encodes an instruction as a BitVector
+     *   @instruction  The instruction to encode
+     *   @dispatchFrom The dock from which the instruction being written is to be dispatched (required for encoding)
      */
-    public abstract Instruction readInstruction(DataInputStream is, Dock dispatchFrom) throws IOException;
+    public abstract BitVector   encodeInstruction(Instruction instruction, Dock dispatchFrom);
 
     /**
-     *  Write a machine-formatted instruction to a file.
-     *   @os           The stream to write to.
-     *   @dispatchFrom The dock from which the instruction being written is to be dispatched (required for encoding)
+     *  Decodes an instruction from a BitVector
+     *   @instruction  The instruction to decode
+     *   @dispatchFrom The dock from which the instructions being read are to be dispatched (required for decoding)
      */
-    public abstract void        writeInstruction(DataOutputStream os, Dock dispatchFrom, Instruction instr) throws IOException;
+    public abstract Instruction decodeInstruction(BitVector instruction, Dock dispatchFrom);
 
     /** If supported, run the given code and create a FleetProcess to interact with it. */
     public FleetProcess run(Instruction[] program) {