In: Computer Science
Translate these two LEGv8 assembly instructions to 32-bit binary machine code. Give your answer in hexadecimal.
CBZ X19, exit
ADD X10, X19, X20
exit:
Greetings!!
Assume that the instructions are loaded at address 0x00400000.
0x00400000 CBZ X19,EXIT
0x00400004 ADD X10,X19,X20
0x00400008 exit address
1. Machine code for ADD X10,X19,X20:
The instruction format of ADD instruction is:
Fill those fields with the correponding bits gives:
Write the hex equivalent of each nibble:
Answer:1000 1011 0001 0100 0000 0010 0110 1010=8B14026A
2. Machine code for CBZ X1,EXIT:
The instruction format of CBZ instruction is:
Fill those fields with the correponding bits gives:
Please note that the 19 bit address is the offset address required for the address calculation. Address=PC+Offset
Write the hex equivalent of each nibble:
Answer:1011 0100 0000 0000 0000 0001 0001 0011=B4000113
Hope this helps