0% found this document useful (0 votes)
1 views

U13 DPSD - Arithmetic Operations

Uploaded by

24f2001081
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

U13 DPSD - Arithmetic Operations

Uploaded by

24f2001081
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

UNIT - I

BOOLEAN ALGEBRA AND LOGIC GATES


Number System
Binary Addition
 Binary addition is very simple.
 This is best shown in an example of adding two binary numbers…

1 1 1 1 1 1 carries
1
1 1 1 0 1 Augend
+ 1 0 1 1 1 Addend
---------------------
1 0 1 0 1 0 0 Sum
Binary Subtraction
° We can also perform subtraction (with borrows in place of carries).
° Let’s subtract (10111)2 from (1001101)2…

1 10 borrows
0 10 10 0 0 10
Minuend
1 0
0 1 1 0 1
- 1 0 1 1 1 Subtrahend
------------------------
Difference
1 1 0 1 1 0
Binary Multiplication
 Binary multiplication is much the same as decimal multiplication, except
that the multiplication operations are much simpler…

1
0 1 1 1 Multiplicand
X 1 0 1 0 Multiplier
-----------------------
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
-----------------------
1 1 1 0 0 1 1 0 Product
Complements
• Used to simplifying the subtraction
• Simplification lead to simpler and less expensive circuits
to implement

Radix / Base r 2 10
Radix complement r 2 10
Diminished radix complement r-1 1 9
Complements
999999
– 9’s complement -546700
• Subtract each digit from 9
453299
– 10’s complement
• Subtract each digit from 9 and add 1 to the result
• Subtract the first non zero from 10 and all others from 9
• Count the number of digit and subtract from 10n

999999
-546700 9 9 9 10 - -
1000000
453299 -5 4 6 7 0 0
- 546700
+ 1 453 3 00
453300
453300
Complements
– 1’s complement 1111111
– Find the inverse of the given number 1011000

0100111
– 2’s complement
– Find the inverse of the given number and add 1 to the result
– Keep the first non zero as such and then complement the others
– Count the number of digit and subtract from 2n

1111111
1011000 1112 - - -
10000000
0100111 -1 0 1 1 0 0 0
-1011000
+ 1 0 101000
0101000
0101000
Subtraction with r’s Complement

• The subtraction of two positive numbers (M - N), both of base r, may


be done follows:
1. Add the minuend M to the r’s complement of the subtrahend N.
2. Insert the result obtained in step 1 for an end carry:
(a). If an end carry occurs, discard it.
(b). If an end carry does not occur, take the r’s complement of the
number obtained in the step 1 and place a negative sign in front.
Subtraction with Complement
• 52532 – 3250

Radix 52532 3250


R-1 47467 96749
R 47468 96750

+ 52532
9’s comp 96749 + 52532
149281 10’s comp 96750
(carry Positive , 9’s comp so add
149282
carry) 1
(carry Positive , 10’s comp so
49282
discard carry)
49282
Subtraction with Complement
• 3250 - 52532
Radix 52532 3250
R-1 47467 96749
R 47468 96750

+ 03250 + 03250
9’s comp 47467 10’s comp 47468
50717 50718
(No carry , negative (No carry , negative
Find 9’s complement ) Find 10’s complement )
- 49282 -49282
Subtraction with Complement
• 1010100 – 1000011
Radix 1010100 1000011
R-1 0101011 0111100
R 0101100 0111101

+ 1010100
1’s comp 0111100

10010000 + 1010100
(carry Positive , 1’s comp so add carry) 2’s comp 0111101
1
10010001
0010001
(carry Positive , 2’s comp so discard
carry)

0010001
Subtraction with Complement
• 1000011 – 1010100
Radix 1010100 1000011
R-1 0101011 0111100
R 0101100 0111101

+1000011 +1000011
1’s comp 0101011 2’s comp 0101100
1101110
1101111
(No carry , negative
Find 1’s complement ) (No carry , negative
-0010001 Find 2’s complement )
-0010001
Signed Binary Numbers

Sign Magnitude
bit

Sign bit : 0 - Negative number


1 - Positive Number

Number : 10101
Signed: 10101 = -5
Unsigned : 10101 = 21
Signed Binary Numbers

• Representation:
Signed Binary Numbers

September 5, 2003
Signed Binary Numbers
■ Arithmetic Addition

signed-magnitude Addition

The addition of two numbers in the signed-magnitude system follows the rules
of ordinary arithmetic.
If the signs are the same, we add the two magnitudes and give the sum the
common sign.
If the signs are different, we subtract the smaller magnitude from the larger
and give the difference the sign of the larger magnitude.

 The addition of two signed binary numbers with negative numbers


represented in signed-2's-complement form is obtained from the addition of
the two numbers, including their sign bits.
 A carry out of the sign-bit position is discarded.
Signed Binary Numbers
■ Arithmetic Addition

 Signed-2’s Complement Addition


 The addition of two signed binary numbers with negative numbers
represented in signed-2's-complement form is obtained from the
addition of the two numbers, including their sign bits.
 A carry out of the sign-bit position is discarded.
 If the sign bit is 1 then find the 2’s complement of the number
Signed Binary Arithmetic Addition
■ Arithmetic Subtraction

Negative numbers are changed into positive numbers using r’s complement

(+A) –(+B) = (+A) + (-B)


(+A) –(-B) = (+A) + (+B)
Signed Binary Arithmetic Addition
+6 00000110 6 13

Signed Mag. 00000110 00001101


00001101
+13 -6 -13
+19 00010011 2’s comp 11111010 11110011

+6 00000110
-13 11110011
-6 11111010
-7 11111001 -6 11111010
+13 00001101
sign bit 1 so find 2’s comp. -13 11110011
+7 100000111
-19 111101101
Discard carry, sign bit 0
Discard Carry
sign bit 1 so find 2’s comp.

You might also like