edu.berkeley.fleet.api
Class Fleet

Object
  extended by Fleet
All Implemented Interfaces:
Iterable<Ship>

public abstract class Fleet
extends Object
implements Iterable<Ship>

An instance of Fleet; each Fleet consists of a collection of Ships.

Note about instruction representation: it is very important to understand that the binary representation of an instruction includes a path from the dock which will dispatch the instruction to the dock which will execute the instruction. Therefore, an instruction cannot be converted to binary form without supplying a dispatching dock so the necessary path can be computed. Moreover: because a given string of bits uniquely describes a path only if given along with a starting point, instructions cannot be converted from binary format without knowing the dispatch dock from which they are meant to be dispatched. This is why the readInstruction and writeInstruction methods take a "dispatchFrom" argument.


Constructor Summary
Fleet()
           
 
Method Summary
abstract  Instruction decodeInstruction(BitVector instruction, Dock dispatchFrom)
          Decodes an instruction from a BitVector
abstract  BitVector encodeInstruction(Instruction instruction, Dock dispatchFrom)
          Encodes an instruction as a BitVector
abstract  int getSetWidth()
          the width of the immediate field in the "set data latch" instruction
abstract  int getShiftWidth()
          the width of the immediate field in the "shift data latch" instruction
abstract  Ship getShip(String type, int ordinal)
          A ship is uniquely identified by its type (a string) and its ordinal; for example, Fifo[7].
abstract  int getWordWidth()
          the natural word width of this machine
abstract  Iterator<Ship> iterator()
           
 FleetProcess run(Instruction[] program)
          If supported, run the given code and create a FleetProcess to interact with it.
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fleet

public Fleet()
Method Detail

iterator

public abstract Iterator<Ship> iterator()
Specified by:
iterator in interface Iterable<Ship>

getShip

public abstract Ship getShip(String type,
                             int ordinal)
A ship is uniquely identified by its type (a string) and its ordinal; for example, Fifo[7].


getWordWidth

public abstract int getWordWidth()
the natural word width of this machine


getShiftWidth

public abstract int getShiftWidth()
the width of the immediate field in the "shift data latch" instruction


getSetWidth

public abstract int getSetWidth()
the width of the immediate field in the "set data latch" instruction


encodeInstruction

public abstract BitVector encodeInstruction(Instruction instruction,
                                            Dock dispatchFrom)
Encodes an instruction as a BitVector


decodeInstruction

public abstract Instruction decodeInstruction(BitVector instruction,
                                              Dock dispatchFrom)
Decodes an instruction from a BitVector


run

public FleetProcess run(Instruction[] program)
If supported, run the given code and create a FleetProcess to interact with it.