当前位置:网站首页>Load/store instruction addressing mode of arm instruction set (1)
Load/store instruction addressing mode of arm instruction set (1)
2022-06-12 11:50:00 【fanxiaoyu321】
List of articles
This note records the operation 32 Bit type and unsigned byte data Load/Store The addressing mode used by the instruction .
All types of Load/Store The addressing mode of instructions is determined by Base address Add Offset Composed of , The base address is specified in any general-purpose register , There are three ways to specify the offset :
- Count now ;
- register ;
- Register and a shift constant ;
There are three ways to calculate the addressing mode :
- Offset method ;
- Update the method beforehand : Calculate the access address first , Then access storage , Finally, update the base register with the memory access address , It is also called after the fact visit ( After the event means that the address is updated after the memory access operation );
- Post update method : First, use the base register value to access , Then calculate the new memory access address , Finally, update the base register with the new memory access address , Also known as prior access ( It means that the memory access operation precedes the address update );
Be careful : The above applies to all types of Load/Store Instructions .
Grammar format
operation 32 Bit type and unsigned byte data Load/Store The syntax format of the instruction is as follows :
LDR{<cond>}{B} {T}<Rd>, <address_mode>
- B Indicates that the operation is an unsigned byte ;
- T Indicates that the instruction is executed with user mode permission , See instruction introduction for details .
Addressing mode
operation 32 Bit type and unsigned byte data Load/Store Instruction common 9 Address mode , Let's talk about each of them .
| grammar | explain | |
|---|---|---|
| 1 | [<Rn>, #+/-<offset_12>] | Immediate offset addressing |
| 2 | [<Rn>, +/-<Rm>] | Register offset addressing |
| 3 | [<Rn>, +/-<Rm>, <shift>#<shift_imm>] | Register shift offset addressing |
| 4 | [<Rn>, #+/-<offset_12>]! | Immediate pre update addressing |
| 5 | [<Rn>, #+/-<Rm>]! | Register pre update addressing |
| 6 | [<Rn>, +/-<Rm>, <shift>#<shift_imm>]! | Register shift pre update addressing |
| 7 | [<Rn>], #+/-<offset_12> | Immediate post update addressing |
| 8 | [<Rn>], +/- | Register post update addressing |
| 9 | [<Rm>], +/-<Rn>, <shift>#<shift_imm> | Register shift post update addressing |
Immediate offset addressing
[<Rn>, #+/-<offset_12>]
if U == 1 then
address = Rn + offset_12
else
address = Rn - offset_12
Register offset addressing
[<Rn>, +/-<Rm>]
if U == 1 then
address = Rn + Rm
else
address = Rn - Rm
Register shift offset addressing
[<Rn>, +/-<Rm>, <shift>#<shift_imm>]
according to <shift> Different , There are several shift offset addressing methods in total :
Logic shift left :[<Rn>, +/-<Rm>, LSL #<shift_imm>]
Logical shift right :[<Rn>, +/-<Rm>, LSR #<shift_imm>]
Count right :[<Rn>, +/-<Rm>, ASR #<shift_imm>]
Cycle moves to the right :[<Rn>, +/-<Rm>, ROR #<shift_imm>]
The extended loop moves to the right :[<Rn>, +/-<Rm>, RRX]
case LSL:
index = Rm LSL shift_imm
case LSR:
if shift_imm == 0 then // Move right 32 position
index = 0
else
index = Rm LSR shift_imm
case ASR:
if shift_imm == 0 then // Move right 32 position
if Rm[31] == 1 then
index = 0xFFF_FFFF
else
index = 0
else
index = Rm ASR shift_imm
case ROR | RRX
if shift_imm == 0 then // RRX
index = (C Flag LSL 31) OR (Rm LSR 1)
else // ROR
index = Rm ROR shift_imm
if U == 1 then
address = Rn + index
else
address = Rn - index
Immediate pre update addressing
[<Rn>, #+/-<offset_12>]!
if U == 1 then
address = Rn + offset_12
else
address = Rn - offset_12
if CondPassed then
Rn = address
Register pre update addressing
[<Rn>, #+/-<Rm>]!
if U == 1 then
address = Rn + Rm
else
address = Rn - Rm
if CondPassed then
Rn = address
Register shift pre update addressing
[<Rn>, +/-<Rm>, <shift>#<shift_imm>]!
Allied , according to <shift> Different , There are several shift offset addressing methods in total :
Logic shift left :[<Rn>, +/-<Rm>, LSL #<shift_imm>]!
Logical shift right :[<Rn>, +/-<Rm>, LSR #<shift_imm>]!
Count right :[<Rn>, +/-<Rm>, ASR #<shift_imm>]!
Cycle moves to the right :[<Rn>, +/-<Rm>, ROR #<shift_imm>]!
The extended loop moves to the right :[<Rn>, +/-<Rm>, RRX]!
case LSL:
index = Rm LSL shift_imm
case LSR:
if shift_imm == 0 then // Move right 32 position
index = 0
else
index = Rm LSR shift_imm
case ASR:
if shift_imm == 0 then // Move right 32 position
if Rm[31] == 1 then
index = 0xFFF_FFFF
else
index = 0
else
index = Rm ASR shift_imm
case ROR | RRX
if shift_imm == 0 then // RRX
index = (C Flag LSL 31) OR (Rm LSR 1)
else // ROR
index = Rm ROR shift_imm
if U == 1 then
address = Rn + index
else
address = Rn - index
if CondPassed then
Rn = address
Immediate post update addressing
[<Rn>], #+/-<offset_12>
address = Rn
if CondPassed then
if U == 1 then
Rn = Rn + offset_12
else
Rn = Rn - offset_12
Register post update addressing
[<Rn>], +/-<Rm>
address = Rn
if CondPassed then
if U == 1 then
Rn = Rn + Rm
else
Rn = Rn - Rm
Register shift post update addressing
[<Rm>], +/-<Rn>, <shift>#<shift_imm>
Allied , according to <shift> Different , There are several shift offset addressing methods in total :
Logic shift left :[<Rn>], +/-<Rm>, LSL #<shift_imm>
Logical shift right :[<Rn>], +/-<Rm>, LSR #<shift_imm>
Count right :[<Rn>], +/-<Rm>, ASR #<shift_imm>
Cycle moves to the right :[<Rn>], +/-<Rm>, ROR #<shift_imm>
The extended loop moves to the right :[<Rn>], +/-<Rm>, RRX
address = Rn
case LSL:
index = Rm LSL shift_imm
case LSR:
if shift_imm == 0 then // Move right 32 position
index = 0
else
index = Rm LSR shift_imm
case ASR:
if shift_imm == 0 then // Move right 32 position
if Rm[31] == 1 then
index = 0xFFF_FFFF
else
index = 0
else
index = Rm ASR shift_imm
case ROR | RRX
if shift_imm == 0 then // RRX
index = (C Flag LSL 31) OR (Rm LSR 1)
else // ROR
index = Rm ROR shift_imm
if CondPassed then
if U == 1 then
Rn = Rn + index
else
Rn = Rn - index
边栏推荐
- Summary of rosbridge use cases_ Chapter 26 opening multiple rosbridge service listening ports on the same server
- Index in MySQL show index from XXX the meaning of each parameter
- ioremap
- Why is there no traffic after the launch of new products? How should new products be released?
- IP地址管理
- 【蓝桥杯单片机 国赛 第十一届】
- 【深度学习基础】神经网络的学习(4)
- TinyMCE series (I) TinyMCE environment construction
- QT based travel query and simulation system
- C# 35. Select default network card
猜你喜欢

Logrotate log rotation method create and copyruncate principles

Video JS library uses custom components

視頻分類的類間和類內關系——正則化

创建Servlet项目

当自己有台服务器之后

字节序 - 如何判断大端小端

5G NR協議學習--TS38.211下行通道

Index in MySQL show index from XXX the meaning of each parameter

【深度学习基础】反向传播法(1)

Relatively rare exception records in UI automation test
随机推荐
PDSCH 相关
Windows10 install mysql-8.0.28-winx64
TinyMCE series (II) TinyMCE plug-in development
How to view glibc version
UML系列文章(30)体系结构建模---制品图
Golang Foundation (6)
7-5 复数四则运算
QML学习 第一天
視頻分類的類間和類內關系——正則化
机器学习基础概念
异步路径处理
ARM指令集之跳转指令
LeetCode 497. 非重叠矩形中的随机点(前缀和+二分)
35. search insertion position
Pessimistic lock and optimistic lock of MySQL
邻居子系统之邻居项状态更新
Face recognition PIP failed to install Dlib Library
MySQL lock leak detection and defect filling
[foundation of deep learning] learning of neural network (4)
When you have a server