Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following code fragment is executed on a CPU with a 5stage pipelined datapath with no pipeline forwarding. Assume that this CPU has separate instruction

image text in transcribed
image text in transcribed
The following code fragment is executed on a CPU with a 5stage pipelined datapath with no pipeline forwarding. Assume that this CPU has separate instruction and data memory and avoids all structural hazards. add $1, $3, $2 1w $7, 4204$11 sub $7, $3, $4 sub $2, $4, $5 bne $4, $5, End 1w $7, 4554$21 add $7, $3, $1 addi $12, $0, 14 End: Part A [5 points}: Identify all data hazards, loaduse hazards and control hazards. Are any hazards conditional upon whether or not the branch is taken? If so, identify them. Part 31:5 points}: Rewrite the code to avoid all data, load-use and control hazards by inserting nops. How many cycles does the code take to execute when the branch is taken? How about when it is not taken? Part (31:5 points}: Can you improve your code from Part B by removing some of the nop instructions and instead eliminating one or more hazards by reordering the instructions? If so, write the improyed code. Part D {5 points}: Now suppose that we add pipeline forwarding to the architecture. Write a nal version of the code based on your answer to Part C, removing any instructions that are no longer necessary. How many cycles does the code take to execute when the branch is taken? How about when the branch is not tal-cen

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

Calculus Single Variable

Authors: Deborah Hughes Hallett, Deborah Hughes Hallet, Andrew M Gleason, William G McCallum, Daniel E Flath, Patti Frazer Lock, David O Lomen, David Lovelock,

6th Edition

1118748611, 9781118748619

More Books

Students also viewed these Mathematics questions

Question

Draw the bode plot for the network function. Explain.

Answered: 1 week ago

Question

Be straight in the back without blowing out the chest

Answered: 1 week ago

Question

Wear as little as possible

Answered: 1 week ago

Question

Be relaxed at the hips

Answered: 1 week ago