logo

Crowdly

Browser

Add to Chrome

Structural hazard A  structural hazard occurs when two or more instructions t...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Structural hazard

A structural hazard occurs when two or more instructions that are in different phases of the execution request access to the same hardware resource (memory, execution unit, etc.). In MIPS it can be easily observed when you are using the  floating point division unit. The program below can be used to illustrate that situation.

    .data

A:    .word 3

v:    .double

0.0

x:    .double 10.0

y:    .double

5.0

z:    .double 0.0

    

 

  .text

main:    l.d f2,x(r0)      ;f2=x

   

l.d f3,y(r0)      ;f3=y

    

    div.d

f5,f3,f2    ;f5=x/y

    div.d f6,f2,f3  

 ;f6=y/x

    add.d f8,f5,f6  

 ;f8=(x/y)+(y/x)

    

    add.d

f4,f3,f3

    mul.d f7,f13,f2

    mul.d

f13,f2,f4

    mul.d f9,f4,f13

 

  

    s.d f8,z(r0)

    s.d f9,v(r0)

    halt

Analyze that program and manually calculate how many clock cycles are needed to execute it on a sequential processor. 

Let assume that the execution of any instruction takes 5 clock cycles,

the execution of div.d instruction takes additional 23 clock cycles,

mul.d takes additional 6 clock cycles, add.d takes additional 3 clock cycles.

How many clock cycles are needed to execute this program on a sequential processor?

More questions like this

Want instant access to all verified answers on moodle.lab.ii.agh.edu.pl?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome