Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 beq $ 2 , $ 0 , endloop 2 add $ 3 , $ 0 , $ 1 3 add $ 4 , $

1 beq $2, $0, endloop
2 add $3, $0, $1
3 add $4, $2, $0
4 loop : addi $4, $4,1
5 lw $13,0( $3)
6 s l t $14, $13, $0
7 bne $14, $0, e n d i f
8 sub $15, $13, $4
9 sw $15,0( $3)
10 e n d i f : addi $3, $3,4
11 bne $4, $0, loop
12 endloop : j r $31
For this question assume that pipelining has been
implemented. Assume that each stage takes 1 cycle to complete.
a) Identify the pipeline hazards present in this code, i.e. situations that would generate stall bubbles. In the case of data hazards, identify the two lines of code involved.
(b) Assume that this program is run using the array frontend, and
that register $1 contains the address of the first element of the
array, and $2 contains the size of the array. Assume that the size
of the array is 2, and that the numbers [4,-7] have been
placed in the array. Assuming that no pipeline optimizations
have been implemented, i.e. no forwarding or branch prediction,
determine the number of cycles it takes to complete the
execution of this program.
Justify your answer using a pipeline diagram formatted like the
picture attached. It may be helpful to use a spreadsheet to draw the diagram.
(c) Suppose forwarding and static branch prediction have been
implemented. Given the same array, when compared to the
answer in part (b):
how many cycles would be saved due to forwarding?
how many cycles would be saved due to static branch
prediction?
Consider each case (forwarding and branch prediction)
separately. In each case, identify which lines of stall bubbles
from your diagram in part (b) will be eliminated.
(d) Suppose you ran the same code with an array
[-5,0,2,-8,3]. Would there be any difference between the
number of stall bubbles saved using static branch prediction
compared to the number of stall bubbles saved using dynamic
branch prediction for the branch instruction at Line 7?
Briefly justify your answer.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions

Question

How does an SVC differ from a PVC?

Answered: 1 week ago

Question

3. Identify challenges to good listening and their remedies

Answered: 1 week ago

Question

4. Identify ethical factors in the listening process

Answered: 1 week ago