DLD 2022 2

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

Digital Logic Design

Number Systems
Fall 2022
Decimal Numbers
• The decimal number system has ten digits (0-9)
• The decimal number system has a base of 10
• The position of each digit in a decimal number indicates the
magnitude and assigned with weight.
………105 104 103 102 101 100

• For fractional numbers, the weights are negative powers of ten


that decrease from left to right beginning with 10 -1

.
……………102 101 100 10-1 10-2 10-3 ………..

2
Decimal Numbers
• The value of a decimal number is the sum of the digits
multiplied by its weight

• Example: Express the decimal number 568.23 as a sum of the


values of each digit
568.23 = (5x102) + (6x101) + (8x100) + (2x10-1) + (3x10-2)
= (5x100) + (6x10) + (8x1) + (2x0.1) + (3x0.01)
= 500+60+8 + 0.2+0.03
= 568.23

3
Binary Numbers
• The binary number system has two digits (bits) 0 and 1
• The binary number system has a base of 2
• The weight or value of a bit increases from right to left in a
binary number

4
Binary Numbers
• The right-most bit is the LSB (least significant bit) in a binary
number and has a weight of 20 = 1
• The weights increase from right to left by a power of two for
each bit
• The left-most bit is the MSB (most significant bit)

• Fractional numbers can also be represented in binary


• The left-most bit is the MSB in a binary fractional number and
has a weight of 2-1
• The fractional weights decrease from left to right by a negative
power of two for each bit

………23 22 21 20 . 2-1 2-2 …………


5
Binary to Decimal

• Example: Convert the binary number 1101101 to decimal


• Determine the weight of each bit, and then find the sum of the
weights to get the decimal number
Weight: 2 6 25 24 23 22 21 20
Binary number: 1 1 0 1 1 0 1

1101101 = 64+ 32 + 0 + 8 + 4 + 0 + 1
= 109
6
Decimal to Binary
• Sum-of-Weights Method
• To get the binary number for a given decimal number, find the
binary weights that add up to the decimal number
23 2 2 2 1 2 0
1 0 0 1 Binary number for decimal 9

7
Decimal to Binary
• Repeated Division-by-2 Method
• To get the binary number for a given decimal number, divide the
decimal number by 2 until the quotient is 0. Remainders form
the binary number.
• Convert the following decimal numbers to binary: (a) 19 (b) 45

8
Binary Arithmetics
• Binary Addition

• Add the following binary numbers:


(a) 11 + 11 (b) 100 + 10 (c) 111 + 11 (d) 110 + 100

9
Binary Arithmetics
• Binary Subtraction

• Subtract the following binary numbers:


(a) 11- 01 (b) 11-10 (c) 101 - 11 (d) 101 - 011

10
Binary Arithmetics
• Binary Multiplication

11
Binary Arithmetics
• Binary Division
• Perform the following binary divisions:

12
Complements of Binary Numbers
• The 1’s complement and the 2’s complement of a binary
number represents the negative numbers
• 2’s complement is commonly used in computers to handle
negative numbers

13
Complements of Binary Numbers
• 1’s Complement
• The 1’s complement of a binary number is found by
changing all 1s to 0s and all 0s to 1s:

14
Complements of Binary Numbers
• 2’s Complement
• The 2’s complement of a binary number is found by adding
1 to the LSB of the 1’s complement
2’s complement = (1’s complement) + 1

15
Signed Numbers
• Digital systems must be able to handle both positive and
negative numbers. A signed binary number consists of both
sign and magnitude information. The sign indicates
whether a number is positive or negative, and the
magnitude is the value of the number

• There are three forms in which signed integer numbers can


be represented in binary:
– Sign-magnitude form
– 1’s complement form
– 2’s complement form

16
Signed Numbers

17

You might also like