add Fleet.{getShiftWidth(),getSetWidth()}
authoradam <adam@megacz.com>
Mon, 3 Nov 2008 09:33:06 +0000 (10:33 +0100)
committeradam <adam@megacz.com>
Mon, 3 Nov 2008 09:33:06 +0000 (10:33 +0100)
src/edu/berkeley/fleet/api/Fleet.java
src/edu/berkeley/fleet/two/FleetTwoFleet.java

index 48651f0..299f59d 100644 (file)
@@ -30,6 +30,12 @@ public abstract class Fleet implements Iterable<Ship> {
     /** the natural word width of this machine */
     public abstract int getWordWidth();
 
+    /** the width of the immediate field in the "shift data latch" instruction */
+    public abstract int getShiftWidth();
+
+    /** the width of the immediate field in the "set data latch" instruction */
+    public abstract int getSetWidth();
+    
     /**
      *  Read a machine-formatted instruction from a file.
      *   @is           The stream to read from.
index e6af7f8..93f145e 100644 (file)
@@ -128,6 +128,10 @@ public abstract class FleetTwoFleet extends Fleet {
         }
     }
 
+    public int getShiftWidth() { return SHIFT.valmaskwidth; }
+    public int getSetWidth() { return SET_IMMEDIATE.valmaskwidth+1; }
+
+    // FIXME: should use BitVector here
     public Instruction readInstruction(long inst, Dock dispatchFrom) {
         Dock dock = getPathByAddr(dispatchFrom, DISPATCH_PATH.getval(inst)).getDestination().getDock();