Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. We have a 5-stage pipeline: IF instruction fetch ID instruction decode and read registers EX execute instruction or calculate address MEM access memory WB

1. We have a 5-stage pipeline:

IF instruction fetch

ID instruction decode and read registers

EX execute instruction or calculate address

MEM access memory

WB write results to registers

For each of the following blocks of code, (i) determine if there are any data hazards. Support this with a diagram showing the instructions moving through the pipeline. Show the hazards on the diagram. (ii) if there are pipeline hazards, for how many stages would the pipeline stall? (iii) if there are pipeline hazards, reorder the code given to avoid them without introducing new hazards while still accomplishing the same result. Dont add any additional code either.

(a)

ADD R1, R2, R3

STR R2, [R5]

STR R3, [R6]

MUL R4, R1, R2

ADD R7, #4

(b)

ADD R2, #4

LSL R4, #5

LDR R1, [R2]

LDR R3, [R2]

SUB R5, #2

SUB R6, #3image text in transcribed

1. We have a 5-stage pipeline IF - instruction fetch ID instruction decode and read registers EX - execute instruction or calculate address MEM- access memory WB write results to registers For each of the following blocks of code, (i) determine if there are any data hazards. Support this with a diagram showing the instructions moving through the pipeline. Show the hazards on the diagram (ii) if there are pipeline hazards, for how many stages would the pipeline stall? (iii) if there are pipeline hazards, reorder the code given to avoid them without introducing new hazards while still accomplishing the same result. Don't add any additional code either (a ADD R1, R2, R3 STR R2, [R5] STR R3, [R6] MUL R4, R1, R2 ADD R7 , #4 ADD LSL R4, #5 LDR R1, [R2] LDR R3, [R2] SUB R5 , #2 SUB R6 , #3 (b) R2 , #4

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

9. Describe the characteristics of power.

Answered: 1 week ago

Question

10. Describe the relationship between communication and power.

Answered: 1 week ago