Question: 1 1 . 4 LAB: Array of squares - LDUR / STUR Given an array of four integers, write a program that populates a new

11.4 LAB: Array of squares - LDUR/STUR
Given an array of four integers, write a program that populates a new array with the square of the elements in the given array. Assume X19
stores the memory location of the first element of the given array, and X20 stores the memory location of the first element of the new array.
Hint: Each memory address is incremented by 8 due to the doubleword addresses.
Ex: If X19 and X20 are initialized in the simulator as 4000 and 5000, and the content of the given array is:
then the content of the new array is: stores the memory location of the first element of the given array, and X20 stores the memory location of the first element of the new array.
Hint: Each memory address is incremented by 8 due to the doubleword addresses.
Ex: If X19 and X20 are initialized in the simulator as 4000 and 5000, and the content of the given array is:
then the content of the new array is:
Note: Use the '+' button under the Registers and Memory display to initialize X19, X20, and the four memory locations of the given array. Note: Use the '+' button under the Registers and Memory display to initialize X19, X20, and the four memory locations of the given array.
Load default template...
Assembly
Line 1// Type your code here.
Line 2// Do not initialize X19 and X20 here.
Line 3// Use the + button under the Register (
Line 4
Registers
Memory
Each has value 0 Each has value 0
RUN
More options This zyLab platform supports the following LEGv8 instructions:
Arithmetic: ADD, ADDS, ADDI, ADDIS, MUL, SDIV, SUB, SUBS, SUBI, SUBIS
Data transfer: LDURB, LDUR, LDURH, LDURSW, MOVK, MOVZ, STURB, STUR, STURH, STURW
Logical: AND, ANDI, EOR, EORI, ORR, ORRI, LSL, LSR
Conditional branch: B.HS, B.LO, B.EQ,
B.GT,
B.GE, B.HI,
B.LT, B.LE,
B.LS, B.MI,
B.NE,
B.VC,B.VS,
B.PL, CBZ, CBNZ
Unconditional jump: B, BL, BR
(WARNING: Use only the following code commands in the last image, so do not use MOV for example!)
1 1 . 4 LAB: Array of squares - LDUR / STUR Given

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