ECM 1413 Pipelining Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

The instruction cycle in the CPU divided into 3 stages

A

1) Fetch - Read an instruction from memory
2) Decode - identify the instruction
3) Execute - carry out the instruction

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

(Non-pipelined FDE cycle)
Rate of instruction execution =

A

Number of instructions * pipeline Stages
N*S clock cycles

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

(pipelined FDE cycle)
Rate of instruction execution =

A

Number of instructions + pipeline Stages - 1
N + S − 1 clock cycles

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

The clock cycle time of a CPU is

A

the time it takes to complete one pipelining stage

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

Clock speed =

A

1/Clock cycle time

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

Execution time

A

Clock cycles for program × Clock cycle time

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

The performance gains of pipelining are limited by:

A

1 control hazards
2 data hazards

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

What is a control hazard

A

A control hazard occurs when a (conditional) branch instruction changes the next instruction.

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

There are four ways to deal with control hazards:

A

(a) stall the pipeline
(b) assume branch not taken
(c) branch prediction
(d) branch delay slots

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

Control Hazard Management Method: Stall the Pipeline

A

The processor may stall the pipeline; when we realise that the next instruction is a branch instruction, stop the next instructions.

Pros: We don’t need to guess the next instruction
Cons: Time and resources are wasted

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

Control Hazard Management Method: Assume Branch Not Taken

A

The processor may assume branch not taken, squashing instructions if wrong.

Pros: We don’t need to guess the next instruction
Cons: Time and resources are wasted whenever the branch is taken

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

Control Hazard Management Method: Branch Prediction

A

The processor may try branch prediction based on past branches. If the prediction is incorrect, instructions are squashed.

Pros: Can significantly reduce the number of wasted clock cycles
Cons: Overhead associated with the branch prediction

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

Branch History Tables

A

Branch prediction is performed using branch history tables. The branch history can be:
- One bit to describe whether the branch was taken the last time
- Two bits to describe four different “branch prediction states”

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

Control Hazard Management Method: Branch Delay Slots

A

A branch instruction may be followed by delay slots (these are always executed).

Pros: May find useful instructions, e.g., when paths (taken/not taken) join
Cons: If no useful instruction is found, fill the slot with “No operation”

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

When does a data hazard occur

A

A data hazard occurs when an instruction requires a result from a previous instruction before that result has been computed/written

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

Solutions to Data Hazards:

A

1) Stall the pipeline
2) Out-of-order execution

More pipeline stages means a larger penalty for incorrect branch predictions a bigger risk of data hazards