Top
Jump to content, Georgia Institute of Technology, College of Engineering, School of Electrical and Computer Engineering (ECE), ECE Research, ECE Research Centers
College of Engineering
Search | Contact ECE | Feedback | BuzzPort
GT Home > COE Home > ECE Home > Academics > ECE 2020
ECE 2020: Fundamentals of Digital Design

FAQ - Arithmetic

Q1: How do I use borrow out to subtract?

Q2: What is an overflow error?

Q3: How do I perform binary subtraction?

Q4: How to carry out/ borrow out indicate overflow errors?

Q1:
I am having troubles with subtracting binary numbers. I know I have to
borrow out from the bottom but what happens when I reach the end. Can
you refresh my memory on this topic. The book has a different way of
doing with adding the 2s complement.

If the bits being subtracted (B and Bin) exceed A, just assert the
borrow out (Bo), and add 2 to A before subtracting. Since borrow out
subtracts one from the next bit position (worth twice as much), you
get two instead of one.

Nothing is different at the most significant bit. Borrow out of the
MSB indicates an overflow for unsigned representations. For signed
two's complement, borrow out means nothing.

Q2:
I have a few questions regarding the addition of binary numbers.
What is meant by an unsigned or signed error? I get the idea that an
unsigned error is simply when the sum of the two X bit binary numbers
is of the size X. I'm confused how to find out whether an error is
present for signed bits however.

An overflow error occurs when the result of an operation falls outside
the number range supported by a representation.

For unsigned representations, this is indicated by a carry out/ borrow
out of the most significant bit OF THE REPRESENTATION. This indicates
that the resulting value is either too large, or negative.

For signed two's complement representations, overflow is indicated
when the sign of the result is clearly incorrect based on the signs of
the operands. In addition, adding two positive numbers (indicated by
the most significant bit OF THE REPRESENTATION) and getting a negative
result; or adding two negative numbers and getting a positive result
indicates an overflow. For subtraction, overflow occurs when a
positive value minus a negative value results in a negative or when a
negative value minus a positive value results in a positive value.

Q3:
I couldn't figure out how to do the problem 0100 - 1111 = 1011. The
answer I get is 1011. I borrow 1 , which is 2 because its binary so I
get 1. Then I give back that 1 which makes it 3 in the bottom , then I
borrow 2+2=4 , and 4-3 gives me 1. Then I give back those 2's which
makes it 5 and I borrow two 2's which makes it 5 and I get 5-5 =0.Then
I give back those 2's which makes it 5 and I borrow three two's and I
get 6-5=1 that is how I get 1011, but the result is 0101. Can you
please explain to me where my method is going wrong?

Lets consider each bit place of this subtraction; we'll label them DCBA.

In A, 1 is subtracted from 0, a borrow out is generated, 2
is obtained, 1 is subtracted, result is 1

In B, 1 is subtracted, borrow in is 1, a borrow out is generated, 2 is
obtained, 2 (1 and borrow in) is subtracted, result is 0

In C, the 1s cancel, borrow in is 1, a borrow out is generated, 2 is
obtained, 1 (borrow in) is subtracted), the result is 1

In D, this is identical to B, result is 0

Q4:
When adding binary terms, does the overflow occur only when there is a
carry out? Is this true for both signed and unsigned representations?

Carry-Out Borrow-out being high indicates an overflow for unsigned
representations. For signed two's compliment, it means
nothing. Instead, the signed of the inputs and result should be
compared relative to the operation. Adding two positives to produce a
negative or adding two negatives to produce a positive indicates an
overflow error. For subtraction, a positive minus a negative yielding
a negative or a negative minus a positive yielding a positive
indicates overflow.