ARM base instruction -- bfm

If <imms> is greater than or equal to <immr>, this copies a bitfield of (<imms>-<immr>+1) bits starting from bit position <immr> in the source register to the least significant bits of the destination register.

If <imms> is less than <immr>, this copies a bitfield of (<imms>+1) bits from the least significant bits of the source register to bit position (regsize-<immr>) of the destination register, where regsize is the destination register size of 32 or 64 bits.

In both cases the other bits of the destination register remain unchanged.

Bitfield Move 通常通过其别名之一访问,这些别名在反汇编时总是首选。

如果<imms>大于或等于<immr>,则会从源寄存器中的位位置<immmr>开始复制一个(<imms>-<immr>+1)位的位字段到目标寄存器的最低有效位。

如果<imms>小于<immr>,则会将(<imms>+1)位的位字段从源寄存器的最低有效位复制到目标寄存器的位位置(regsize-<immr>),其中regsize是32或64位的目标寄存器大小。

在这两种情况下,目标寄存器的其他位保持不变。

32-bit variant

Applies when sf == 0 && N == 0.

BFM <Wd>, <Wn>, #<immr>, #<imms>

64-bit variant

Applies when sf == 1 && N == 1.

BFM <Xd>, <Xn>, #<immr>, #<imms>

Decode for all variants of this encoding

integer d = UInt(Rd);

integer n = UInt(Rn);

integer datasize = if sf == '1' then 64 else 32;

integer R;

bits(datasize) wmask;

bits(datasize) tmask;

if sf == '1' && N != '1' then UNDEFINED;

if sf == '0' && (N != '0' || immr<5> != '0' || imms<5> != '0') then UNDEFINED;

R = UInt(immr);

(wmask, tmask) = DecodeBitMasks(N, imms, immr, FALSE);

integer UInt(bits(N) x)

result = 0;

for i = 0 to N-1

if x<i> == '1' then result = result + 2^i;

return result;

Operation

bits(datasize) dst = Xd;

bits(datasize) src = Xn;

// perform bitfield move on low bits

bits(datasize) bot = (dst AND NOT(wmask)) OR (ROR(src, R) AND wmask);

// combine extension bits and result bits

Xd = (dst AND NOT(tmask)) OR (bot AND tmask);

相关推荐
ThornArmor1 天前
【工具篇·番外】跨语言生态的主权回收:基于 ISA 说明书的 4-bit 双向汇编系统全线封顶
c语言·开发语言·汇编·c++·重构·架构
是星辰吖~2 天前
WIN32_线程(下)
汇编
是星辰吖~2 天前
WIN32_线程(上)
汇编
AI科技星3 天前
数术工坊 · 第四卷 橡皮泥江湖(拓扑学)【完整定稿】
c语言·开发语言·汇编·electron·概率论·拓扑学
iCxhust3 天前
C# 生成命令行程序 将hex格式烧录程序转换成bin烧录格式
开发语言·汇编·单片机·嵌入式硬件·c#·微机原理
iCxhust4 天前
C#进程管理程序
开发语言·汇编·stm32·单片机·c#·微机原理
hhcgchpspk4 天前
汇编语言传递数据和地址的误区
汇编·笔记·nasm·masm
iCxhust4 天前
MTK8088单板机制作(一)时钟电路
汇编·单片机·嵌入式硬件·微机原理·8088单板机
iCxhust4 天前
8086 汇编位测试使用方法
汇编·单片机·嵌入式硬件·微机原理·8088单板机
iCxhust4 天前
用汇编在8088单板机上创建一个进程
汇编·微机原理