public static class Executable extends Instruction {
- public final BenkoBox benkoBox;
- public final BenkoBox dest;
- public final int count;
+ public final BenkoBox benkoBox;
+ public final Destination dest;
+ public final int count;
public final boolean tokenIn;
public final boolean dataIn;
public final boolean recycle;
/** count=0 denotes a standing move */
- public Executable(BenkoBox benkoBox,
- BenkoBox dest,
- int count,
- boolean tokenIn,
- boolean dataIn,
- boolean latch,
- boolean dataOut,
- boolean tokenOut,
- boolean recycle) {
+ public Executable(BenkoBox benkoBox,
+ Destination dest,
+ int count,
+ boolean tokenIn,
+ boolean dataIn,
+ boolean latch,
+ boolean dataOut,
+ boolean tokenOut,
+ boolean recycle) {
this.benkoBox = benkoBox;
this.dest = dest;
this.count = count;
}
public static class Literal extends Instruction {
- public final BenkoBox dest;
- protected Literal(BenkoBox dest) { this.dest = dest; }
+ public final Destination dest;
+ protected Literal(Destination dest) { this.dest = dest; }
public static class Absolute extends Literal {
public final long value;
- public Absolute(BenkoBox dest, long value) { super(dest); this.value = value; }
+ public Absolute(Destination dest, long value) { super(dest); this.value = value; }
public String toString() {
return value + ": sendto " + dest;
}
public static class Relative extends Literal {
/** value transmitted will be offset plus the address from which this instruction was loaded */
public final long offset;
- public Relative(BenkoBox dest, long offset) { super(dest); this.offset = offset; }
+ public Relative(Destination dest, long offset) { super(dest); this.offset = offset; }
public String toString() {
String off = ""+offset;
if (offset > 0) off = "+"+off;
/** address of CBD, relative to address that this instruction was loaded from */
public final long offset;
public final long size;
- public CodeBagDescriptor(BenkoBox dest, long offset, long size) {
+ public CodeBagDescriptor(Destination dest, long offset, long size) {
super(dest); this.offset = offset; this.size = size; }
public String toString() {
String off = ""+offset;
public abstract class InstructionEncoder {
/** get the bits describing this box's location on the DESTINATION HORN */
- public abstract long getBoxAddr(BenkoBox box);
+ public abstract long getBoxAddr(Destination box);
/** get the bits describing this box's location on the INSTRUCTION HORN */
public abstract long getBoxInstAddr(BenkoBox box);
if (d instanceof Instruction.Executable) {
Instruction.Executable inst = (Instruction.Executable)d;
- BenkoBox dest = inst.dest;
+ Destination dest = inst.dest;
instr = dest==null ? 0 : (getBoxAddr(dest) << 1);
if (inst.count >= (1<<8))
throw new RuntimeException("count field must be less than 128");
public void writeInstruction(DataOutputStream os, Instruction d) throws IOException { iie.writeInstruction(os, d); }
private class InterpreterInstructionEncoder extends InstructionEncoder {
- public long getBoxAddr(BenkoBox box) { return ((InterpreterBenkoBox)box).addr; }
+ public long getBoxAddr(Destination box) { return ((InterpreterBenkoBox)box).addr; }
public long getBoxInstAddr(BenkoBox box) { return ((InterpreterBenkoBox)box).instr_addr; }
public BenkoBox getBoxByAddr(long dest) {
for(Ship ship : Interpreter.this)
Alu2.MIN: sendto alu.inOp;
Alu2.MAX: sendto alu.inOp;
-alu.in1: [*] take, deliver;
-alu.in2: [*] take, deliver;
-alu.inOp: [*] take, deliver;
-alu.out:
- [*] take, sendto debug.in;
+alu.in1: [*] take, deliver;
+alu.in2: [*] take, deliver;
+alu.inOp: [*] take, deliver;
+alu.out: [*] take, sendto debug.in;