Você está na página 1de 43

DIGITAL LOGIC DESIGN

(DLD)

Lecture # 2

Number Systems
University of Management & Technology

NUMBER SYSTEM

A set of values used to represent different


quantities is know as Number System.

For Example, a number system used to represent


the number of students in a class.

NUMBER SYSTEM
Decimal (0-9)
Binary (0,1)
Octal (0-7)
Hexadecimal (0-15) {0-9, A, B, C, D, E, F}
A=10
B=11
C=12
D=13
E=14
F=15

POPULAR NUMBER SYSTEMS

Binary Number System: Radix = 2


Only

two digit values: 0 and 1

Numbers

Octal Number System: Radix = 8


Eight

digit values: 0, 1, 2, , 7

Decimal Number System: Radix = 10


Ten

are represented as 0s and 1s

digit values: 0, 1, 2, , 9

Hexadecimal Number System: Radix = 16


Sixteen
A

digit values: 0, 1, 2, , 9, A, B, , F

= 10, B = 11, , F = 15

BASE OF NUMBER SYSTEMS

Base of Decimal is 10 i.e (97)10

Base of Binary is 2 i.e (110010)2

Base of Octal is 8 i.e (67)8

Base of Hexadecimal is 16 i.e (E6)16

NUMBER SYSTEM

DECIMAL NUMBER SYSTEM


The weights and position of each digit of the number 453
are as follow
Position

Weights

102

101

100

Face Value

The above indicates that:


The value of digit 4= 4x 102 = 400
The value of digit 5= 5x101 = 50
The value of digit 3= 3x100 = 3
=(453)10
7

BINARY NUMBER SYSTEM

Digital computer represents all kind of data and


information in binary system.

Binary number system consists of two digits 0 and


1.

The positional value of each digit in binary number


is twice the place value or face value of the digit of
its right side.

The weight of each position is power of 2.

BINARY NUMBER SYSTEM

The weights and position of each digit are as follow


Position

Weights

22

21

20

Convert (10111)2 to decimal number:


Position

Face

Weights

24

23

22

21

20

value

(10111)2 =

1x24 + 0x23 + 1x22 + 1x21 + 1x20

= 16 + 0

= (23)

10

+ 4

+2

+1

CONVERSIONS BETWEEN NUMBER


SYSTEM:

To convert value decimal to any other


system (i.e., Binary, Hexadecimal, Octal),
divide decimal value to base of required
system.

To convert value of any other system (i.e.,


Binary, Hexadecimal, Octal) in decimal,
Multiply value to base of that system
which is supposed to convert.
10

DECIMAL TO BINARY

Convert (88)10 to Binary.


2

88

44

2
2
2
2

22
11
5
2
1

0
0
1
1
0

= (1011000)2

11

BINARY TO DECIMAL

Convert (10111)2 to decimal.


(10111)2 = 1x24 + 0x23 + 1x22 + 1x21 + 1x20

= 16 + 0

+ 4

+2

+1

(23)10

12

CONVERT 75 TO BINARY

2
2
2
2
2
2

75
37
18
9
4
2
1

remainder

1
1
0
1
0
0

1001011

13

CHECK (COUNTER EXAMPLE)


BINARY TO DECIMAL

1001011 = 1x20 + 1x21 + 0x22 + 1x23 +


0x24 + 0x25 + 1x26
= 1 + 2 + 0 + 8 + 0 + 0 + 64
= 75
14

SUMMARY

Base10

Successive
Division

Base2

DECIMAL
BINARY
a) Divide the Decimal Number by 2; the remainder is the LSB of Binary
Number .

b) If the Quotient Zero, the conversion is complete; else repeat step (a)
using the Quotient as the Decimal Number. The new remainder is the
next most significant bit of the Binary Number.

Base2
BINARY

Weighted
Multiplication

Base10
DECIMAL

a) Multiply each bit of the Binary Number by it corresponding bitweighting factor (i.e. Bit-020=1; Bit-121=2; Bit-222=4; etc).
b) Sum up all the products in step (a) to get the Decimal Number.

15

PRACTICE EXAMPLES

a) 1310 = ?
b) 2210 = ?
c) 4310 = ?
d) 15810 = ?

16
16

STEPS FOR FRACTIONAL NUMBER


CONVERSION
The following steps are used to convert fractional part of decimal
number to other number systems:

Multiply the fraction part of decimal number


with the base of the system into which fraction is
to be converted. The result may have two parts
i.e. integer part I and fraction part F.
Multiply the resulting fraction part F with the
base again.
Repeat this process until the fraction part
vanishes. The process to end the fraction part
may be unlimited. The user may have to do
minimum 5 steps.

17

CONVERT FRACTIONAL DECIMAL


NUMBERS TO BINARY.

Convert (0.56)10 into binary. Give answer up to 6 decimal.


Result

0.56x2
0.12x2
0.24x2
0.48x2
0.96x2
0.92x2

Fractional Part

1.12
.12
0.24
.24
0.48
.48
0.96
.96
1.92
.92
1.84
.84
0.5610 = (0.100011)2

Integral Part

1
0
0
0
1
1

18

CONVERTING DECIMAL NUMBER (INTEGRAL


AND FRACTIONAL PART) TO BINARY
Convert 56.2510 into binary.
a.

Integral Part
0.25
2
2
2
2
2

56

56

28
14
7
3

b. Fractional Part

Result

0.25x2

0.5x2

0
1

Fractional Part

0.5
1.0

Integral Part

.5

.0

0.2510 = 012

1 - 1
5610 = 1110002

(56.25)10 = (111000.01)2

19

LSB
theleast significant bit(LSB) is the
bitposition in abinaryintegergiving the units value,
that is, determining whether the number is even or
odd. the LSB is sometimes referred to as the rightmost bit, due to the convention inpositional notationof
writing less significant digits further to the right. it is
analogous to the least significantdigitof adecimal
integer, which is the digit in theones(right-most)
position.

Incomputing,

20

MSB

Incomputing, themost significant bit(MSB, also


called thehigh-order bit) is thebitposition in a
binary numberhaving the greatest value. The MSB is
sometimes referred to as theleft-most bitdue to the
convention inpositional notationof writing more
significant digits further to the left.

21

HEXADECIMAL
Hexadecimal

Number system consists of


16 digits from 0 to 9 and A to F. The
alphabets A to F represent decimal
numbers from 10 to 15. The base of this
number system is 16.

The place value of each digit is as follow..


Positio

Weight

164

163

162

161

160

n
s

22

BINARY TO HEXADECIMAL
The following steps are used to convert
binary number to Hexadecimal:
Make

Groups of four binary digits form


right to left.
Add Extra 0 from left side if digits are less
than four.
Convert each group into hexadecimal
number system.

23

BINARY TO HEXADECIMAL

Convert (11010111)2 into Hexadecimal.


Binary Values
Hexadecimal Values

1101
13

0111
7

D
=(D7)16
24

FRACTIONAL BINARY TO
HEXADECIMAL

Make groups of four binary digits starting form


decimal point toward left. Add extra 0s to the left
if required.

Make groups of four binary digits starting form


decimal point toward right. Add extra 0s to the
right if required.

25

FRACTIONAL BINARY TO
HEXADECIMAL
Example: Convert the number 11010.112 to
Hexadecimal number system.
Binary Values

0 00 1

Hexadecimal N.S.

1010 .1 100
10
A

11010.112 = 1A.C16

. 12
C
26

HEXADECIMAL TO BINARY
Convert

(4F)16 to binary.

Hexadecimal values
Binary values

4
0100

15

1111

=(01001111)2

27

HEXADECIMAL TO DECIMAL
Convert (3A)16 to decimal.
(3A)16 =

3x16

+ Ax160

= 3x16

+ 10x1

(58)10

28

CONVERTING DECIMAL NUMBER (INTEGRAL


AND FRACTIONAL PART) TO HEXADECIMAL
Convert 225.22510 into Hexadecimal.
a.

Integral Part
0.225
16 225
14 - 1
0.60x16
E

225

b. Fractional Part

Result

0.225x16

3.60

9.60

.60

0.60x16

Fractional Part

9.60

.60

Integral Part

9
.60

22510 =E116 0.22510 = 3916


(225.225)10 = (E1.39)16

29

DECIMAL TO HEXADECIMAL

Convert (7551)10 to Hexadecimal.


16
16
16

7551
471 - 15
29 - 7
1 - 13

F
D

= (1D7F)16
30

CONVERT FRACTIONAL DECIMAL


NUMBERS TO HEXADECIMAL
Convert 0.310 into Hexadecimal.
Result

0.3x16
0.8x16
0.8x16

Fractional Part

4.8
12.8
12.8

.8
.8
.8

Integral Part

4
12
12

C
C

0.310 =0.4C16
Note: C is the repeating value. It will be taken
once conventionally.

31

OCTAL NUMBER SYSTEM


Octal

Number System consists of eight


digits from 0 to 7. The base of octal
number system is 8. Each digit position in
this system represents a power of 8. Any
number in this system is always less than
8.

The place value of each digit is as follow.


Position

Weights

84

83

82

81

80

32

OCTAL TO DECIMAL
Convert (452)8 to decimal.
(452)8 =

4x8

+ 5x81 + 2x80

= 256 + 40

+2

(298)10

33

DECIMAL TO OCTAL

Convert (119)10 to Octal.


8
8

119
14 - 7
1 - 6
= (167)8

34

CONVERT FRACTIONAL DECIMAL


NUMBERS TO OCTAL
Convert

0.22510 into Octal.


Result

0.225x8
0.80x8
0.40x8
0.20x8
0.60x8

1.80
6.40
3.20
1.60
4.80

Fractional Part

.80
.40
.20
.60
.80

Integral Part

1
6
3
1
4

0.22510 = .163148
35

(INTEGRAL AND FRACTIONAL PART) TO


OCTAL

a.

Convert 225.22510 into Octal.


Integral Part
8
8

225
28 1
3 4

22510 = 3418

255

b. Fractional Part

0.225

As solved in previous slide

0.22510 = .163148

225.25510 = 341.163148

36

OCTAL TO BINARY

Convert (573)8 to Binary.

Octal

values

Binary

values

101

111

011

=(101111011)2

37

FRACTIONAL OCTAL TO BINARY


Example: Convert 25.578 into Binary.
Octal Values
Series
Binary NS

2
5 .
5
7
421 421 . 4 21 421
010 101. 1 01 111

25.578 = 10101.1011112

38

BINARY TO OCTAL
The following steps are used to convert binary
number to octal:
Make Groups of three binary digits form right
to left.
Add Extra 0 from left side if digits are less
than three.
Convert each group into octal number system.
39

BINARY TO OCTAL

Convert (11010111)2 into octal.


Binary Values
Octal Values

011
3

01 0
2

111
7

=(327)8

40

FRACTIONAL BINARY TO OCTAL

Steps:

Make groups of three binary digits starting form


decimal point toward left. Add extra 0s to the left
if required.

Make groups of three binary digits starting form


decimal point toward right. Add extra 0s to the
right if required.

41

FRACTIONAL BINARY TO OCTAL


Example: Convert the number 11010.112 to octal
number system.
Binary Values
Octal N.S.

01 1
3

010 . 1 10
2

11010.112 = 32.68
42

CONVERSION BETWEEN BASES

In general, conversion between bases can be done via decimal:

Base-2
Base-3
Base-4

Base-R

Base-2
Base-3
Decimal
Base-4
.
Base-R

Shortcuts for conversion between bases 2, 4, 8, 16


43

Você também pode gostar