Lecture 09 Flashcards

1
Q

What is a control hazard?

A

When a conditional jump changes which instructions need to be executed.
Instructions already in the pipeline may need to be cancelled.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does MIPS 32’s ‘branch delay slot’ mean?

A

The instruction immediately after a branch or a jump will always be executed, regardless of whether the jump happens or not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why, in MIPS assembler, is it common to see the ‘nop’ operator directly after a jump?

A

To avoid the ‘branch delay slot’ from running any other code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is branch prediction and why is it useful?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Assuming a branch is not taken is best practice for:
A - if,then,else statements
B - Loops

A

If-then-else statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Assuming a branch is always taken is best practice for:
A - if,then,else statements
B - Loops

A

Loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In MIPS, branch destinations are:
A - Absolute
B - Relative

A

B - Relative

A jump location is the program counter plus some offset.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly