X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Ffleet%2Finterpreter%2FInterpreterDestination.java;h=df86579d7b97448f9b687c75b90901fe94e021ba;hb=66fddc1edfcfa1fa63b7a8e94f9cda45ac78d715;hp=49b56a6463acf136a6a9622b0a3d036115ec17fc;hpb=49a7a90ead986c8e476682442afbebab56b029e3;p=fleet.git diff --git a/src/edu/berkeley/fleet/interpreter/InterpreterDestination.java b/src/edu/berkeley/fleet/interpreter/InterpreterDestination.java index 49b56a6..df86579 100644 --- a/src/edu/berkeley/fleet/interpreter/InterpreterDestination.java +++ b/src/edu/berkeley/fleet/interpreter/InterpreterDestination.java @@ -4,18 +4,10 @@ import java.util.*; abstract class InterpreterDestination extends Destination { - private static int max_dest = 0; - - int addr; - - private boolean isInstructionDestination; - - public InterpreterDestination(InterpreterDock d, boolean isInstructionDestination) { + public InterpreterDestination(InterpreterDock d) { super(d); - this.isInstructionDestination = isInstructionDestination; - synchronized(InterpreterDestination.class) { - this.addr = max_dest; - max_dest++; + synchronized(d.getInterpreter()) { + this.serialNumber = d.getInterpreter().maxAllocatedDestinationSerialNumber++; } } @@ -23,4 +15,14 @@ abstract class InterpreterDestination extends Destination { public abstract void addDataFromFabric(Packet packet); public abstract String toString(); + /** + * The Fleet instruction encoding mechanism assumes that each + * source->dest path can be turned into a bitstring, and that the + * bitstring gives sufficient information to route the packet. + * Therefore, the interpreter assigns a "serial number" to every + * InterpreterDestination in a fleet and uses the serial number + * of the destination as the path. + */ + private int serialNumber; + int getSerialNumber() { return serialNumber; } }