Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 3110: Introduction to Digital Systems Number Systems.

Similar presentations


Presentation on theme: "ECE 3110: Introduction to Digital Systems Number Systems."— Presentation transcript:

1 ECE 3110: Introduction to Digital Systems Number Systems

2 Dr. Xubin He ECE 3110: Introduction to Digital systems Previous class Summary Electronics/sw aspects of digital design Integrated Circuits (wafer,die,SSI,MSI,LSI,VLSI) PLDs: PLAs,PALs,CPLD,FPGA ASIC Digital design levels

3 Binary Representation The basis of all digital data is binary representation. Binary - means ‘two’ 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems 1, 0, 56 True, False, Maybe Hot, Cold, LukeWarm, Cool On, Off, Leaky

4 Number Systems To talk about binary data, we must first talk about number systems The decimal number system (base 10) you should be familiar with! Positional number system

5 Positional Notation Value of number is determined by multiplying each digit by a weight and then summing. The weight of each digit is a POWER of the BASE and is determined by position. d p-1 d p-2 …d 1 d 0.d -1­ d -2 …d -n Radix point n, p, r>=2 Sum of each digit multiplied by the corresponding power of the radix.

6 The decimal number system (base 10) you should be familiar with! A digit in base 10 ranges from 0 to 9. A digit in base 2 ranges from 0 to 1 (binary number system). A digit in base 2 is also called a ‘bit’. A digit in base R can range from 0 to R-1 A digit in Base 16 can range from 0 to 16-1 (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F). Use letters A-F to represent values 10 to 15. Base 16 is also called Hexadecimal or just ‘Hex’.

7 953.78 10 = 9 x 10 2 + 5 x 10 1 + 3 x 10 0 + 7 x 10 -1 + 8 x 10 -2 = 900 + 50 + 3 +.7 +.08 = 953.78 1011.11 2 = 1x2 3 + 0x2 2 + 1x2 1 + 1x2 0 + 1x2 -1 + 1x2 -2 = 8 + 0 + 2 + 1 + 0.5 + 0.25 = 11.75 A2F 16 = 10x16 2 + 2x16 1 + 15x16 0 = 10 x 256 + 2 x 16 + 15 x 1 = 2560 + 32 + 15 = 2607 Base 10, Base 2, Base 8, Base 16 4316 8 = 4 x 8 3 + 3 x 8 2 + 1 x 8 1 + 6 x 8 0 = 2048 + 192 + 8 + 6 = 2254

8 Common Powers 2 -3 = 0.125 2 -2 = 0.25 2 -1 = 0.5 2 0 = 1 2 1 = 2 2 2 = 4 2 3 = 8 2 4 = 16 2 5 =32 2 6 = 64 2 7 = 128 2 8 = 256 2 9 = 512 2 10 = 1024 2 11 = 2048 2 12 = 4096 16 0 = 1 = 2 0 16 1 = 16 = 2 4 16 2 = 256 = 2 8 16 3 = 4096 = 2 12 2 10 = 1024 = 1 K 2 20 = 1048576 = 1 M (1 Megabits) = 1024 K = 2 10 x 2 10 2 30 = 1073741824 = 1 G (1 Gigabits)

9 Dr. Xubin He ECE 3110: Introduction to Digital systems Least Significant Digit Most Significant Digit 53 10 = 110101 2 Most Significant Digit (has weight of 2 5 or 32). For base 2, also called Most Significant Bit (MSB). Always LEFTMOST digit. Least Significant Digit (has weight of 2 0 or 1). For base 2, also called Least Significant Bit (LSB). Always RIGHTMOST digit.

10 Hex (base 16) to Binary Conversion Each Hex digit represents 4 bits. To convert a Hex number to Binary, simply convert each Hex digit to its four bit value. Hex Digits to binary (cont): 9 16 = 1001 2 A 16 = 1010 2 B 16 = 1011 2 C 16 = 1100 2 D 16 = 1101 2 E 16 = 1110 2 F 16 = 1111 2 Hex Digits to binary: 0 16 = 0000 2 1 16 = 0001 2 2 16 = 0010 2 3 16 = 0011 2 4 16 = 0100 2 5 16 = 0101 2 6 16 = 0110 2 7 16 = 0111 2 8 16 = 1000 2

11 Hex to Binary, Binary to Hex A2F 16 = 1010 0010 1111 2 345 16 = 0011 0100 0101 2 Binary to Hex is just the opposite, create groups of 4 bits starting with least significant bits. If last group does not have 4 bits, then pad with zeros for unsigned numbers. 1010001 2 = 0101 0001 2 = 51 16 Padded with a zero

12 Hex to Binary, Binary to Hex A2F 16 = 1010 0010 1111 2 345 16 = 0011 0100 0101 2 Binary to Hex is just the opposite, create groups of 4 bits starting with least significant bits. If last group does not have 4 bits, then pad with zeros for unsigned numbers. 1010001 2 = 0101 0001 2 = 51 16 Padded with a zero

13 Conversion of Any Base to Decimal Converting from ANY base to decimal is done by multiplying each digit by its weight and summing. 1011.11 2 = 1x2 3 + 0x2 2 + 1x2 1 + 1x2 0 + 1x2 -1 + 1x2 -2 = 8 + 0 + 2 + 1 + 0.5 + 0.25 = 11.75 Binary to Decimal Hex to Decimal A2F 16 = 10x16 2 + 2x16 1 + 15x16 0 = 10 x 256 + 2 x 16 + 15 x 1 = 2560 + 32 + 15 = 2607

14 A Trick! If faced with a large binary number that has to be converted to decimal, I first convert the binary number to HEX, then convert the HEX to decimal. Less work! 110111110011 2 = 1101 1111 0011 2 = D 16 F 16 3 16 = 13 x 16 2 + 15 x 16 1 + 3x16 0 = 13 x 256 + 15 x 16 + 3 x 1 = 3328 + 240 + 3 = 3571 10 Of course, you can also use the binary, hex conversion feature on your calculator. Calculators won’t be allowed on the first test, though…...

15 Dr. Xubin He ECE 3110: Introduction to Digital systems Conversion of Decimal Integer To ANY Base Divide Number N by base R until quotient is 0. Remainder at EACH step is a digit in base R, from Least Significant digit to Most significant digit.

16 Conversion of Decimal Integer To ANY Base Example Convert 53 to binary 53/2 = 26, rem = 1 26/2 = 13, rem = 0 13/2 = 6, rem = 1 6 /2 = 3, rem = 0 3/2 = 1, rem = 1 1/2 = 0, rem = 1 53 10 = 110101 2 = 1x2 5 + 1x2 4 + 0x2 3 + 1x2 2 + 0x2 1 + 1x2 0 = 32 + 16 + 0 + 4 + 0 + 1 = 53 Least Significant Digit Most Significant Digit

17 Dr. Xubin He ECE 3110: Introduction to Digital systems More Conversions Convert 53 to Hex 53/16 = 3, rem = 5 3 /16 = 0, rem = 3 53 10 = 35 16 = 3 x 16 1 + 5 x 16 0 = 48 + 5 = 53 3417 10 =??? 16

18 Dr. Xubin He ECE 3110: Introduction to Digital systems Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N -1. 4 bits = 0 to 15 8 bits = 0 to 255 16 bits = 0 to 65535 Besides simply representation, we would like to also do arithmetic operations on numbers in binary form. Principle operations are addition and subtraction.

19 Dr. Xubin He ECE 3110: Introduction to Digital systems Next… Addition/Subtraction Representation of Negative Numbers


Download ppt "ECE 3110: Introduction to Digital Systems Number Systems."

Similar presentations


Ads by Google