DLLec3b Notes
DLLec3b Notes
Binary Addition with a Carry of 1 : When there is a carry of 1, a situation arises in which three bits are being added
(a bit in each of the two numbers and a carry bit)
0-0=0
1-1=0
1-0=1
10 - 1 = 1 0 - 1 with a borrow of 1
1
1.3 Binary Multiplication
Basic Rules of Multiplication
0×0=0
0×1=0
1×0=0
1×1=1
• Multiplication is performed with binary numbers in the same manner as with decimal numbers.
• It involves forming partial products by
1. shifting each successive partial product left one place
2. adding all the partial product.
2 Signed Numbers
• In general, there are two types of complements for each base-r system [2]
1. the radix complement (r’s complement)
2. the diminished radix complement. ((r-1)’s complement)
• The complement of a binary number is important because they permit the representation of negative numbers.
• There are the 1’s complement and 2’s complement of binary number
• The method of 2’s complement arithmetic is commonly used in computers to handle negative numbers.
• Other than the complement form, there also exists Sign Magnitude Form
The Sign Bit : The left-most bit in a signed binary number is the sign bit, which reflects whether the number is
positive or negative.
A 0 is for positive
A 1 is for negative
• When a signed binary number is represented in sign-magnitude, the left-most bit is the sign bit and the remaining bits
are the magnitude bits.
• The magnitude bits are in true (uncomplemented) binary for both positive and negative numbers.
2
E.g. The decimal number +25 is expressed as an 8-bit signed binary number is
The decimal number -25 is expressed as 10011001
In the sign-magnitude form, a negative number has the same magnitude bits as the corresponding positive
number but the sign bit is a 1 rather than a 0
** When subtracting from each digir from 1, we can have either 1 − 0 = 1 or 1 − 1 = 0, which causes a bit to change from 0 to 1 or
from 1 to 0
In the 1’s complement form, a negative number is the 1’s complement of the corresponding positive number.
The (r − 1)’s complement of octal or hexadecimal numbers is obtained by subtracting each digit from 7 or F (decimal
15), respectively
Determine the decimal values of the signed binary numbers expressed in 1’s complement:
(a) 00010111
(b) 11101000
3
2.3 The Radix Complement : (r’s complement)
The r’s complement of an n-digit number N in base r is defined as rn − N for N 6= 0 and 0 for N = 0
Comparing with the (r − 1)’s complement, the r’s complement is obtained by adding 1 to the (r − 1)’s complement i.e.
[(rn − 1) − N ] + 1 = rn − N
10’s Complement :
• The 10’s complement of Decimal 2389 is 7610 + 1 = 7611, which is obtained by adding 1 to the 9’s complement.
Note : If the original number N contains a radix point, the point should be removed temporarily in order to form the
r’s or (r − 1)’s complement.
Determine the decimal values of the signed binary numbers expressed in 2’s complement:
(a) 01010110
(b) 10101010
4
3 Arithmetic Operations with Signed Numbers
3.1 Addition
• The two numbers in an addition are the addend and the augend
• The result is the sum
• There are four cases that can occur when two signed binary numbers are added
1. Both numbers are positive
2. Positive number with magnitude larger than negative number
3. Negative number with magnitude larger than positive number
4. Both numbers are negative.
Case 1: Both numbers are positive
Figure 3: The final carry bit is discarded.The sum is positive and therefore in true (uncomplemented) binary
5
Figure 5: The final carry bit is discarded.The sum is negative and therefore in 2’s complement form.
Figure 6:
The sum of 183 requires eight magnitude bits.
Since there are seven magnitude bits in the numbers (one bit is the sign), there is a carry into the sign bit which produces
the overflow indication.
3.2 Subtraction
Subtraction
• Subtraction is a special case of addition.
• Subtracting the subtrahend from the minuend is equivalent to adding the negative-subtrahend and the minuend
E.g. Subtracting +6 (subtrahend) from +9 (minuend) is adding -6 to +9
* The subtraction operation changes the sign of the subtrahend and adds it to the minuend.
• The result is the difference.
The sign of a positive or negative binary number is changed by taking its 2’s complement
subtract two signed numbers (1) Take the 2’s complement of the subtrahend and add.
(2) Discard any final carry bit.
Perform each of the following subtractions of the signed numbers
(a) 00001000 - 00000011
(b) 00001100 - 11110111
(c) 11100111 - 00010011
(d) 10001000 - 11100010
Solutions !!
6
References
References
[1] Thomas L. Floyd. Digital Fundamentals, 8th edition. Pearson Education Inc., 2003.