ARM Cortex-M 分支指令编码

B<cond>.<qualifier> <lable> -- Branch causes a branch to a target address

if ConditionPassed(cond) then
{

  EncodingSpecificOperations(PC, lable);

  BranchWritePC(PC + imm32);

}

// All versions of the Thumb instruction set

T1 : B<cond> <lable> : not allowed in IT block

T2 : B<cond> <lable> : outside or last in IT block

// All versions of the Thumb instruction set from Thumb-2 onwards.

T3 : B<cond>.W <lable> : not allowed in IT block

T4 : B<cond>.W <lable> : outside or last in IT block

<lable>

Specifies the label of the instruction that is to be branched to.

The assembler calculates the required value of the offset
from the PC value of the B instruction to this label,
then selects an encoding that will set imm32 to that offset.

Allowed offsets are even numbers in the range

T1 : -256 to 254 : imm8

T2 : -2048 to 2046 : imm11

T3 : -1048576 to 1048574 : imm6 +  imm11 

T4 : -16777216 to 16777214 : imm10 +  imm11 

BX  -- Branch and Exchange causes a branch to an address and instruction set specified by a register.

T1 : BX<cond> <Rm> // Outside or last in IT block

BLX (register) -- Branch and Exchange calls a subroutine at an address and instruction set specified by a register.

T1 : BLX<cond> <Rm> // Outside or last in IT block

BL, BLX (immediate) -- Branch with Link (immediate) calls a subroutine at a PC-relative address.

T1 : BL<cond> <label> // Outside or last in IT block

T2 : BLX<cond> <label> // Outside or last in IT block

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值