What is the ARM Thumb Instruction set?

谁都会走 提交于 2019-12-03 02:14:31

问题


under "The Thumb instruction set" in section 1-34 of "ARM11TechnicalRefManual" it said that:

"The Thumb instruction set is a subset of the most commonly used 32-bit ARM instructions.Thumb instructions are 16 bits long,and have a corresponding 32-bit ARM instruction that has the same effect on processor model."

can any one explain more about this especially second sentence and say how does processor perform it?


回答1:


The ARM processor has 2 instruction sets, the traditional ARM set, where the instructions are all 32-bit long, and the more condensed Thumb set, where most common instructions are 16-bit long (and some are 32-bit long). Which instruction set to run can be chosen by the developer, and only one set can be active (i.e. once the processor is switched to Thumb mode, all instructions will be decoded as using the Thumb instead of ARM).

Although they are different instruction sets, they share similar functionality, and can be represented using the same assembly language. For example, the instruction

ADDS  R0, R1, R2

can be compiled to ARM (E0910002 / 11100000 10010001 00000000 00000010) or Thumb (1888 / 00011000 10001000). Of course, they perform the same function (add r1 and r2 and store the result to r0), even if they have different encodings. This is the meaning of Thumb instructions are 16 bits long,and have a corresponding 32-bit ARM instruction that has the same effect on processor model.

Every* instruction in Thumb encoding also has a corresponding encoding in ARM, which is meant by the "subset" sentence.


*: Not strictly true, there is not "IT" instruction in ARM, although ARM doesn't need "IT" anyway (it will be ignored by the assembler).



来源:https://stackoverflow.com/questions/10638130/what-is-the-arm-thumb-instruction-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!