next up previous
Next: Implementation Dependencies Up: Miscellaneous Previous: NOP Instruction

Halting

When your simulator encounters the ``HALT'' instruction, it should end the simulation. Notice, however, that it is incorrect to halt as soon as the HALT instruction is fetched since this code may be speculative (dependent on a yet to be verified branch). If the branch was mispredicted, then you definitely do not want to halt. Another issue is that any 'sw' instructions which are farther along the pipeline than the halt must be allowed to complete before the machine is stopped. To solve these problems, halt the machine when the HALT instruction reaches the MEMWB pipeline register. This ensures that all previously executed instructions have completed.



MM Hugue 2011-09-24