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
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: …
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;...
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;...
HCS12 Assembly code please. Translate the following code into assembly. Allocate each variable on the stack....
HCS12 Assembly code please. Translate the following code into assembly. Allocate each variable on the stack. Simulate your program and screenshot the final value of the variables in memory. { char A,B,C; int F; A = 2; B = 6; C = - 10; F = (A + B)*C; C = F +10 }
Write a possible assembly language instruction or set of instructions to accomplish the following: a) Compare...
Write a possible assembly language instruction or set of instructions to accomplish the following: a) Compare the byte stored at the memory location pointed to by register R4 to the upper (higher) byte stored in register R5 b) Branch to instruction at label ‘ZERO’ if the lower byte of register R6 is zero c) Jump to the instruction at label ‘EVEN’ if the value in register R7 is an even number
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT