ARM base instruction -- adcs

Add with Carry, setting flags, adds two register values and the Carry flag value, and writes the result to the destination register. It updates the condition flags based on the result.

带进位加法,设置标志,将两个寄存器值和进位标志值相加,并将结果写入目标寄存器。它根据结果更新条件标志。

32-bit variant

Applies when sf == 0.

ADCS <Wd>, <Wn>, <Wm>

64-bit variant

Applies when sf == 1.

ADCS <Xd>, <Xn>, <Xm>

Decode for all variants of this encoding

integer d = UInt(Rd);

integer n = UInt(Rn);

integer m = UInt(Rm);

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

Operation

bits(datasize) result;

bits(datasize) operand1 = X[n];

bits(datasize) operand2 = X[m];

bits(4) nzcv;

(result, nzcv) = AddWithCarry(operand1, operand2, PSTATE.C);

PSTATE.<N,Z,C,V> = nzcv;

X[d] = result;

(bits(N), bits(4)) AddWithCarry(bits(N) x, bits(N) y, bit carry_in)

integer unsigned_sum = UInt(x) + UInt(y) + UInt(carry_in);

integer signed_sum = SInt(x) + SInt(y) + UInt(carry_in);

bits(N) result = unsigned_sum<N-1:0>; // same value as signed_sum<N-1:0>

bit n = result<N-1>;

bit z = if IsZero(result) then '1' else '0';

bit c = if UInt(result) == unsigned_sum then '0' else '1';

bit v = if SInt(result) == signed_sum then '0' else '1';

return (result, n:z:c:v);

ADC指令用于把两个操作数相加,再加上CPSR中的C条件标志位的值,并将结果存放到目的寄存器中

adds r0, r4, r8 // 加低端的字

adcs r1, r5, r9 // 加第二个字,带进位

adcs r2, r6, r10 // 加第三个字,带进位

adc r3, r7, r11 // 加第四个字,带进位

相关推荐
fengye20716120 小时前
板凳————————————(枯藤 )vs2019+win10
汇编
T.Ree.1 天前
汇编_movsd和stosd
汇编
日更嵌入式的打工仔1 天前
MCUXpresso开启汇编调试
汇编·单片机·nxp·mcuxpresso
切糕师学AI2 天前
ARM中的汇编指令:MRS和MSR
汇编·嵌入式开发
缘友一世3 天前
计算系统安全速成之汇编基础【1】
汇编
white-persist4 天前
【攻防世界】reverse | IgniteMe 详细题解 WP
c语言·汇编·数据结构·c++·python·算法·网络安全
小邓   ༽4 天前
50道C++编程练习题及解答-C编程例题
c语言·汇编·c++·编程练习·c语言练习题
资料,小偿6 天前
4.1.2基于51单片机汇编语言出租车计价器proteus仿真出租车计价器,汇编语言51单片机
汇编·51单片机·proteus
ol木子李lo8 天前
Visual studio 2022高亮汇编(ASM)语法方法
汇编·ide·windows·visual studio
资料,小偿9 天前
4.1.1基于51单片机汇编语言出租车计价器可切换白天黑夜,可修改价格
汇编·51单片机·proteus