Converting very simple ARM instructions to binary/hex

后端 未结 3 1821

I\'ve been trying to use this page as well as various other guides to figure out how to express very simple ARM instructions as binary and hex. It seems lik

3条回答
  •  感情败类
    2020-12-08 03:46

    You should get a copy of the ARM ARM it describes the encoding for all instructions.

    Most ARM-Instructions use the upper 4 bits for a conditional code. If you don't want to run the instruction conditionally just use the pseudo-condition AL (1110).

    The first register (Rn) in the encoding is not used for the MOV-instruction and it should be set to 0000 as defined by the ARM ARM.

    The second register is the destination, here you just encode the register number, so in your case it also would be 0000 because you're using r0 as a destinal, for r4 it would be 0100.

    The remainder is the so called shifter operand which is very flexible. It could be a simple register as in your case (r0) then it is just 0000 0000 0000 where the last 4 bits again encode the register. It can also encode different types of shifts and rotates with register or immediate values for data processing.

    But it could also be an immediate where 8 bits are encoded in the bottom bits and the first 4 bits define a right rotate in 2 bit steps. In this case bit25 will also be 1, in all other cases it's 0.

提交回复
热议问题