Digital Logic Design: Federal Urdu University of Arts Science and Technology Islamabad
Digital Logic Design: Federal Urdu University of Arts Science and Technology Islamabad
Lecture 2
Federal Urdu University of Arts Science and Technology Islamabad
Binary Arithmetic
• Sum of two binary numbers is calculated by
the same rules as in decimal. • Example: Carry bits
• Only difference is that Digits of the sum in any 111 1
significant position can be only 0 or 1. augend: 101101
• If carry obtained in a given significant position addend: +100111
is used by the pair of digits one significant
position higher. sum: 1010100
• There are four basic rules for addition:
•
Binary Subtraction
• Subtraction is slightly more complicated. • Example:
• The rules are still the same as in decimal
• The only difference is that the borrow in a
given significant position adds 2 to a minuend Minuend:
digit. (A borrow in the decimal system adds
10 to a minuend digit).
• The four basic rules of subtraction are: Subtrahend:
•
Difference:
Binary Multiplication
• To perform a binary multiplication problem,
we need to understand how addition works • Example
with binary numbers
• Follow the same process of multiplication
and addition we would use with decimal
numbers.
• The four basic rules of multiplication:
Product
Binary Division
• The binary division is done similar to the
decimal division.
• we also need to follow the binary subtraction
rules while performing the binary division.
•Example:
Dividend:
• The dividend involved in binary division should
be greater than the divisor.
• The following are the two important points,
which need to be remembered while Divisor:
performing the binary division.
• If the remainder obtained by the division process
is greater than or equal to the divisor, put 1 in the
quotient and perform the binary subtraction.
• If the remainder obtained by the division
process is less than the divisor, put 0 in the
quotient and append the next most
significant digit from the dividend to the
remainder.
Summary of Binary Arithmetic
Complements of Numbers
• Complements are used in digital computers:
• To simplify the subtraction operation and for logical manipulation.
• There are two types of complements for each base‐r system:
• the radix complement
• the diminished radix complement.
• The first is referred to as the r’s complement and the second as the (r - 1)>s
complement.
• The two types are referred to as the 2’s complement and 1’s complement for
binary numbers and the 10’s complement and 9’s complement for decimal
numbers
Diminished Radix Complement - (r-1)’s
Complement
• Given a number N in base r having n digits, the (r–1)’s complement of N is defined as:
(rn –1) – N
• Example for 6-digit decimal numbers:
• 9’s complement is (rn – 1)–N = (106–1)–N = 999999–N
• 9’s complement of 546700 is 999999–546700 = 453299
• Example for 7-digit binary numbers:
• 1’s complement is (rn – 1) – N = (27–1)–N = 1111111–N
• 1’s complement of 1011000 is 1111111–1011000 = 0100111
• Observation:
• Subtraction from (rn – 1) will never require a borrow
• Diminished radix complement can be computed digit-by-digit
• For binary: 1 – 0 = 1 and 1 – 1 = 0
The (r-1)’s Complement (Conti…)
9
9
The (r-1)’s Complement (Conti…)
10
10
The (r-1)’s Complement (Conti…)
11
11
Radix Complement
• Example: Base-10
The 10's complement of 012398 is 987602
The 10's complement of 246700 is 753300
• Example: Base-2
The 2's complement of 1101100 is 0010100
The 2's complement of 0110111 is 1001001
Subtraction with r’s Complement (Conti…)
13
13
Subtraction with r’s Complement (Conti…)
14
14
Subtraction with r’s Complement (Conti…)
15
•.
15
Subtraction with r’s Complement (Conti…)
16
16
Subtraction with (r-1)’s Complement
17
17
Subtraction with (r-1)’s Complement (Conti…)
18
•.
•.
•.
20
Subtraction with (r-1)’s Complement (Conti…)
21
•.
21
Signed Binary Numbers
22
24
Signed Binary Numbers (Conti…)
25
• In this convention, a number has magnitude and a symbol (+ or -) or a bit
(0,1).
25
Signed Binary Numbers (Conti…)
26
28
Thanks