0% found this document useful (0 votes)
17 views17 pages

L1 - Binary Arithmatic and Complements

The document provides an overview of binary arithmetic, including addition, subtraction, multiplication, and division, explaining how these operations are performed using binary numbers. It also covers the concept of complements, specifically (r-1)'s and r's complements, and their applications in simplifying subtraction and logical manipulation in computing. Exercises are included to reinforce understanding of binary operations and complements.

Uploaded by

vaishaligupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views17 pages

L1 - Binary Arithmatic and Complements

The document provides an overview of binary arithmetic, including addition, subtraction, multiplication, and division, explaining how these operations are performed using binary numbers. It also covers the concept of complements, specifically (r-1)'s and r's complements, and their applications in simplifying subtraction and logical manipulation in computing. Exercises are included to reinforce understanding of binary operations and complements.

Uploaded by

vaishaligupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Digital Design

Binary Arithmetic &


Complements
Introduction
• A Computer understands only Binary
• The Arithmetic and Logical operation is done also in Binary

3+5 =8

0011 + 0101 = 1000


Binary Arithmetic
• Addition
• Subtraction
• Multiplication
• Division
Binary Addition
• Adding bits:
• 0+0= 0
• 0+1= 1
• 1+0= 1
• 1 + 1 = (1) 0
• Adding integers:

1 1 0
0 0 0...... 0 1 1 1 two = 7ten
+ 0 0 0...... 0 1 1 0 two = 6ten
= 0 0 0 . . . . . . 1 (1)1 (1)0 (0)1 two = 13ten
Binary Subtraction
• Bitwise:
• 0-0= 0
• 0 - 1 = (1)1
• 1-0= 1
• 1-1= 0
• Direct Subtraction:

0 0 0......0 1 1 1 two = 7ten


– 0 0 0......0 1 1 0 two = 6ten
= 0 0 0...... 0 0 0 1two = 1ten
Binary Multiplication
• Bitwise:
• 0*0= 0
• 0*1= 0
• 1*0= 0
• 1*1= 1
• Direct Multiplication: 1 0 0 0 two = 8ten multiplicand
1 0 0 1 two = 9ten multiplier
____________

1000
0000 partial products
0000
1000
____________
1 0 0 1 0 0 0two = 72ten
Binary Division
• Bitwise:
• 0/0= not defined
• 0/1= 0
• 1/0= not defined
• 1/1= 1
• Direct Division:
Exercise
• 1111 + 1010 Ans: 11001
• 1101 – 1001 Ans: 0100
• 1001 – 0111 Ans: 0010
• 1011 * 1101 Ans: 10001111
• 11001 / 101 Ans: 101
Complements
• Why Complements ….?
• To simplify the subtraction operation and for logical
manipulation
• Computer does not directly subtract, it adds…

• Two Types of Complements


• (r-1)’s complement
• r’s complement
r is the radix of a given number
(r-1)’s Complements
• Given a number ‘N’ in base ‘r’ having ‘n’ digits
• The r’s complement is given by:

(rn - 1) - N
• Hence in computing system: there exists
• 9’s complement
• 7’s complement
• 1’s complement
• 15’s complement
(r-1)’s Complements
• Example (rn - 1) - N
For r = 10, N = 123410, n = 4 (4 digits),we have:
(rn - 1) = 10,000 -1 = 999910
The 9's complement of 123410 is then:
999910 - 123410 = 876510
r’s Complements
• Given a number ‘N’ in base ‘r’ having ‘n’ digits
• The r’s complement is given by:
rn - N for N 0 and
0 for N = 0

• Hence in computing system: there exists


• 10’s complement
• 8’s complement
• 2’s complement
• 16’s complement
r’s Complements
• Examplern - N for N 0 and
0 for N = 0

For r = 10, N = 123410, n = 4 (4 digits), we have:


rn = 10,00010
The 10's complement of 123410 is then
10,00010 - 123410 = 876610 or 8765 + 1 (9's complement
plus 1)
• Important note from the equation
Note that the Radix Complement is obtained by adding 1 to the
Diminished Radix Complement.
Binary 1’s Complement Example
Binary 2’s Complement Example
For r = 2, N = 011100112, n = 8 (8 digits), we have:

(rn ) = 25610 or 1000000002

The 2's complement of 011100112 is then:


1000000002
- 01110011 2
----------------
100011012

Note that this is the 1's complement plus 1.


Shortcuts
Exercise
• Find 1’s complement of: 1000, 1010, 0101
• Find 2’s complement of: 1000, 1010, 0101

You might also like