C. Gerousis © Digital Design 3rd Ed., Mano Prentice Hall

Digital vs. Analog

• An analog system has continuous range of values

– A mercury thermometer – Vinyl records – Human eye

• A digital system has a set of discrete values

– Digital Thermometer – Compact Disc (CD) – Digital camera

Benefits of using digital

Analog signal

Digital signal

• Advantages of using Digital: • Cheap electronic circuits • Easier to calibrate and adjust • Resistance to noise: Clearer picture and sound

Binary System

• Discrete elements of information are represented with bits called binary codes. Example: (09)10 = (1001)2 (15)10 = (1111)2 Question: Why are commercial products made with digital circuits as opposed to analog? Most digital devices are programmable: By changing the program in the device, the same underlying hardware can be used for many different applications.

Decimal Code

4 Review the decimal number system.

Base (Radix) is 10 - symbols (0,1, . . 9) Digits For Numbers > 9, add more significant digits in position to the left, e.g. 19>9. Each position carries a weight. MSD Weights: ü

103 102 101 100 10−110−2 10−3

LSD

If we were to write 1936.25 using a power series expansion and base 10 arithmetic:

1× 103 + 9 × 102 + 3× 101 + 6 × 100 + 2 × 10−1 + 5 × 10−2

Binary number system

4 The binary number system.

– – – Base is 2 - symbols (0,1) - Binary Digits (Bits) For Numbers > 1, add more significant digits in position to the left, e.g. 10>1. Each position carries a weight (using decimal).

MSD Weights:

23 2 2 21 2 0

2 −1 2 −2 2 −3

LSD

ü If we write 10111.01 using a decimal power series we convert from binary to decimal: 1× 24 + 0 × 23 + 1× 22 + 1× 21 + 1× 20 + 0 × 2−1 + 1× 2 −2 = = 1× 16 + 0 × 8 + 1× 4 + 1× 2 + 1× 1 + 0 × 0.5 + 1× 0. 25 = 23.25

Binary number system

q (110000.0111)2 = ( ? )10

ANS: 48.4375

4 In computer work: 210 =1024 is referred as K = kilo

220 =1048576 is referred as M = mega 230 = ? 240 = ? q What is the exact number of bytes in a 16 Gbyte memory module?

Octal/Hex number systems

4 The octal number system [from Greek: ΟΚΤΩ].

– Its base is 8 à eight digits 0, 1, 2, 3, 4, 5, 6, 7

ü (236.4)8 = ( ? )10

2 × 82 + 3 × 81 + 6 × 80 + 4 × 8−1 = 158. 5

4 The hexadecimal number system [from Greek: ∆ΕΚΑΕΞΙ]. – Its base is 16 à first 10 digits are borrowed from the decimal system and the letters A, B, C, D, E, F are used for the digits 10, 11, 12, 13, 14, 15

ü (D63FA)16 = ( ? )10

13× 164 + 6 × 163 + 3 × 162 + 15 × 161 + 10 × 160 = 877562

Conversion from Decimal to Binary

4 Conversion from decimal to binary:

Let each bit of a binary number be represented by a variable whose subscript = bit positions, i.e.,

(110 ) 2 = (a2 a1a0 ) 2

Its decimal equivalent is:

(1× 2 2 + 1× 21 + 0 × 20 )10 = (a2 × 22 + a1 × 21 + a0 × 20 ) 10 It is necessary to separate the number into an integer part and a fraction: Repeatedly divide the decimal number by 2.

Conversion from Decimal to Binary

ü Find the binary equivalent of 37.

2 37 2 18 2 9 2 4 2 2 21

q

= 18 + 0.5 =9 +0

1

LSB

0 = 4 + 0.5 1 0 =2 +0 0 =1 +0 = 0 + 0.5 1

3710 = 100101 2

MSB

? 5310 = ____2

ANS: 5310 = 110101 2

Conversion from Decimal to Binary

4 Conversion from decimal fraction to binary:

same method used for integers except multiplication is used instead of division.

ü

Convert (0.8542)10 to binary (give answer to 6 digits).

0.8542 x 2 = 0.7084 x 2 = 0.4168 x 2 = 0.8336 x 2 = 0.6675 x 2 = 0.3344 x 2 = 1 1 0 1 1 0 + + + + + + 0.7084 0.4168 0.8336 0.6672 0.3344 0.6688 a-1 = 1 a-2 = 1 a-3 = 0 a-4 = 1 a-5 = 1 a-6 = 0 MSB

LSB

(0. 8542)10 = (0.a−1a−2 a−3 a−4 a−5a− 6 )2 = (0. 110110)2 q (53.8542)10 = (

? )2

Conversion from Decimal to Octal

4 Conversion from decimal to octal:

The decimal number is first divided by 8. The remainder is the LSB. The quotient is then divide by 8 and the remainder is the...