- case Flags: {
- boolean new_flag_a = false;
- boolean new_flag_b = false;
- for(Predicate p : set.newFlagA)
- switch(p) {
- case FlagA: new_flag_a |= flag_a; break;
- case FlagB: new_flag_a |= flag_b; break;
- case FlagC: new_flag_a |= flag_c; break;
- case NotFlagA: new_flag_a |= !flag_a; break;
- case NotFlagB: new_flag_a |= !flag_b; break;
- case NotFlagC: new_flag_a |= !flag_c; break;
+ } else if (instructions.peek() instanceof Instruction.Abort) {
+ requeueStageInCirculatingState = false;
+ // HACK
+ while (instructionsBackedUpIntoSwitchFabric.size()!=0) {
+ Instruction i = instructionsBackedUpIntoSwitchFabric.remove();
+ addInstruction(i);
+ instructionsBackedUpIntoSwitchFabric.clear();
+ }
+ break;
+
+ } else if (instructions.peek() instanceof Instruction.Flush) {
+ flushing = true;
+ break;
+
+ } else if (instructions.peek() instanceof Instruction.Shift) {
+ Instruction.Shift shift = (Instruction.Shift)instructions.peek();
+ for(int i=dataLatch.length()-1; i>=getShip().getFleet().getShiftWidth(); i--)
+ dataLatch.set(i, dataLatch.get(i-getShip().getFleet().getShiftWidth()));
+ BitVector shift_immediate = shift.immediate.getBitVector();
+ for(int i=getShip().getFleet().getShiftWidth()-1; i>=0; i--)
+ dataLatch.set(i, shift_immediate.get(i));
+ break;
+
+ } else if (instructions.peek() instanceof Instruction.Set) {
+ Instruction.Set set = (Instruction.Set)instructions.peek();
+ switch(set.dest) {
+ case DataLatch: dataLatch.setAndSignExtend(set.immediate);
+ break;
+ case InnerLoopCounter:
+ switch(set.source) {
+ case Infinity: ilc = -1; break;
+ case Immediate: ilc = (int)set.immediate; break;
+ case DataLatch:
+ ilc = 0;
+ for(int i=0; i<((FleetTwoFleet)getShip().getFleet()).SET_ILC_FROM_IMMEDIATE.valmaskwidth-1; i++)
+ if (dataLatch.get(i))
+ ilc |= (1 << i);
+ break;
+ default: throw new RuntimeException("impossible");