Assignment 7
Due: 9:10am, at the start of class, Thu Nov 9th, 2006
Note: Make reasonable assumptions where necessary and clearly state them.
Each of the 8 problems is worth an equal number of points.
Feel free to discuss problems with classmates, but the only written material
that you may consult while writing your solutions are the textbook
and lecture slides.
You may hand in solutions on paper at the start of class. You may also hand in
homeworks electronically on one of the CADE Lab machines. Place your solution
in a text file called "homework7" (if you use a different file name, our
print script may not find it) and use the following command:
handin cs3810 hw7 homework7
- For the simple 5-stage pipeline discussed in class, with no bypassing,
identify the number of idle cycles that have to be introduced between the
following pairs of instructions. It is not enough to just show the number --
you have to show when values are produced and consumed within the pipeline.
- add $1, $2, $3 ; add $4, $1, $2
- lw $1, 8($2) ; add $4, $1, $2
- lw $1, 8($2) ; lw $4, 4($1)
- lw $1, 8($2) ; sw $4, 4($1)
- lw $1, 8($2) ; sw $1, 4($4)
Repeat the above question, but with a 5-stage pipeline that does
allow bypassing.
- Consider the following pipeline that is 8 stages long:
IM-Fetch-stage1 : IM-Fetch-stage2 : RegRead : ALU-stage1 : ALU-stage2 : DataMem-stage1 : DataMem-stage2 : RegWrite
Essentially, all stages in the 5-stage pipeline (except register
accesses) have been broken into two stages. The register file has
separate read and write ports that allow simultaneous reads and
writes. Assume that the pipeline has full bypassing.
- How many idle cycles are introduced between the following two
instructions:
add $1, $2, $3
add $4, $1, $2
- How many idle cycles are introduced between the following two
instructions:
lw $1, 8($2)
add $4, $1, $2
- Consider a program that is composed of an alternating sequence
of the following two instructions:
add $1, $2, $2
lw $2, 8($1)
What is the average CPI of this program in the basic 5-stage
pipeline (with bypassing)? What is the average CPI of this program in the 8-stage
pipeline? If the 8-stage pipeline has a clock speed that is twice as
much as the 5-stage pipeline, does it provide higher overall
performance?