Question: PROBLEM 5 (30 POINTS) A (10 points) Convert this C code to LEGv8 Assembly Language instructions. Assume that the base address of array is 0x10007000

PROBLEM 5 (30 POINTS)

A (10 points)

Convert this C code to LEGv8 Assembly Language instructions. Assume that the base address of array is 0x10007000 and i is in register X2. Each element of array is eight bytes long. You can use registers X9,..., and X19,...,X27. Use only native instructions (avoid pseudo-instructions).

array[i+8]=array[i]*8;

array[2*i]=array[i]*11;

B (5 points) Demonstrate how would you use the logical operations provided to you in LEGv8 Assembly Language to determine if a number is divisible by 8.

C (10 points) Convert this pseudo code to LEGv8 Assembly Language instructions (mod is a function that calculates the reminder of integer division, e.g., 4 mod 3 =1).

x=x % 4; // x <- x mod 4

switch(x){

case 0: y=5;

case 1: y=7;

default: y=x;

}

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!