or the following excerpt of WRAMP assembly code, what are the final values stored in $2and $3?(2 marks)addi $2, $0, 0x42addi $3, $0, 0x42andi $2, $2, 0xF0andi $2, $2, 0xF0xori $3, $3, 0xF0xori $3, $3, 0xF0$2 = _______0x40____________$3 = _______0x42____________
Question
or the following excerpt of WRAMP assembly code, what are the final values stored in 3?(2 marks)addi 0, 0x42addi 0, 0x42andi 2, 0xF0andi 2, 0xF0xori 3, 0xF0xori 3, 0xF02 = _______0x40____________3 = 0x42_____
Solution
The final values stored in 3 are 0x40 and 0x32 respectively.
Here's the step by step explanation:
-
addi 0, 0x42: This instruction adds the immediate value 0x42 to the value in register 2. So, $2 = 0x42.
-
addi 0, 0x42: This instruction does the same as the previous one, but stores the result in register 3 = 0x42.
-
andi 2, 0xF0: This instruction performs a bitwise AND operation between the value in register 2.
-
andi 2, 0xF0: This instruction does the same as the previous one. Since the value in $2 is already 0x40, the result remains 0x40.
-
xori 3, 0xF0: This instruction performs a bitwise XOR operation between the value in register 3.
-
xori 3, 0xF0: This instruction does the same as the previous one. Since the value in $3 is now 0xB2, the result of the XOR operation is 0x42.
So, the final values are 3 = 0x32.
Similar Questions
Expressed in hexadecimal, what are the values of the registers $1, $2, $3, and $4 after thefollowing lines of WRAMP assembly code have been executed?(2 marks)main:lw $1, val($0)lw $2, val($0)lw $3, val($0)lw $4, val($0)subui $1, $1, 1addi $2, $2, 1srli $3, $3, 1srai $4, $4, 1syscall.dataval:.word 0xFFFFFFFF$1 = ____0xFFFFFFFE________________$2 = ____0x00000000________________$3 = ____0x7FFFFFFF________________$4 = ____0xFFFFFFFF________________
For an assembler implementation of the routine that is written according to the WRAMPApplication Binary Interface (ABI):int max(int a, int b)that returns the maximum value stored in parameters a and b and uses the general purposeregisters $3 and $4 to determine that answer, but makes no further subroutine calls itself,fill out the diagram below showing the state of the stack-frame just before calling max()where parameter a is value 1, parameter b is value 2, register $3 has value 3 and register $4has value 4. Note, not all of these values are necessarily on the stack when max() is called.(2 marks)+0+1+2+3+412
MOV BX, 05HMOV CX, 08HLOOP1: ADD BX, CXLOOP2: DEC CXJNZ LOOP2DEC BXJNZ LOOP1How many times will the outer loop, LOOP1 be executed in the given 806 assembly code, and what is the final value in BX after the execution of the provided assembly code?
Given that general purpose register $1 has the value 10 in it, and $2 has the value 6, whichone of the following lines results in the value 26 being stored in $2?a. addi $1, $2, 10b. addi $1, $2, 0x10c. addi $2, $1, 10d. addi $2, $1, 0x10
. What value will EAX contain after the following instructions execute? .data dVal DWORD 12345678h .code mov ax,3 mov WORD PTR dVal+2,ax mov eax,dVal
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.