throw new RuntimeException("abortLoopIfTorpedoPresent() must be followed immediately by a Move");
} else {
instructions.add(new Move(dock,
- count!=1,
predicate,
pending_interruptible,
pending_path==null ? null : pending_path,
public void interruptibleNop() {
flush_pending();
instructions.add(new Move(dock,
- count!=1,
predicate,
true,
null,
public void flush() {
if (!dock.isInputDock()) throw new RuntimeException("flush() may only be used at input docks");
flush_pending();
- instructions.add(new Instruction.Flush(dock, count!=1, predicate));
+ instructions.add(new Instruction.Flush(dock, predicate));
}
/** [outboxes only], will fuse with previous instruction if it was a sendToken() */
flush_pending(true);
}
+ public void literal(String constantName) {
+ literal(dock.getConstant(constantName));
+ }
+
/** sets the data latch to a literal value */
public void literal(BitVector literal) {
// FIXME: code duplication here
for(int i=counter-1; i>=counter-ctx.fleet.getShiftWidth(); i--)
if (i<literal.length())
temp.set(i-(counter-ctx.fleet.getShiftWidth()), literal.get(i));
- instructions.add(new Shift(dock, count!=1, predicate, temp));
+ instructions.add(new Shift(dock, predicate, temp));
counter -= ctx.fleet.getShiftWidth();
}
}
public void literal(long literal) {
flush_pending();
if (((FleetTwoFleet)ctx.fleet).isSmallEnoughToFit(literal)) {
- instructions.add(new Instruction.Set(dock, count!=1, predicate, SetDest.DataLatch, literal));
+ instructions.add(new Instruction.Set(dock, predicate, SetDest.DataLatch, literal));
} else {
int counter = 0;
int extra = 0;
while(counter < dock.getShip().getFleet().getWordWidth()) { extra++; counter += ctx.fleet.getShiftWidth(); }
warn("literal " + literal + " requires " + extra + " instructions");
while(counter > 0) {
- instructions.add(new Shift(dock, count!=1, predicate,
+ instructions.add(new Shift(dock, predicate,
new BitVector(dock.getShip().getFleet().getWordWidth())
.set(getField(counter-1, counter-ctx.fleet.getShiftWidth(), literal))));
counter -= ctx.fleet.getShiftWidth();
public void setFlags(Instruction.Set.FlagFunction newFlagA, Instruction.Set.FlagFunction newFlagB) {
flush_pending();
instructions.add(new Instruction.Set(dock,
- count!=1,
predicate,
newFlagA,
newFlagB));
public void abort() {
flush_pending();
instructions.add(new Instruction.Set(dock,
- count!=1,
predicate,
SetDest.OuterLoopCounter,
0));
boolean blockingInstructionEncountered = false;
// Set the OLC (it might previously have been zero)
- ic.add(new Set(dock, false, Predicate.IgnoreFlagD, SetDest.OuterLoopCounter, count==0 ? 1 : count));
+ ic.add(new Set(dock, Predicate.IgnoreFlagD, SetDest.OuterLoopCounter, count==0 ? 1 : count));
if (count!=1) {
ic.add(new Instruction.Head(dock));
}
throw new RuntimeException("instruction sequence is too long for instruction fifo at " + dock);
} else {
if (count != 0) {
- ic.add(new Instruction.Set(dock, true, Predicate.Default, SetDest.OuterLoopCounter, SetSource.Decrement));
+ ic.add(new Instruction.Set(dock, Predicate.Default, SetDest.OuterLoopCounter, SetSource.Decrement));
if (blockingInstructionEncountered)
numInstructionsNotIncludingNonblockingPrefix++;
loopSize++;
if (count!=1)
ic.add(new Instruction.Abort(dock, Predicate.FlagD));
if (ctx.autoflush && next==null && dock.isInputDock())
- ic.add(new Instruction.Flush(dock, true, Predicate.FlagD));
+ ic.add(new Instruction.Flush(dock, Predicate.FlagD));
// FIXME: need to somehow deal with count!=0 loops that are
// torpedoable; they need to wait for a torpedo to arrive