Anyone explain to (i), (ii)
How can we get the instruction words and R8=?[hex]?
(i) instruction words[hex] is 0x4508, and R8= 0xF002
How can I get that?
(ii) instruction words[hex] is 0x4548 and R8=0x0002
How can I get that?
i) MOV R5, R8 -> R8 = R5
The source register is R5 and destination register is R8. Therefore the contents of source register R5 is moved to destination register R8. The initial value contained in register R5 is 0xF002. Therefore the destination register R8 will also have the same value that of register R5, that is 0xF002.
The first fout bits of instruction word denotes the opcode of the instruction. The opcode for MOV is 0100b(0x4 in Hexa).
The next four bits of instruction word denotes the register used by source operand. Here it is register R5. Therefore it is 0101b(0x5 in Hexa)
The next one bit is to define the addressing mode used by source operand. For register mode it is 0b.
The next one bit is to define whether it is word or byte access. For word access it is 0b.
The next two bits is to define the addressing mode used by destination operand. For register mode it is 00b.
The last four bits denotes the register used by destination operand. Here it is register R8. Therefore it is 1000b(0x8 in Hexa).
Therefore the instruction word for the instruction MOV R5, R8 is:
0100 0101 0000 1000 => 0x4508
ii) MOV.B R5, R8 -> R8(Lower byte) = R5(Lower byte) and clears the upper byte of R8
The source register is R5 and destination register is R8. Therefore the contents of lower byte of source register R5 is moved to destination register R8's lower byte. The upper byte of R8 is cleared. The initial value contained in register R5 is 0xF002. Therefore the lower byte of destination register R8 will also have the same value that of register R5 in lower byte, that is 0x02.
Therefore after moving the value in R8 is 0x0002, where upper byte is cleared.
The first fout bits of instruction word denotes the opcode of the instruction. The opcode for MOV is 0100b(0x4 in Hexa).
The next four bits of instruction word denotes the register used by source operand. Here it is register R5. Therefore it is 0101b(0x5 in Hexa)
The next one bit is to define the addressing mode used by source operand. For register mode it is 0b.
The next one bit is to define whether it is word or byte access. For byte access it is 1b.
The next two bits is to define the addressing mode used by destination operand. For register mode it is 00b.
The last four bits denotes the register used by destination operand. Here it is register R8. Therefore it is 1000b(0x8 in Hexa).
Therefore the instruction word for the instruction MOV R5, R8 is:
0100 0101 0100 1000 => 0x4548
Anyone explain to (i), (ii) How can we get the instruction words and R8=?[hex]? (i) instruction...