Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

1 2 . 1 2 Zylab 1 - ALU and Data Transfer Instructions Given an array of 2 integers, write a program to implement the

12.12 Zylab 1- ALU and Data Transfer Instructions
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 <<2; //'<<'= left shift
A[5]={b, c, d}; //{}= concatenation
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
$s04000
Addresses Contents
40004
40045
the resultant array is:
Addresses Contents
40004
40045
400820
40120
40160
402080
Note: Use the '+' button under the Registers display to initialize register values for $s0 and the '+' button under the Memory display to initialize the first two array elements.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions