EasyManua.ls Logo

Xilinx MicroBlaze - Page 273

Xilinx MicroBlaze
316 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
MicroBlaze Processor Reference Guide 274
UG984 (v2018.2) June 21, 2018 www.xilinx.com
Chapter 5: MicroBlaze Instruction Set Architecture
rsub
Arithmetic Reverse Subtract
rsub
rD, rA, rB
Subtract
rsubc
rD, rA, rB
Subtract with Carry
rsubk
rD, rA, rB
Subtract and Keep Carry
rsubkc
rD, rA, rB
Subtract with Carry and Keep Carry
0 0 0 K C 1 rD rA rB 0 0 0 0 0 0 0 0 0 0 0
0 6 11 16 21
31
Description
The contents of register rA is subtracted from the contents of register rB and the result is placed into
register rD. Bit 3 of the instruction (labeled as K in the figure) is set to one for the mnemonic rsubk.
Bit 4 of the instruction (labeled as C in the figure) is set to one for the mnemonic rsubc. Both bits are
set to one for the mnemonic rsubkc.
When an rsub instruction has bit 3 set (rsubk, rsubkc), the carry flag will Keep its previous value
regardless of the outcome of the execution of the instruction. If bit 3 is cleared (rsub, rsubc), then the
carry flag will be affected by the execution of the instruction.
When bit 4 of the instruction is set to one (rsubc, rsubkc), the content of the carry flag (MSR[C]) affects
the execution of the instruction. When bit 4 is cleared (rsub, rsubk), the content of the carry flag does
not affect the execution of the instruction (providing a normal subtraction).
Pseudocode
if C = 0 then
(rD)
(rB) + (rA) + 1
else
(rD) (rB) + (rA) + MSR[C]
if K = 0 then
MSR[C]
CarryOut
Registers Altered
•rD
•MSR[C]
Latency
1 cycle
Note
In subtractions, Carry = (Borrow). When the Carry is set by a subtraction, it means that there is no
Borrow, and when the Carry is cleared, it means that there is a Borrow.
Send Feedback

Table of Contents

Other manuals for Xilinx MicroBlaze

Related product manuals