Está en la página 1de 63

Digital Logic Design

Module 1 : Number Systems Prof. Hansa Shingrakhia

Electronics and Communication Engineering Department Indus Institute of Technology and Engineering

Number

s stems Decimal s stem Bi ar , ctal and ex s stems Number conversion, decimal to binar , binar to decimal Complements Subtraction met ods Codes: Binar , Gray, Error detection Binary Logic

A bit is a single binary digit (a or 0). A byte is 8 bits A word is 32 bits or 4 bytes Long word = 8 bytes = 64 bits Quad word = 6 bytes = 28 bits Programming languages use t ese standard number of bits w en organizing data storage and access. W at do you call 4 bits? ( int: it is a small byte)

System Decimal Binary Octal Hexadecimal

Base 0 2 8 6

Symbols 0, , 9 0, 0, , 7 0, , 9, A, B, F

Used by Used in humans? compute rs? Yes No No No No Yes No No

The

decimal system is composed of 0 numerals or symbols. These 0 symbols are 0, , 2, 3, 4, 5, 6, 7, 8, 9. Using these symbols as digits of a number, we can express any quantity. The decimal system is also called the base-10 system because it has 10 digits.

The decimal number system is a positional number system

103

102

101

100

10-1

10-2

10-3

=1000 Most Signifi cant Digit

=100

=10

=1

=0.1

=0.01

=0.001 Least Signifi cant Digit

Decimal point

Even though the decimal system has only 10 symbols, any number of any magnitude can be expressed by using our system of positional weighting.

= (an-1an-2 ... a1a0 . a-1a-2 ... a-m)r


. = radix point r = radix or base n = number of integer digits to the left of the radix point m= number of fractional digits to the right of the radix point an-1 = most significant digit (MSD) a-m = least significant digit (LSD)

where

N = an-1 x rn-1 + an-2 x rn-2 + ... + a0 x r0 + a-1 x r-1 ... + a-m x r-m = (an-1 an-2 . a0 a-1 . a-m )

Example N = (251.41)10 (Positional Notation) = 2 x 102 + 5 x 101 + 1 x 100 + 4 x 10-1 + 1 x 10-2 (Polynomial Notation)

5 6 2 1
103 102 101 100

1 X 100 2 X 101 6 X 102 5 X 103

= 1 = 20 = 600 = 5000

In

the binary system there are only two symbols or possible digit values, 0 and 1. This base-2 system can be used to represent any quantity that can be represented in decimal or other base system.
22 =4 21 =2 20 =1 . Binary point 2-1 =0.5 2-2 =0.25 2-3 =0.125 Least Signifi cant Digit

23 =8 Most Signifi cant Digit

23

22 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

21 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

20 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

The

Binary counting sequence is shown in the table:

0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

In

digital systems the information that is being processed is usually presented in binary form. Binary quantities can be represented by any device that has only two operating states or possible conditions. E.g.. a switch is only open or closed. We arbitrarily (as we define them) let an open switch represent binary 0 and a closed switch represent binary 1. Thus we can represent any binary number by using series of switches.

Binary

1: Any voltage between 2V to 5V Binary 0: Any voltage between 0V to 0.8V Not used: Voltage between 0.8V to 2V in 5 Volt CMOS and TTL Logic, this may cause error in a digital circuit. Today's digital circuits wor s at 1.8 volts, so this statement may not hold true for all logic circuits.

The

octal number system has a base of eight, meaning that it has eight possible digits: 0,1,2,3,4,5,6,7.

Each

Octal number is equivalent to 3 binary


82 =64 81 =8 80 =1 . Octal point 8-1 =1/8 8-2 =1/64 8-3 =1/512 Least Signifi cant Digit

bits
83 =512 Most Signifi cant Digit

Octal

to Decimal Conversion 2378 = 2 x (82) + 3 x (81) + 7 x (80) = 15910

11.18 = 1 x (81) + 1 x (80) + 1 x (8-1) = 9.12510

To convert binary to octal make groups of 3 bits each from right and replace each group with octal number 0101010111010011 0 101 010 111 010 011 0 5 2 1 2 3

The

hexadecimal system uses base 16. Thus, it has 16 possible digit symbols. It uses the digits 0 through 9 plus the letters A, B, C, D, E, and F as the 16 digit symbols.

163 =4096 Most Signifi cant Digit 162 =256 161 =16 160 =1 . Hexa Decim al point 16-1 =1/16 16-2 =1/25 6 16-3 =1/40 96 Least Signifi cant Digit

Binary

Decimal

Hexadecimal

0000 0001 0010

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0 1 2 3 4 5 6 7 8 9 A B C D E F

Hexadecimal

to Decimal Conversion (160) +6x

0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

24.616 = 2x +4x (16-1) = 36.37510 (161)

To convert binary to hex, make groups of 4 binary bits beginning with LSB. Write equivalent symbol for each group.

Converting

from one code form to another code form is called code conversion, li e converting from binary to decimal or converting from hexadecimal to decimal.

Conversion Among Bases


The possibilities:
Decimal Octal

Binary

Hexadecimal

Deci al

Octal

Binary

Hexadeci al

Next slide

Weight

12510 =>

5 x 100= 5 2 x 101= 20 1 x 102= 100 125

Base

Decimal

Octal

Binary

Hexadecimal

Technique

Multiply each bit by 2n, where n is the weight of the bit 1 The weight is the position of the bit, starting from 0 on the right Add the results

Bit 0

1010112 =>

1 1 0 1 0 1

x x x x x x

20 21 22 23 24 25

= 1 = 2 = 0 = 8 = 0 = 32 4310

Binary

to decimal 10.1011 => 1 1 0 1 0 1

x x x x x x

2-4 2-3 2-2 2-1 20 21

= = = = = =

0.0625 0.125 0.0 0.5 0.0 2.0 2.6875

Decimal

Octal

Binary

Hexadecimal

Technique

Multiply each bit by 8n, where n is the weight of the bit The weight is the position of the bit, starting from 0 on the right Add the results

7248 =>

4 x 80 = 2 x 81 = 7 x 82 =

4 16 448 46810

Decimal

Octal

Binary

Hexadecimal

Technique

Multiply each bit by 16n, where n is the weight of the bit The weight is the position of the bit, starting from 0 on the right Add the results

ABC16 =>

C x 160 = 12 x 1 = 12 B x 161 = 11 x 16 = 176 A x 162 = 10 x 256 = 2560 274810

Decimal

Octal

Binary

Hexadecimal

Technique

Divide by two, eep track of the remainder First remainder is bit 0 (LSB, least-significant bit) Second remainder is bit 1 Etc.

12510 = ?2

2 125 2 62 2 31 2 15 7 2 3 2 1 2 0

1 0 1 1 1 1 1

12510 = 11111012

Decimal
3.14579

to binary

.14579 x 2 0.29158 x 2 0.58316 x 2 1.16632 x 2 0.33264 x 2 0.66528 x 2 1.33056 etc.

11.001001...

Decimal

Octal

Binary

Hexadecimal

Technique

Convert each octal digit to a 3-bit equivalent binary representation

Example

7058 = ?2 7 0 5

111 000 101


7058 = 1110001012

Decimal

Octal

Binary

Hexadecimal

Technique

Convert each hexadecimal digit to a 4-bit equivalent binary representation

10AF16 = ?2

0001 0000 1010 1111

10AF16 = 00010000101011112

Decimal

Octal

Binary

Hexadecimal

Technique

Divide by 8 Keep track of the remainder

123410 = ?8 8 8 8 8 1234 154 19 2 0 2 2 3 2 123410 = 23228

Decimal

Octal

Binary

Hexadecimal

Technique

Divide by 16 Keep track of the remainder

123410 = ?16 16 16 16 1234 77 4 0

2 13 = D 4

123410 = 4D216

Decimal

Octal

Binary

Hexadecimal

Technique

Group bits in threes, starting on right Convert to octal digits

10110101112 = ?8

1 011 010 111

10110101112 = 13278

Decimal

Octal

Binary

Hexadecimal

Technique

Group bits in fours, starting on right Convert to hexadecimal digits

10101110112 = ?16

10 1011 1011

10101110112 = 2BB16

Decimal

Octal

Binary

Hexadecimal

Technique

Use binary as an intermediary

10768 = ?16
1 0 7 6

Make a group of 4 bit From right side & assign decimal digit to this group of 4 bit

001 000

111 E

110

10768 = 23E16

Decimal

Octal

Binary

Hexadecimal

Technique

Use binary as an intermediary

1F0C16 = ?8 1 F 0 C

0001

1111

0000

1100

1F0C16 = 174148

Decimal 33

Binary 1110101

Octal

Hexadecimal

703 1AF
Dont use a calculator! Skip answer Answer

Answer

Decimal Binary 33 100001 117 1110101 451 111000011 431 110101111

Octal 41 165 703 657

Hexadecimal 21 75 1C3 1AF

Base

10

Power
10-12 10-9 10-6 10-3 103 106 109 1012

Preface pico nano icro illi kilo ega giga tera k M G T p n


Q

ol

Val e .000000000001 .000000001 .000001 .001 1000 1000000 1000000000 1000000000000

Base

Power
210 220 230

Preface kilo ega Giga k M G

ol

Val e 1024 1048576 1073741824

What is the value of k, M, and G? In computing, particularly w.r.t. memory, the base-2 interpretation generally applies

In the lab 1. Double click on My Computer 2. Right click on C: 3. Click on Properties

/ 230 =

También podría gustarte