Skip to main content

How to encode immediate value in arm?

Suppose there is an inst like this:

add  ip, ip, #0x5000

the machine code is

05 CA 8C E2

and

E2 8C CA 05 = 11100010100011001100 1010 00000101
imm = rotate_right(101B, 1010B*2) = 0x5000

But if we know 0x5000, how can we get 101000000101? Is this reverse convert is one-to-one correspondence? Thanks.

scvyao
  • 141
  • 1
  • 12