;;
fifo2.out --> alu.inOp, alu.in1, alu.in2
alu.out --> debug.in
+ while alu.out > 3 {
+ 3 --> debug.in
+ }
/*
double(a -> out) =
package edu.berkeley.fleet.api;
-public interface Destination {
+public abstract class Destination {
/** return the Ship to which this BenkoBox belongs */
- public Ship getShip();
+ public abstract Ship getShip();
/**
* this returns the third component of the name; that is in
* "ship.port.foo", it returns "foo", and in "ship.port" it
* returns ""
*/
- public String getDestinationName();
+ public abstract String getDestinationName();
}
// and make note of the fact that we need to send an ack (if requested)
if (instruction.tokenOut)
- bufferedAck = new Packet(getInterpreter(), this, 0, (InterpreterBenkoBox)instruction.dest);
+ bufferedAck = new Packet(getInterpreter(), this, 0, (InterpreterDestination)instruction.dest);
} else if (instruction.tokenOut) {
// if dataOut is not set, we can send the data immediately
- new Packet(getInterpreter(), this, 0, (InterpreterBenkoBox)instruction.dest).send();
+ new Packet(getInterpreter(), this, 0, (InterpreterDestination)instruction.dest).send();
}
return true;
}
import java.util.*;
/** anything that has a destination address on the switch fabric */
-public abstract class InterpreterBenkoBox extends BenkoBox implements InterpreterDestination {
+public abstract class InterpreterBenkoBox extends BenkoBox {
private final String name;
private final InterpreterShip ship;
this.ports = new Destination[ports.length];
for(int i=0; i<ports.length; i++)
this.ports[i] =
- ports[i].equals("")
- ? this
- : new InterpreterBenkoBoxDestination(ports[i]);
+ new InterpreterBenkoBoxDestination(ports[i]);
}
public Iterable<Destination> getDestinations() {
private static int max_addr;
- private class InterpreterBenkoBoxDestination implements InterpreterDestination {
+ private class InterpreterBenkoBoxDestination extends InterpreterDestination {
public String name;
public long addr = max_addr++;
public InterpreterBenkoBoxDestination(String name) { this.name = name; }
import edu.berkeley.fleet.api.*;
import java.util.*;
-interface InterpreterDestination extends Destination {
- public long getDestAddr();
- public void addDataFromFabric(Packet packet);
- public String getDestinationName();
+abstract class InterpreterDestination extends Destination {
+ public abstract long getDestAddr();
+ public abstract void addDataFromFabric(Packet packet);
+ public abstract String getDestinationName();
}
\ No newline at end of file
} else if (instruction.tokenOut) {
// if no item was sent, we might still send an ack
- new Packet(getInterpreter(), this, 0, (InterpreterBenkoBox)instruction.dest).send();
+ new Packet(getInterpreter(), this, 0, (InterpreterDestination)instruction.dest).send();
}
return true;
public void writeInstruction(DataOutputStream os, Instruction d) throws IOException { iie.writeInstruction(os, d); }
private class SlipwayInstructionEncoder extends InstructionEncoder {
- public long getDestAddr(Destination box) {
- long ret;
- if (box instanceof SlipwayBenkoBox)
- ret = ((SlipwayBenkoBox)box).addr;
- else
- ret = ((SlipwayBenkoBox.VirtualPort)box).addr;
- return ret;
- }
+ public long getDestAddr(Destination box) { return ((SlipwayBenkoBox.VirtualPort)box).addr; }
public long getBoxInstAddr(BenkoBox box) { return ((SlipwayBenkoBox)box).instr_addr; }
public Destination getDestByAddr(long dest) {
for(Ship ship : Slipway.this)
ports = newports;
}
- public class VirtualPort implements Destination {
+ public class VirtualPort extends Destination {
public String name;
public VirtualPort(String name) { this.name = name; }
public String getDestinationName() { return name; }