Question

In: Computer Science

Translate these two LEGv8 assembly instructions to 32-bit binary machine code. Give your answer in hexadecimal....

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:

Solutions

Expert Solution

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


Related Solutions

1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled...
1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled into the hexadecimal machine code D1001695 is? 3.What does the LEGv8 instruction below do? LSL X12,X12,#8
Question: In the following MIPS assembly code, translate all the instructions to their corresponding machine code...
Question: In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x2fff0004. Loop: lw $t0, 4($s0)             addi $t1, $t1, -15             sll $t1, $t1, 2             beq $t1, $s1, Exit             addi $s0, $s0, 4             j Loop Exit: …
4 – The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly...
4 – The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly instruction. What is the RISC-V instruction format and specific assembly language instruction? 0x00156A33
The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly instruction. What...
The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly instruction. What is the RISC-V instruction format and specific assembly language instruction? 0xfe810113
Represent following LEGv8 machine code into assembly instruction. 0x784302CD
Represent following LEGv8 machine code into assembly instruction. 0x784302CD
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in...
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in recursive division form. 899726616 1656906428 -77102817 -251026154
An assembler translates assembly language to machine language instructions. A disassembler can be used to translate...
An assembler translates assembly language to machine language instructions. A disassembler can be used to translate the other way, from machine language to assembly language. For example, our 8086 emulator shows both the machine language bytes and the disassembler output while running a program (it also shows the original assembly code). The disassembled code is usually harder to read than the original assembly language program because some things are missing or may be incorrect. Write down one of the things...
- sparc assembly - *Write a program that takes four 32-bit integers (A,B,C,D) in hexadecimal form...
- sparc assembly - *Write a program that takes four 32-bit integers (A,B,C,D) in hexadecimal form and calculates A*B + C*D. (Assumption: User input is 32-bit 0 or positive. The result is expressed in 64 bits.) [result example] bash $ assm Hex value? ffffffff Hex value? 8 Hex value? ffffffff Hex value? 8 Result is 0000000f fffffff0
Hand encode the following Micro Blaze instructions, give your answer in hexadecimal a) Use ADDI to...
Hand encode the following Micro Blaze instructions, give your answer in hexadecimal a) Use ADDI to add the constant value $2AB3 from R6 and save the result to R7 b) Use the ADDC instruction to add the contents of registers R8 and R9, then save the sum in register R10 c) Use IMM and LWI to read a value from memory, starting with the base address $003B35A3, using an offset stored in R8, and having the value read into R9
Give an example of the pair of assembler instructions equivalent to a push using 32 bit...
Give an example of the pair of assembler instructions equivalent to a push using 32 bit ISA.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT