Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose we have 10,000 lines in our program and our computer system has four pip

ID: 3832547 • Letter: S

Question

Suppose we have 10,000 lines in our program and our computer system has four pipeline stages. Part (a): How many cycles would it take to run the entire program if there were no stalls? (Ideal pipeline) Now, suppose our 10,000 line program has following characteristics: 5% of instructions are memory writes, and the cache hit rate is 90%. Reading contiguous data from one single memory location takes 12 clock cycles (no matter the size of data read). Writing contiguous data to main memory takes 10 clock cycles (no matter the size of data written). Reading from and writing to main memory cannot take place simultaneously. Assume that the cache block size is 8 words. Part (b) How many additional cycles would be caused by memory write instructions if write back and write-allocate policy is implemented? Assume that when a cache entry needs to be replaced, 40% of the time the dirty bit is 1. Part (c): How many additional cycles are caused by memory writes if write-through and no-write-allocate policy is implemented?

Explanation / Answer

Part(a):-

In the part (a), I have designed the ideal pipeline which executes the no. of stages for each iteration along with the desired no. of instruction steps with comments and output of it.

Ideal Pipeline:

// Lets start writing the instruction steps for decoding stage which counts the No. of cycles.

// Begin with Cycle 0 as initial state

Cycle 0 – Firstly it is not yet decoded anything, then ADDIU value is obtained at earliest.


// In Cycle 1, Start adding the decoded using Add Mnemonics

1 – Add is decoded


// In Cycle 2, The LB value is being used to laod the byte and then decode it

2 – LB is decoded

// In Cycle 3, The value is being jumps or branch if Equals if you set any flag

3 – BEQ is decoded

// In Cycle 4, The value is being jumps or branch if Equals if you set any flag

4 – BEQ is decoded again, The reason is because the LoadByte is still in memory stage occupation.

// In Cycle 5, The BEQ FIELD is being jumps or branch if Equals if you set any flag

5 – BEQ is decoded again, Finally it executed in the writeback operation

// In Cycle 6, The ADDIU Value is decoded

6 – ADDIU $2 is decoded

// In Cycle 7, The ADDIU Value is being assigned and decoded

7 – ADDIU $4 is decoded again

// In Cycle 8, The LB value is being used to laod the byte and then decode it

8 – LB is decoded in the last stage of execution

// In Cycle 9, The LB value is decoded again and again.

9 – LB is decoded again by executing in memory operation using ADDIU stage

// In Cycle 10, The LB value is being used to laod the byte and then decode it

10 – LB is decoded again, Finally it executed in the writeback operation

// In Cycle 11, The BEQ FIELD is being jumps or branch if Equals if you set any flag

11 – BEQ value bottom is decoded

// In Cycle 12, The jump register is decoded

12 – JR is decoded

// In Cycle 13, The BEQ FIELD is being jumped

13 – BEQ near top is decoded and it wont support Writeback operation

The Cycles from 6 – 13 (8 cycles) will be recycled again and again for ‘x’, then ‘l’, then ‘l’, then ‘o’, which finally makes the value as 8*4 = 32 cycles more.
Next step is to start trailing, ‘0’,We will fetch the last branch to be considered.

Output:

The final total value is : 13 + 32 + 1 + 1 + 3 = 50 cycles

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote