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

Suppose you have a RISC machine with a 1.9 GHz clock (i.e., the clock ticks 1.9

ID: 3902801 • Letter: S

Question

Suppose you have a RISC machine with a 1.9 GHz clock (i.e., the clock ticks 1.9 billion times per second). This particular computer uses an instruction cache, a data cache, an operand fetch unit, and an operand store unit. The instruction set includes simple instructions with the following timings: set reg, immed 1 clock cycle loop label add reg, immed 3 clock cycle add reg, reg load reg, mem 3 clock cycles 9clock cycles 4 clock cycles Assume that the following code fragment is used to sum the element of a numeric array. If the initialization code has already executed (i.e. the SET instructions have already finished execution) how many array elements can be processed in 4.2 ms? Round your answer to the nearest integer. Recall that 1 ms 0.001 seconds. Also assume that there are no physical memory limitations, implying that the array can be as large as desired set r1, 0 set r2, MAX_SIZE ;initialize loop counter set r3, @list initialize sum ;initialize array pointer more: load r4, [r3 add r1, r4 add r3, 4 Loop more fetch current list element add current list element ;move array pointer to next element ;auto-decrement r2, jump to more if r2!- 0

Explanation / Answer

The first three instruction take 3 clock cycles and inside the loop it takes 9+3+4+3=19 clock cycles. for each element of array

as we know the frequency is 1.9 GHz then we can see 1 clock cycle takes x= 1/(1.9*10^9) secs

Hence the time taken for n elements will be 4.2 ms using which we can find the value of n to be

(3+n*19)*x=4.2 ms

3+19n=4.2*10^6*1.9

Solving which gives us n=420,000 (rounded off value)

Do give a thumbs up

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