1
ECE/CS 314 Spring 2008
Hung Dang (hvd2)
Homework 5
Due Tuesday, April 8, 2008
before
10:00pm EST
Problem 1.
(40 points)
The Branch Control is an integral part of the pipelined processor.
The
text devotes a
great deal of discussion to the placement of the Branch Control, suggesting at various
times that it can be placed in the ID, EX, or MEM stages, but leaving the optimal
placement of this important unit somewhat vague, at best.
a)
What are the advantages and disadvantages of placing the Branch Control in the
ID stage?
Consider the effect on data hazards, control hazards, and overall
performance.
Give specific examples, where appropriate, to illustrate these
advantages and/or disadvantages.
Advantages: It improves branch performance and reduces the cost (control
hazards) of the taken branch to one instruction.
Disadvantages: Moving branch control to ID stage results in two main
complications: computing branch target address and evaluating branch decision.
Branch adder must move to the ID stage and additional forwarding and hazard
detection hardware are needed. For example, to implement branch-on-equal the
results must be forwarded to the equality test logic that operates during ID. In
addition, because the values in a branch comparison are needed during the ID
stage but may be only available at a later time, data hazard can occur and a stall
might be needed.
b)
What are the advantages and disadvantages of placing the Branch Control in the
EX stage?
Consider the effect on data hazards, control hazards, and overall
performance.
Give specific examples, where appropriate, to illustrate these
advantages and/or disadvantages.
Advantages: Compare to the hardware (for forwarding and hazard detection)
needed for placing the Branch Control in the ID stage, there is less needed if the
Branch Control is placed in the EX stage since a branch dependent on a result
would no longer be in the pipeline. Compare to placing the Branch Control in the
MEM stage, there is relatively less flushing, and at most there is only one
instruction in the pipeline that is needed to be discarded when the branch is not
taken since the branch logics would be evaluated a stage earlier.
This
preview
has intentionally blurred sections.
Sign up to view the full version.
2
Disadvantages: Flushing controls are needed or a “nop” has to be fed in the IF
stage if branch is not taken. Forwarding and hazard detection hardware are still
needed.
c)
What are the advantages and disadvantages of placing the Branch Control in the
MEM stage?
Consider the effect on data hazards, control hazards, and overall
performance.
Give specific examples, where appropriate, to illustrate these
advantages and/or disadvantages.
Advantages: Continuing execution of sequential instructions after branching
instruction until the next PC for a branch is selected in MEM stage is the
equivalence of assuming branch is not taken. If branches are untaken half the time
and it costs little to discard instructions that are already in the pipeline, then
having the branch control in MEM stage can halves the cost of control hazards
thus improving overall performance.

This is the end of the preview.
Sign up
to
access the rest of the document.
- Spring '07
- MCKEE/LONG
- Processor register, Dr. Dre, ID/EX EX/MEM MEM/WB, IF/ID ID/EX EX/MEM
-
Click to edit the document details