Menu

Question 7 Please Help Keep Getting Partial Credit Legv8 Question Mistakes Make Q43887955

question 7 Please help I keep getting partial credit inthisPartial Question 7 1/7 pts Write the LEGV8 assembly for the following code snippet. One trick is to figure out how to get the LEGv8 question. What mistakesdid I make?

Partial Question 7 1/7 pts Write the LEGV8 assembly for the following code snippet. One trick is to figure out how to get the large constant in a register when the ADDI instruction only allows 12-bit constants. Assume a is stored in register X9. if(a & exApe – e) a-sa. 1: Label Instruction Description MOV X10, NOxA Set the value of X10 to the constant OxA LSL X10, X10, #1 Shift the value in X10 appropriately Shift the value in X10 appropriately to get the constant from the code snippet, saving back in X10 SUB X10,X9,X10 Compute the “&” operation between ‘a’ and the constant in X10, storing the result in X10 B.NEX10, EXIT If the value computed by the previous instruction is zero, branch to the label EXIT SUBI X10,#-1 Get the constant-1 into the X10 register using SUBI EOR X9,X10 Flip all the bits of ‘a’ putting the result into X9 ADDIX9,X9, 21 Increment ‘a’ by 1 EXIT Answer 1: MOV X10, #OxA Answer 2: LSL X10, X10, #1 Answer 3: SUB X10,X9,X10 Answer 4: B.NE X10, EXIT Answer 5: SUBI X10, #-1 Answer 6: EOR X9,X10 Answer 7: ADDI X9,X9,#1 Show transcribed image text Partial Question 7 1/7 pts Write the LEGV8 assembly for the following code snippet. One trick is to figure out how to get the large constant in a register when the ADDI instruction only allows 12-bit constants. Assume a is stored in register X9. if(a & exApe – e) a-sa. 1: Label Instruction Description MOV X10, NOxA Set the value of X10 to the constant OxA LSL X10, X10, #1 Shift the value in X10 appropriately Shift the value in X10 appropriately to get the constant from the code snippet, saving back in X10 SUB X10,X9,X10 Compute the “&” operation between ‘a’ and the constant in X10, storing the result in X10 B.NEX10, EXIT If the value computed by the previous instruction is zero, branch to the label EXIT SUBI X10,#-1 Get the constant-1 into the X10 register using SUBI EOR X9,X10 Flip all the bits of ‘a’ putting the result into X9 ADDIX9,X9, 21 Increment ‘a’ by 1 EXIT Answer 1: MOV X10, #OxA Answer 2: LSL X10, X10, #1 Answer 3: SUB X10,X9,X10 Answer 4: B.NE X10, EXIT Answer 5: SUBI X10, #-1 Answer 6: EOR X9,X10 Answer 7: ADDI X9,X9,#1

Expert Answer


Answer to question 7 Please help I keep getting partial credit in this LEGv8 question. What mistakes did I make?…

OR