ex2_2_assembly.s: [Answer] # ex2_2_assembly.s %23 The array arr is stored at the address starting from 0x10000018 li x24, 0x10000010 %23 li: load instant value. x24 stores the address of the array addi x5, x0, 1 sw x5, 0 (x24) %23 store 0x01 into memory 0x10000018; arr[0] addi x5, x0, 3 sw x5, 4(x24) %23 store 0x03 into memory 0x10000018+4; arr[1] addi x5, x0, 5 sw x5, 8 (x24) %23 store 0x05 into memory 0x10000018+8; arr[2] # YOUR SOLUTION HERE... lw x11, 0 (x24) lw add sll SW SW = 3. [40 pts] In the following C program ex2_2.c, we first declare and initialize an array int arr[3] {1,3,5}. Please convert the C code in main function into Assembly language. We provide the array initialization code in ex2_2_assembly.s for reference. Please complete and submit your code. ex2_2.c: #include int main() { } int arr[3] ={1,3,5}; //declare and initialize the array arr int x11 = arr[0]; int x12 = arr[1]; int x13 =x11x12; int x14 = x13 << x11; // "<<" is left shift operator arr[1] arr [2] = x13; = x14; return 0; //no need to convert this line into assembly language

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false. A double type is an example of a simple data type....
icon
Related questions
Question
ex2_2_assembly.s:
[Answer]
# ex2_2_assembly.s
%23 The array arr is stored at the address starting from 0x10000018
li x24, 0x10000010 %23 li: load instant value. x24 stores the address of the
array
addi x5, x0, 1
sw x5, 0 (x24) %23 store 0x01 into memory 0x10000018; arr[0]
addi x5, x0, 3
sw x5, 4(x24) %23 store 0x03 into memory 0x10000018+4; arr[1]
addi x5, x0, 5
sw x5, 8 (x24) %23 store 0x05 into memory 0x10000018+8; arr[2]
# YOUR SOLUTION HERE...
lw x11, 0 (x24)
lw
add
sll
SW
SW
Transcribed Image Text:ex2_2_assembly.s: [Answer] # ex2_2_assembly.s %23 The array arr is stored at the address starting from 0x10000018 li x24, 0x10000010 %23 li: load instant value. x24 stores the address of the array addi x5, x0, 1 sw x5, 0 (x24) %23 store 0x01 into memory 0x10000018; arr[0] addi x5, x0, 3 sw x5, 4(x24) %23 store 0x03 into memory 0x10000018+4; arr[1] addi x5, x0, 5 sw x5, 8 (x24) %23 store 0x05 into memory 0x10000018+8; arr[2] # YOUR SOLUTION HERE... lw x11, 0 (x24) lw add sll SW SW
=
3. [40 pts] In the following C program ex2_2.c, we first declare and initialize an array int arr[3]
{1,3,5}. Please convert the C code in main function into Assembly language. We provide the array
initialization code in ex2_2_assembly.s for reference. Please complete and submit your code.
ex2_2.c:
#include <stdio.h>
int main() {
}
int arr[3] ={1,3,5}; //declare and initialize the array arr
int x11 =
arr[0];
int x12 = arr[1];
int x13 =x11x12;
int x14 = x13 << x11; // "<<" is left shift operator
arr[1]
arr [2]
=
x13;
= x14;
return 0; //no need to convert this line into assembly language
Transcribed Image Text:= 3. [40 pts] In the following C program ex2_2.c, we first declare and initialize an array int arr[3] {1,3,5}. Please convert the C code in main function into Assembly language. We provide the array initialization code in ex2_2_assembly.s for reference. Please complete and submit your code. ex2_2.c: #include <stdio.h> int main() { } int arr[3] ={1,3,5}; //declare and initialize the array arr int x11 = arr[0]; int x12 = arr[1]; int x13 =x11x12; int x14 = x13 << x11; // "<<" is left shift operator arr[1] arr [2] = x13; = x14; return 0; //no need to convert this line into assembly language
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,