public String toString() { return super.toString()+"shift "+immediate; }
}
+ public static class Flush extends Instruction {
+ public Flush(Dock dock) { this(dock, false, Predicate.Default); }
+ public Flush(Dock dock, boolean looping, Predicate predicate) {
+ super(dock, looping, predicate);
+ if (!dock.isInputDock()) throw new RuntimeException("Flush is only allowed at input docks");
+ }
+ public String toString() { return super.toString()+"flush"; }
+ }
+
/** all communication is performed with this instruction */
public static class Move extends Instruction {
} else if ("shift".equals(tt.head())) {
cb.add(new Shift(dock, looping, predicate,
new BitVector(dock.getShip().getFleet().getWordWidth()).set(number(tt.child(0)))));
+ continue;
+ } else if ("flush".equals(tt.head())) {
+ cb.add(new Flush(dock, looping, predicate));
+ continue;
} else if ("word".equals(tt.head())) {
long literal = 0;
if (tt.child(0).head().equals("CodeBagBody")) {
| "set" ^"flags" "a" "=" Flags "," "b" "=" Flags ";" /ws
| "set" ^"word" "=" Literal ";" /ws
| ^"shift" Literal ";" /ws
+ | ^"flush" ";" /ws
Flags:: = (^"0") | (^"1") | (^"a" | ^"b" | ^"c" | ^"!a" | ^"!b" | ^"!c") +/ (ws "|" ws)
if (P_NOT_B.get(inst)) predicate = NotFlagB;
boolean looping = !OS.get(inst);
+ if (FLUSH.get(inst))
+ return new Flush(dock, looping, predicate);
if (SHIFT.get(inst)) return new Shift(dock, looping, predicate, new BitVector(dock.getShip().getFleet().getWordWidth()).set(SHIFT.getval(inst)));
if (SET_IMMEDIATE.get(inst)) {
boolean extend = SET_IMMEDIATE_EXTEND.getval(inst) != 0;
instr = SHIFT.set(instr);
instr = SHIFT.setval(instr, shift.immediate);
+ } else if (d instanceof Flush) {
+ instr = FLUSH.set(instr);
+
} else if (d instanceof Set) {
Set s = (Set)d;
switch(s.dest) {