Question: You have a cache that holds 4 blocks, each block is 4 Words. Initially the cache is empty ( e . g . all blocks

You have a cache that holds 4 blocks, each block is 4 Words. Initially the cache is empty (e.g. all blocks are invalid). The Main Memory is shown in the table below and is byte addressable.
For the loop given in the assembly code below, what is the final data in the cache assuming (a) direct mapped (b)2-way set associative and (c) fully associative? Empty tables for each type of
cache are below. Write a description of how each cache works (hits and misses) and how you reached your end result.
LOOP: lw \$s0,0(\$s3)
addi \$s1,\$s3,64
\# \$s0= Array[i]
add \$s2,\$s2,\$s0
sw \$s2,0(\$s1)
\# \$s1=\$s3+64
\# \$s2=\$s2+\$s0
addi \$s3,\$s3,4
\# Array[i+16]=\$s2
bne \$s2,\$s4, L00P
\# \$s3=\$s3+4
\# branch if (\$s2!=\$s4)
Initial values of the registers:
\[
\begin{array}{l}
\$ s 2=0\\
\$ s 3=0\times 0000\\
\$ s 4=120
\end{array}
\]
You have a cache that holds 4 blocks, each block

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!