Computer Architecture Final Pipelining
Exam with Complete Solutions
Define: Control hazard - ANSWER-The term 'control' refers to program control using if-
else statements; which corresponds to using 'branch' instructions in assembly. When '
branch' instruction enters the pipeline, it takes a few clock cycles to know branch
decision. If the branch is not taken, we should process the instructions at PC+4,
PC+8....If the branch is taken, then we should process the the instructions that are
located at the branch address.
Define: Data hazard - ANSWER-This is a conflict over data. An instruction needs a data
that hasn't been computed yet
Define: Structural hazard - ANSWER-conflict over a component. For example, there are
2 instructions in the datapath that need to access the memory in the same clock cycle.
This is a problem since the memory can be accessed by one instruction only during a
clock cycle.
Do small CPUS have pipeline? - ANSWER-No, they have multicycle instead.
How many cycles does each stage of the pipeline take? - ANSWER-1 clock cycle
If the compiler insets the nops, what happens? - ANSWER-Compiler would have to
know the hardware structure. Recompile for different hardware.
If the hardware inserts the nops, what happens? - ANSWER-Each hardware
(CPU)inserts as many nops as it needs
If there is a Load, R-type dependence what fixes can we do? - ANSWER-Insert 2 nops
or insert 1 nop & forward WB->EX
If there is a R-type, R-type dependence what fixes can we do? - ANSWER-Insert 2 nops
or Forward MEM- >EX
In single cyle and multicycle datapaths, how many instructions are in the datapath? -
ANSWER-one. When the instruction finished, the next one gets into the datapath
Is it possible to keep the pipeline full at all times? - ANSWER-No
Is pipelined datapath similar to single cycle or multicycle? - ANSWER-Multi cycle
because they both have stages and multi-clocks per instruction.
True or False. An instruction can skip from EX to WB. - ANSWER-False, since an
instruction may already be in WB if other instructions were already processed.
Exam with Complete Solutions
Define: Control hazard - ANSWER-The term 'control' refers to program control using if-
else statements; which corresponds to using 'branch' instructions in assembly. When '
branch' instruction enters the pipeline, it takes a few clock cycles to know branch
decision. If the branch is not taken, we should process the instructions at PC+4,
PC+8....If the branch is taken, then we should process the the instructions that are
located at the branch address.
Define: Data hazard - ANSWER-This is a conflict over data. An instruction needs a data
that hasn't been computed yet
Define: Structural hazard - ANSWER-conflict over a component. For example, there are
2 instructions in the datapath that need to access the memory in the same clock cycle.
This is a problem since the memory can be accessed by one instruction only during a
clock cycle.
Do small CPUS have pipeline? - ANSWER-No, they have multicycle instead.
How many cycles does each stage of the pipeline take? - ANSWER-1 clock cycle
If the compiler insets the nops, what happens? - ANSWER-Compiler would have to
know the hardware structure. Recompile for different hardware.
If the hardware inserts the nops, what happens? - ANSWER-Each hardware
(CPU)inserts as many nops as it needs
If there is a Load, R-type dependence what fixes can we do? - ANSWER-Insert 2 nops
or insert 1 nop & forward WB->EX
If there is a R-type, R-type dependence what fixes can we do? - ANSWER-Insert 2 nops
or Forward MEM- >EX
In single cyle and multicycle datapaths, how many instructions are in the datapath? -
ANSWER-one. When the instruction finished, the next one gets into the datapath
Is it possible to keep the pipeline full at all times? - ANSWER-No
Is pipelined datapath similar to single cycle or multicycle? - ANSWER-Multi cycle
because they both have stages and multi-clocks per instruction.
True or False. An instruction can skip from EX to WB. - ANSWER-False, since an
instruction may already be in WB if other instructions were already processed.