Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
Carry-Bit vs. Documentation
Jump...
Cancel
Locked
Locked
Replies
2 replies
Subscribers
118 subscribers
Views
3112 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
Carry-Bit vs. Documentation
Rene Henke
over 12 years ago
Note: This was originally posted on 27th June 2012 at
http://forums.arm.com
Hello,
in every documentation I found something like
"A carry occurs (..)
, if the result of a subtraction is positive, (...)."
If I understand this right after a substraction (this is important) with a negativ (N = 1) result there can´t occur a carry, isn´t it?
For examble if I try
0x7FFF FFFF - 0xFFFF FFFF = 0x8000 0000
The CPSR are set like this NzcVqIFt_SVC => N = 1, C = 0, V = 1
After a substraction - Carry (borrow) = 0 means we have a borrow! Right?
So a carry occurs but the result is negativ!
Is the documentation right and complete? Or is there something missing or I´m completely wrong?
Thanks
René
Parents
Simon Craske
over 12 years ago
Note: This was originally posted on 27th June 2012 at
http://forums.arm.com
Subtract / compare can produce all combinations of flags except negative-zero (N=1, Z=1) and (N=0, C=0, V=1);
however, the combinations of (N=0, C=0, V=0, Z=1) and (N=0, C=1, V=1, Z=1) require the use of SBCS/RSCS (subtract with carry).
A simple subtract of the value one from value minus-one will produce a negative result (minus-two) and set the carry flag (not borrow).
In summary, I don't think the documentation you are referring to is definitive.
hth
s.
Cancel
Vote up
0
Vote down
Cancel
Reply
Simon Craske
over 12 years ago
Note: This was originally posted on 27th June 2012 at
http://forums.arm.com
Subtract / compare can produce all combinations of flags except negative-zero (N=1, Z=1) and (N=0, C=0, V=1);
however, the combinations of (N=0, C=0, V=0, Z=1) and (N=0, C=1, V=1, Z=1) require the use of SBCS/RSCS (subtract with carry).
A simple subtract of the value one from value minus-one will produce a negative result (minus-two) and set the carry flag (not borrow).
In summary, I don't think the documentation you are referring to is definitive.
hth
s.
Cancel
Vote up
0
Vote down
Cancel
Children
No data