0% found this document useful (0 votes)
252 views29 pages

Digital Logic Design: Federal Urdu University of Arts Science and Technology Islamabad

The document discusses binary arithmetic including addition, subtraction, multiplication, and division of binary numbers. It explains how to perform each operation by following the same basic rules as decimal arithmetic. It also covers binary number complements including 1's complement and 2's complement, and how they can be used to simplify subtraction. Finally, it discusses signed binary numbers using both signed magnitude and signed complement representation.

Uploaded by

Pirzada Swati
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)
252 views29 pages

Digital Logic Design: Federal Urdu University of Arts Science and Technology Islamabad

The document discusses binary arithmetic including addition, subtraction, multiplication, and division of binary numbers. It explains how to perform each operation by following the same basic rules as decimal arithmetic. It also covers binary number complements including 1's complement and 2's complement, and how they can be used to simplify subtraction. Finally, it discusses signed binary numbers using both signed magnitude and signed complement representation.

Uploaded by

Pirzada Swati
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/ 29

Digital Logic Design

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

• The (r-1)’s Complement


• The 1’s complement of (101110)2 is (26 – 1) – (101100)2 =
(111111 - 101100)2 = 010011

• The 1’s complement of (0.0110)2 is (1 – 2-4)10- (0.0110)2 =(1-0.0625)10 -


(0.0110)2 =(0.9375)10-(0.0110)2 =(0.1111 – 0.0110) = 0.1001

Fractional part of number is found by multiplying


on the basis.

9
The (r-1)’s Complement (Conti…)
10

• We see from the above examples, that the 9’s


complement of a number is formed simply subtracting
every digit from 9.
• 1’s complement of a binary is formed by simply
changing the bits from 1 to 0 and 0 to 1.

10
The (r-1)’s Complement (Conti…)
11

• The simplest way to obtain the I’s complement of a


binary number with a digital circuit is to use parallel
inverters (NOT circuits),

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

• Example: Using 2’s Comp. Subtract (1010100-1000100)

16
Subtraction with (r-1)’s Complement
17

• Subtraction of two +ve number (M - N) both of base r may be done as


follows,
1. Add the minuend M to the (r-1)’s complement of the subtrahend N.
2. Inspect the result obtained in step 1 for an end carry:
I. If an end carry occurs, add the Most significant digit (End Carry).
II. If an end carry does not occur, take the (r-1)’s complement of the obtained number obtained in
step 1 and place a –ve sign in front of it.

17
Subtraction with (r-1)’s Complement (Conti…)
18

•.

9’s Complement of 03250 = (10)^5 – 1 – 03250 = 100,000-3251=96749


18
Subtraction with (r-1)’s Complement (Conti…)
19

•.

9’s Complement of 72532 = (10)^5 – 1 – 72532 = 100,000-72533=27467


19
Subtraction with (r-1)’s Complement (Conti…)
20

•.

20
Subtraction with (r-1)’s Complement (Conti…)
21

•.

21
Signed Binary Numbers
22

• +ive integers including zero can be represented as an unsigned number.


• For representing –ive numbers, we need a notation for –ive values.
• Due to Hardware limitation, computers must represent everything in
binary forms.
• To do this, Sign is represented by a bit which is at the left most position of
the number.
• Sign bit 0 for +ive and 1 f0r –ive is used.
Signed Binary Numbers (Conti…)
23

• Both signed and unsigned numbers consists of string of bits.


• The User determines whether the number is signed or unsigned, the left most
bit is the signed bit but rest of the bits represent the number.
• If the number is assumed to be unsigned, then the left most bit of the number
is most significant bit of the number.
Signed Binary Numbers (Conti…)
24

• For example 01001 is 9 in decimal (Unsigned Number) or +9 (Signed


binary), because the left most bit is 0.
• The string of bit 11001 is 25 in decimal, when considered it as unsigned.
• -9, when considered as a signed because of the 1 in the left most
position, which shows –ive. Other 4 bits shows the binary number.
• This whole is called the Signed Magnitude Convention.

24
Signed Binary Numbers (Conti…)
25
• In this convention, a number has magnitude and a symbol (+ or -) or a bit
(0,1).

• -25 is represented as 10011001


• This is used in ordinary arithmetic.
• When representing it in computer, a different technique is used called,
• Signed Complement System
• In this system, a –ive is represented by its complement.
• 2’s complement is used to do the operation.
• Consider 9 in binary with 8 bits,
• +9 is represented with 0 bit in left most position followed by binary equivalent of 9 which is
00001001.

25
Signed Binary Numbers (Conti…)
26

• There are three different ways to represent -9 with eight bits.

• In signed-magnitude representation: 10001001


• In signed, 1’s-Complement representation: 11110110
• In signed, 2’s-Complement representation: 11110111
Signed Binary Numbers (Conti…)
27

• In signed magnitude, -9 is obtained from +9 by changing the sign bit


from 0 to 1.
• In signed Complement System, -9 is obtained by taking the complement
of all the bits of +9 including the sign bit.
• +9 00001001
• -9 11110111 (2’s Complement of +9)
Signed Binary Numbers
• Arithmetic 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 if 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.
• Example:

28
Thanks

You might also like