Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

overflow and carry in microprocessor

Status
Not open for further replies.

oermens

Advanced Member level 2
Joined
Nov 19, 2005
Messages
525
Helped
107
Reputation
220
Reaction score
44
Trophy points
1,308
Location
canada
Activity points
3,988
Please clairfy this example:

If I add X=Y=1010 and Cin = 0

Code:
   Cout     Cin
     |       |
     1 0 1 0 0    C
--------------------
       1 0 1 0    X
+      1 0 1 0    Y
-------------------
       0 1 0 0    S

If I consider Cin as C(0) and Cout as C(4), is V determined by C(4) xor C(3) or C(3) xor C(2). Either way is 1 but whcih is correct way to obtain V.
 

Re: overflow and carry

i don't really get what is V, but what i can see in that example, it's just a binary sum.

first of all lines, is the evolution of the carry. Frist we start with a 0 carry (C0), and we add first two bits: 0 + 0 = 0, and we get no carry --> C1 = 0.

Then we sum next two bits plus the carry we got (which is still 0): 0 + 1 + 1 = 0, but now the new carry is 1 --> C2 = 1

Once again, we sum up next two bits plus new carry: 1 + 0 + 0 = 1, with no carry --> C3 = 0.

Finally we add up last two bits, with the gotten carry: 0 + 1 + 1 = 0, and we have a final carry --> C4 = 1.

Then as a conclusion: Cin + X + Y = S, and Cout = 1
 

Re: overflow and carry

your question is not clear,
what is v?
 

Dear Friend,
if V is OVERFLOW flag? then ur assumption seems to be wrong. you are assigning value of CARRY to Overflow, OVERFLOW and CY are littlebit different while dealing with signed and unsigned nos. In microprocessor or controller (8 bit), if you are doing unsigned nos addition, carry-put from bit 6 but not out of bit 7,or a carry-out of bit 7 but not out of bit 6, the OVERFLOW is set, otherwise cleared. But CY may be set depending upon the carry out of bit 7.When adding signed integers, OVERFLOW indicates a negative number produced as the sum of two positive operands, or a positive sum from two negative operands.

Hope this helps you.
regards
JSPS
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top