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
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.
Translate the C function code below to the MIPS True Assembler Language code (machine instructions only)....
Translate the C function code below to the MIPS True Assembler Language code (machine instructions only). The function code should follow the conventions for MIPS function calls including passing parameters and returning results. Your function code must be written with the minimum number of machine instructions to be executed and without any use of MIPS pseudo-instructions. Myfunction(unsigned int a, unsigned int b, unsigned int c) { int i=0; while (a > c) { a /= b; i++; } return i;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT