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
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
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;...
Represent following LEGv8 assembly instruction into machine code (use hexa decimal format). STUR X1, [X1, #8]
Represent following LEGv8 assembly instruction into machine code (use hexa decimal format). STUR X1, [X1, #8]
11.  Convert this hexadecimal notation to binary notation: E4B Answer format: put a space between each four-bit...
11.  Convert this hexadecimal notation to binary notation: E4B Answer format: put a space between each four-bit pattern. (e.g., 1000 0000 0111) 12. Convert this decimal notation to an excess notation system using bit patterns of length three: -1 13. Convert this two's complement notation to its equivalent base ten representation: 10011 Note: Since the tables in the book on page only show 7 through -8 in a pattern of length four,          you will need to create a pattern of length...
3. Translate the following C code to MIPS assembly code (in two separate files). int main()...
3. Translate the following C code to MIPS assembly code (in two separate files). int main() { printf(“before subroutine!\n”); Subfunc(); printf(“after subroutine!\n!”); } void Subfunc() {printf(“I am subroutine!\n”);} Submission file: Lab4_3a.asm for the main routine and Lab4_3b.asm for the sub-routine.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT