*/
public class InstructionStopper extends ProperStopper {
- public InstructionStopper(String name,
- String propInst,
+ private static final int INSTRUCTION_SEND_NDX = 1;
+ private static final int INSTRUCTION_RECIRCULATE_NDX = 0;
+ private final String INSTR_RING_CONTROL_PATH;
+
+ public InstructionStopper(String propInst,
ChainControl controlChain,
ChainControl dataChain,
ChainControl reportChain,
ChipModel model,
boolean clockHack,
Indenter indenter, String counterPath) {
- super(name, propInst, controlChain, dataChain, reportChain, model, clockHack, indenter, counterPath);
+ super(propInst, controlChain, dataChain, reportChain, model, clockHack, indenter, counterPath);
+ INSTR_RING_CONTROL_PATH = propInst+".tapStage@2";
}
/** put one Instruction into InstructionStopper */
MarinaTest.indenter.prln(" inserting torpedo");
super.fill(new MarinaPacket(MarinaPacket.null_word, true, MarinaPacket.null_path));
}
+
+ public void fill(Instruction[] instructions) { fill(instructions, false); }
+ public void fill(Instruction[] instructions, boolean repeat) { fill(instructions, repeat, false); }
+ public void fill(Instruction[] instructions, boolean repeat, boolean leaveStopped) {
+ enableInstructionSend(false);
+ enableInstructionRecirculate(true);
+ for(Instruction i : instructions)
+ if (i!=null) {
+ fill(i);
+ } else {
+ fillTorpedo();
+ }
+ enableInstructionRecirculate(repeat);
+ enableInstructionSend(true);
+ if (!leaveStopped) run();
+ }
+ public void enableInstructionSend(boolean b) {
+ BitVector bv = controlChain.getInBits(Marina.CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+ bv.set(INSTRUCTION_SEND_NDX, b);
+ controlChain.setInBits(Marina.CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
+ controlChain.shift(Marina.CONTROL_CHAIN, false, true);
+ }
+ public void enableInstructionRecirculate(boolean b) {
+ BitVector bv = controlChain.getInBits(Marina.CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH);
+ bv.set(INSTRUCTION_RECIRCULATE_NDX, b);
+ controlChain.setInBits(Marina.CONTROL_CHAIN+"."+INSTR_RING_CONTROL_PATH, bv);
+ controlChain.shift(Marina.CONTROL_CHAIN, false, true);
+ }
}