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

The following program counts the sum of even numbers inside a given array?: (a)

ID: 3690885 • Letter: T

Question

The following program counts the sum of even numbers inside a given array?:

(a) Load the program above into SPIM-CACHE. Configure the cache settings to be 256-B size, 16-B line size, and four-way set associative. Run the program and record the results (i.e. the status of each register).
(b) Write down the contents of data cache after the program is completed. Explain in details how the elements of Array_A are mapped to each slot in the data cache.
(c) Write down the contents of the instruction cache after the program is completed. Explain in detail how the contents are obtained through executing the program.

# Calculate the sum of even numbers inside a given array data 0x10000480 ArraVA: word 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 text globl main main. la $tl, ArrayiA li $t2, 0 li $t3, 12 li $t4, 1 loop: # number of elements in ArrayA # mask lw $t5, 0 ($t1) and $t6, $t5, $t4 beq t6, $t4, cont add $t2, $t2, $t5 cont: addi $tl, $t1, 4 addi $t3, $t3, -1 bgt $t3, $0, loop li $vO, 10 syscal.l

Explanation / Answer

(b.)

(c.)