From: adam Date: Mon, 11 Feb 2008 13:17:33 +0000 (+0100) Subject: fix bugs in handling of DecrLoop operation X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=a993005364d61e393c24fea224dc22a9dc29922b;p=fleet.git fix bugs in handling of DecrLoop operation --- diff --git a/src/edu/berkeley/fleet/api/Instruction.java b/src/edu/berkeley/fleet/api/Instruction.java index 039021e..9a1cb08 100644 --- a/src/edu/berkeley/fleet/api/Instruction.java +++ b/src/edu/berkeley/fleet/api/Instruction.java @@ -76,6 +76,7 @@ public abstract class Instruction { public static class DecrLoop extends Instruction { public DecrLoop(Pump pump) { super(pump); } public boolean isDL() { return true; } + public boolean isLooping() { return true; } } public static class Counter extends Instruction { diff --git a/src/edu/berkeley/fleet/interpreter/InstructionPump.java b/src/edu/berkeley/fleet/interpreter/InstructionPump.java index b5b0960..498a14c 100644 --- a/src/edu/berkeley/fleet/interpreter/InstructionPump.java +++ b/src/edu/berkeley/fleet/interpreter/InstructionPump.java @@ -86,7 +86,7 @@ abstract class InstructionPump extends InterpreterPump { if (executing instanceof Instruction.Counter) { Instruction.Counter ic = (Instruction.Counter)executing; if (ic.source == Instruction.Counter.LOOP_COUNTER && ic.dest == Instruction.Counter.DATA_LATCH) { - setDataLatch(loopCounter); + setDataLatch(oldLoopCounter); /* FIXME: which is correct here? */ } else if (ic.dest == Instruction.Counter.LOOP_COUNTER && ic.source == Instruction.Counter.DATA_LATCH) { loopCounter = (int)peekDataLatch(); } else if (ic.dest == Instruction.Counter.REPEAT_COUNTER && ic.source == Instruction.Counter.DATA_LATCH) { @@ -96,9 +96,9 @@ abstract class InstructionPump extends InterpreterPump { } else if (ic.dest == Instruction.Counter.REPEAT_COUNTER) { repeatCounter = ic.source; } + } else if (executing instanceof Instruction.DecrLoop) { - executing = null; - return; + } else if (executing instanceof Instruction.SetFlags) { Instruction.SetFlags sf = (Instruction.SetFlags)executing; boolean old_s = ((peekDataLatch() >> (getInterpreter().getWordSize()-1)) & 1) != 0;