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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started