Limitations of ARM processor instruction immediate addressing

Publisher:快乐心跳Latest update time:2016-03-31 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
In the assembly language of the ARM processor, there is a provision for constant expressions in the instruction syntax format: "The constant must correspond to an 8-bit bitmap, that is, the constant is obtained by cyclically shifting an even number of bits of an 8-bit constant."

Given an immediate number, judging whether it is legal can be divided into three steps: first, write the given immediate number in 32-bit binary form; then see if an 8-bit binary number can be used to include all the parts containing 1, if not, it is illegal; finally, see if this 8-bit binary number can be cyclically right-shifted by an even number of bits to obtain the given immediate number, if not, it is illegal.

0xff=00000000  00000000  00000000  111111111: equivalent to the 8-bit binary 11111111 shifted right by 0 bits, which is legal;

0x104=00000000  00000000  00000001  00000100: equivalent to the 8-bit binary 01000001 shifted right 2 bits, legal;

0x101=00000000  00000000  00000001  00000001: The part containing all 1s is 100000001, which cannot be represented by an 8-bit binary number and is illegal.

0x102=00000000  00000000  00000001  00000010: The part containing all 1s is 10000001, but 10000001 can only be cyclically right-shifted by odd bits to get the given number, which is illegal;

0xfC000002  =11111100  00000000  00000000  00000010: equivalent to the 8-bit binary number 10111111 circularly shifted right by 6 bits, which is legal.

0x8000007E=10000000  00000000  00000000  01111110: The part containing all 1s is 11111101, but 10000001 can only be rotated right by odd bits to get the given number, which is illegal.

Summary: First, to determine whether a number conforms to the principle of 8-bit bitmap, first check whether the number of 1s does not exceed 8 after the number is converted into binary. If not, check whether these n 1s (n<=8) can be put into 8 binary bits at the same time. If they can be put in, check whether these eight binary bits can be cyclically right-shifted by even bits to get the value that was initially judged. If so, this value conforms to the principle of 8-bit bitmap, otherwise, it does not conform. Second, it is impossible to represent an arbitrary 32-bit number with a 12-bit code. Only part of the 32-bit number can be obtained by cyclically right-shifting the even bits of the eight-bit binary number. The rest of the 32-bit numbers that cannot be represented can only be obtained through other means. For example, 0xffffff00 can be obtained by bitwise inversion of 0x000000ff.

Reference address:Limitations of ARM processor instruction immediate addressing

Previous article:ARM embedded system serial port expansion
Next article:ARM pseudo-instruction explanation

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号