Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a) Count the total number of instructions executed by the above MIPS program for all iterations. Hint: count the number of iterations in the outer

a) Count the total number of instructions executed by the above MIPS program for all iterations. Hint: count the number of iterations in the outer and inner loops.

b) Count the number of clock cycles it take to execute the above MIPS program for all iterations.

image text in transcribed

The following MIPS program reads two arrays A and B from memory, computes and writes a third array C in memory. Each array consists of 200 integer words. The addresses of arrays A, B, C are stored in registers $a0, $a1, and $a2 respectively. li $a3, 200 # $a3 = 200 elements li $t8, # $t8 = 0 li $t9, 10 # $t9 = 10 outer: move li li $to, ($a0) $t1, $a1 $t4, 6 $t5, 6 # outer loop # load word from array A # $t1 = address of Array B # $t4 = 0 # $t5 = 6 inner: lu mul div mfhi add addi addi bne $t2, ($1) $t2, $t2, $t0 $t2, $t9 $t3 $t4, $t4, $t3 $t1, $t1, 4 $t5, $t5, 1 $t5, $a3, inner # inner loop # load a word from array B # $t2 = $t2 * $to # divide $t2 by 10 # $t3 = HI = remaindec # $t4 = $t4 + $t3 # address of next element in B # increment counter # end of inner loop SW $t4, ($a2) # store $t4 in array ( addi $a0, $ao, 4 # address of next element in A $a2, $a2, 4 # address of next element in C $t8, $t8, 1 # increment counter bne $t8, $a3, outer # end of outer loop The above code is executed on a multi-cycle (not pipelined) processor with a 4 GHz clock that requires the following number of cycles for each instruction: addi addi Instruction Cycles 4 li, move, add, addi, mhi ly 6 SWA 5 mul 10 div 20 bne 3

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

why we face Listening Challenges?

Answered: 1 week ago

Question

what is Listening in Context?

Answered: 1 week ago