Question

In: Computer Science

Represent following LEGv8 machine code into assembly instruction. 0x784302CD

Represent following LEGv8 machine code into assembly instruction.
0x784302CD

Solutions

Expert Solution

We are given the LEGv8 machine code in hexadecimal notation which is:- 0x784302CD.
We will now convert the above hexadecimal code to binary to check whether what is the opcode and what are the register numbers and offset.

Binary Representation:- 0111 1000 0100 0011 0000 0010 1100 1101, so we have out 32 bits instruction.

I have povided the chart for convenience.

So, from the above chart is we keep on matching whether which operation code is matching our machine code, we will find that LDURH instruction has the 11 bits identical to the first 11 bits of our machine code. So now we have the instruction in our hand which is LDURH, which means load half word unscaled.

Instruction format - LDURH Rt , [ Rn, offset ] , where Rt is the destination or load register number, and Rn is the base register, and offset will be added to the Rn to load the contents from the resultant address.
LDURH - Load (Unscaled) Halfword: loads a halfword from memory addressed by
Rn+ offest.

Now, our task is only to find the register numbers and the offset number. For that we will refer the below format to find the decimal value corresponding to Rn and Rt and also offset.

On comparing our machine code with the above format, we get,

Rn = 10110 = 22
Rt = 01101 = 13

Offset/address = 000110000 = 48

Now, we have everything to write the instruction corresponding to machine code:-

Assembly Instruction = LDURH R13, [ R22, #48 ]

where R13 is a temporary register and R22 is a saved register according to LEGv8 register specifications.


Related Solutions

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]
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
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:
Write assembly code for the following machine code. Assume that the segment is placed starting at...
Write assembly code for the following machine code. Assume that the segment is placed starting at location 80000. Create labels for jump and branch instructions. Indicate the actual memory addresses represented by such labels. 0010 1010 0000 1000 0000 0000 0000 1010 0001 0001 0000 0000 0000 0000 0000 0010 0000 0010 0001 0001 1000 0000 0010 0000 0000 1000 0000 0000 0100 1110 0010 0101 0000 0010 0001 0010 1000 0000 0010 0000
a. Write machine code for the following assembly code. Assume that the segment is placed starting...
a. Write machine code for the following assembly code. Assume that the segment is placed starting at location 80000. Use decimal numbers to represent each instruction. loop:         beq $s3, $s1, endwhile                  add $t0, $s3, $s4                  lw $t1, 0($t0)                  add $s0, $s0, $t1                  addi $s3, $s3, 4                  j loop endwhile: b. Write assembly code for the following machine code. Assume that the segment is placed starting at location 80000. Create labels for jump and branch instructions. Indicate the actual...
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: …
True and False 1. The instruction register stores machine code for the instruction being executed. 2....
True and False 1. The instruction register stores machine code for the instruction being executed. 2. Before a digital computer may execute an instruction, the instruction code must be fetched from memory. 3. A pointer is a binary code for data in the arithmetic logic unit. 4. Von Neumann computer architecture stores data and instruction codes in the same memory. 5. Complex instruction set computers have instructions with greater speed than those in reduced instruction set computers.
Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the...
Provide the instruction type, assembly language instruction, and binary representation of the instruction described by the following LEGv8 fields: op = 0x458, Rm = 14, Rn = 16, Rd = 18, shamt = 0
Write the LEGv8 assembly program for following c program. Assume array1, array2 and array3 are stored...
Write the LEGv8 assembly program for following c program. Assume array1, array2 and array3 are stored in memory with base addresses at 1000, 2000 and 3000 respectively. int absoluteDifference(int x, int y) { int r; if (x > y) r = x - y; else r = y - x; return r; } int main() { for (int i=0; i < 10; i++) { int a = array1[i]; int b = array2[i]; int c = absoluteDifference(a, b); array3[i] = c;...
Write the LEGv8 assembly program for following c program. Assume array1, array2 and array3 are stored...
Write the LEGv8 assembly program for following c program. Assume array1, array2 and array3 are stored in memory with base addresses at 1000, 2000 and 3000 respectively. int absoluteDifference(int x, int y) { int r; if (x > y) r = x - y; else r = y - x; return r; } int main() { for (int i=0; i < 10; i++) { int a = array1[i]; int b = array2[i]; int c = absoluteDifference(a, b); array3[i] = c;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT