If we execute the following MIPS code fragments show only th
If we execute the following MIPS code fragments, show only the changes that occur in the register file and memory at the table of \'After Execution\'. Decimal numbers are used for data and addresses 4. add $1, $2, S3 lw $4, 4($1) sub S3, $5, $4 sw $3, 4($2) lw $2, 8(S3) lw S5, 4(S3) J 100 Before Execution Register File Memor data 100 100 $1 $2 S3 $4 S5 addr 100 104 108 112 116 data 100 120 140 160 180 200 260
Solution
Only changes occured in registers and memory are as abelow:
Register File Memory
# data Addr data
$1 108(i.e.$1=$2+$3) 100 100
$2 $2=180 104 120
$3 $3=140 ($3=$5-$4) 108 140
then on execution of sw
sw $3,4($2)
$3=mem[$2+4]
$3=140
$4 120(i.e.$4=mem[$1+4) 112 160
$4=mem[104]
$4=120
$5 160 116 180
