Question: Given an array of 2 integers, write a program to implement the following C code that appends elements to the array: // Declaration of variables

Given an array of 2 integers, write a program to implement the following C code that appends elements to the array:

// Declaration of variables int* A; // Integer array A with the base address pointing to variable A int a; char b, c; short d; // Append array elements { A[3], A[2] } = A[1] * A[0]; A[4] = A[2] / 230; a = A[2] % 230; b = a >> 16; // '>>' = right shift c = a & 8; // '&' = bit-wise and d = a  
Registers Variables
$s0 A
Addresses Contents
$s0 A[0]
$s0+4 A[1]

You may use any temporary registers from $t0 to $t9 or saved registers from $s1 to $s7. Clearly specify your choice of registers and explain your code using comments (5 points).

Example Test: If the values of $s1 through $s7 are initialized in the simulator as:

Registers Data
$s0 4000
Addresses Contents
4000 4
4004 5

the resultant array is:

Addresses Contents
4000 4
4004 5
4008 20
4012 0
4016 0
4020 80

Given an array of 2 integers, write a program to implement the

WHERE IS THE ERROR IN MY CODE:

lw $s1, 0($s0) lw $s2, 4($s0) mul $s3, $s1, $s2 sw $s3, 8($s0) addi $t0, $zero, 230 div $s3, $t0 mflo $s4 mfhi $s7 srl $s5, $s4, 16 andi $s6, $s7, 8 sll $s7, $s7, 2 or $s1, $s5, $s6 or $s1, $s1, $s7 sw $s4, 12($s0) sw $s6, 16($s0) sw $s1, 20($s0)

ng storage

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 Databases Questions!