Lecture 09 Flashcards
What is a control hazard?
When a conditional jump changes which instructions need to be executed.
Instructions already in the pipeline may need to be cancelled.
What does MIPS 32’s ‘branch delay slot’ mean?
The instruction immediately after a branch or a jump will always be executed, regardless of whether the jump happens or not.
Why, in MIPS assembler, is it common to see the ‘nop’ operator directly after a jump?
To avoid the ‘branch delay slot’ from running any other code.
What is branch prediction and why is it useful?
Trying to decide if a branch in a program will be taken or not.
Predicting this can improve the efficiency of the pipeline as the expected instructions can begin loading before the jump.
Assuming a branch is not taken is best practice for:
A - if,then,else statements
B - Loops
If-then-else statements.
Assuming a branch is always taken is best practice for:
A - if,then,else statements
B - Loops
Loops
In MIPS, branch destinations are:
A - Absolute
B - Relative
B - Relative
A jump location is the program counter plus some offset.