Question: Read info below starting: only use commands provided, ( No MOV or CMP for example ) : Hint: Use x 0 0 , x 1

Read info below starting: only use commands provided, (No MOV or CMP for example) :
Hint: Use x00,x1 as arguments and X 2 as return value, according to the convention for procedure calling.
Ex: If the values of X19 and X20 are initialized in the simulator as:
the result is stored in $s2 :
Note: Use the '+' button under the Registers display to initialize register values for X19 and X20. Note: Use the '+' button under the Registers display to initialize register values for X19 and X20.
Assembly Note: Use the '+' button under the Registers display to initialize register values for x19 and X20.
Load default template...
AssemblyNote: Use the '+' button under the Registers display to initialize register values for X 19 and X 20.
593924.3663848.qx3zqy7This 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
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 11.10 LAB: Nested procedures
Given the following C program and the mapping of registers to variables, complete the ARM implementation of procedure Sum.
int Dif(int a, int b){
return b - a;
}
int Sum(int m, int n){
int p = Dif(n+1, m-1);
int q = Dif(m+1, n-1);
return p + q;
}
int main(){
int x, y;
z = x + y + Sum(x, y);
return 0;
}
Hint: Use x0,x1 as arguments and X 2 as return value, according to the convention for procedure calling.
Read info below starting: only use commands

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!