Differences between ARM instructions and Thumb instructions

Publisher:小牛队Latest update time:2016-07-12 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Thumb instruction set

 

       Thumb instructions can be seen as a subset of ARM instructions in compressed form. They are proposed to address the problem of code density1], and have a code density of 16 bits. Thumb is not a complete architecture, and you cannot expect the handler to only execute Thumb instructions without supporting the ARM instruction set. Therefore, Thumb instructions only need to support general functions, and when necessary, they can use the complete ARM instruction set, for example: all exceptions automatically enter the ARM state.

       When writing Thumb instructions, you must first use the pseudo-instruction CODE16 declaration, and in the ARM instruction, you must use the BX instruction to jump to the Thumb instruction to switch the processor state. When writing ARM instructions, you can use the pseudo-instruction CODE32 declaration.

 

1]. Code density: the number of instructions contained in a unit of storage space. For example

              ARM instructions are 32 bits, while Thumb instructions are 16 bits. If 32 ARM instructions can be placed in 1K of storage space, 64 Thumb instructions can be placed. Therefore, when storing Thunb instructions, the code density is high.

 

 

 

The difference between Thumb instruction set and ARM instruction set

 

       The Thumb instruction set does not have coprocessor instructions, semaphore instructions, instructions for accessing CPSR or SPSR, multiplication and addition instructions, 64-bit multiplication instructions, etc., and the second operand of the instruction is restricted; except for the conditional execution function of jump instruction B, all other instructions are unconditionally executed; most Thumb data processing instructions use a 2-address format. The differences between the Thumb instruction set and the ARM instruction set are generally as follows:

Ø Jump instruction

Program relative transfers, especially conditional jumps, are more restricted in scope than jumps under ARM code. Jumping to a subroutine is an unconditional transfer.

Ø Data processing instructions

Data processing instructions operate on general registers, and in most cases the result of the operation must be placed in one of the operand registers rather than a third register.

Data processing operations are less frequent than in ARM state, and access to registers R8-R15 is subject to certain restrictions.

(Except for MOV and ADD instructions accessing registers R8-R15, other data processing instructions always update the ALU status flags in the CPSR)

Thumb data processing instructions that access registers R8-R15 cannot update the ALU status flags in the CPSR.

Ø Single register load and store instructions

In Thumb state, single register load and store instructions can only access registers R0-R7.

Ø Bulk register load and store instructions

The LDM and STM instructions can load or store any subset of the registers in the range R0-R7.

Reference address:Differences between ARM instructions and Thumb instructions

Previous article:Header file definitions and ARM instructions
Next article:ARM Basics: ARM Instructions MSR

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号