0
votes

We are asked to give a possible encoding of the following instruction, in hexadecimal, in little-endian :

r1 <- Memory[r2+r3]

Where the initial value of r1 (ECX), r2 (EDX) and r3 (EBX) are respectively 0x137dd, 0xb and 0x1f.

I'm confused. I know instructions are encoded in 32 bits where the first few bits are the opcode and the otheres the addresses of the operand, but what is the addresses of the operand, in this case?

Thanks !

1

1 Answers

0
votes

The operands here are r2 and r3. The instruction loads the value from address at memory location (value stored in r2 + value stored in r3) into register r1.

So the instruction would work like this:

opcode + target destination + source operand 1 + source operand 2

The question seems incomplete in that it doesn't give you the opcode for this operation, but the address of the operands should be the addresses of r2 and r3 (not the values in r2 and r3!).