Download presentation
Presentation is loading. Please wait.
Published byLeo Burns Modified over 9 years ago
1
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included herein were taken from the materials accompanying Fundamentals of Logic Design, 6 th Edition, by Roth and Kinney, and were used with permission from Cengage Learning.
2
Spring 2011ECE 301 - Digital Electronics2 52 What does this number represent? Consider the “context” in which it is used.
3
Spring 2011ECE 301 - Digital Electronics3 1011001.101 What is the decimal value of this number? Consider the base (or radix) of this number.
4
Spring 2011ECE 301 - Digital Electronics4 Number Systems
5
Spring 2011ECE 301 - Digital Electronics5 Number Systems R is the radix (or base) of the number system. Must be a positive number R digits in the number system: [0.. R-1] Important number systems for digital systems: Base 2 (binary)[0, 1] Base 8 (octal)[0.. 7] Base 16 (hexadecimal)[0.. 9, A.. F]
6
Spring 2011ECE 301 - Digital Electronics6 Number Systems Positional Notation [a 4 a 3 a 2 a 1 a 0.a -1 a -2 a -3 ] R a i = i th position in the number R = radix or base of the number radix point
7
Spring 2011ECE 301 - Digital Electronics7 Number Systems Power Series Expansion D = a n x R 4 + a n-1 x R 3 + … + a 0 x R 0 + a -1 x R -1 + a -2 x R -2 + … a -m x R -m D = decimal value a i = i th position in the number R = radix or base of the number
8
Spring 2011ECE 301 - Digital Electronics8 Number Systems: Example Decimal 927.45 10 = 9 x 10 2 + 2 x 10 1 + 7 x 10 0 + 4 x 10 -1 + 5 x 10 -2
9
Spring 2011ECE 301 - Digital Electronics9 Number Systems: Example Binary 1101.101 2 = 1 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 2 0 + 1 x 2 -1 + 0 x 2 -2 + 1 x 2 -3
10
Spring 2011ECE 301 - Digital Electronics10 Number Systems: Example Octal 326.47 8 = 3 x 8 2 + 2 x 8 1 + 6 x 8 0 + 4 x 8 -1 + 7 x 8 -2
11
Spring 2011ECE 301 - Digital Electronics11 Number Systems: Example Hexadecimal E5A.2B 16 = 14 x 16 2 + 5 x 16 1 + 10 x 16 0 + 2 x 16 -1 + 11 x 16 -2
12
Spring 2011ECE 301 - Digital Electronics12 Conversion between Number Systems
13
Spring 2011ECE 301 - Digital Electronics13 Use repeated division to convert a decimal integer to any other base. Conversion of a Decimal Integer
14
Spring 2011ECE 301 - Digital Electronics14 Conversion of a Decimal Integer Example: Convert the decimal number 57 to binary and to octal: 57 / 2 = 28: rem = 1 = a 0 28 / 2 = 14: rem = 0 = a 1 14 / 2 = 7: rem = 0 = a 2 7 / 2 = 3: rem = 1 = a 3 3 / 2 = 1: rem = 1 = a 4 1 / 2 = 0: rem = 1 = a 5 57 10 = 111001 2 57 / 8 = 7: rem = 1 = a 0 7 / 8 = 0: rem = 7 = a 1 57 10 = 71 8
15
Spring 2011ECE 301 - Digital Electronics15 Use repeated multiplication to convert a decimal fraction to any other base. Conversion of a Decimal Fraction
16
Spring 2011ECE 301 - Digital Electronics16 Conversion of a Decimal Fraction Example: Convert the decimal number 0.625 to binary and to octal. 0.625 * 2 = 1.250: a -1 = 1 0.250 * 2 = 0.500: a -2 = 0 0.500 * 2 = 1.000: a -3 = 1 0.625 10 = 0.101 2 0.625 * 8 = 5.000: a 0 = 5 0.625 10 = 0.5 8
17
Spring 2011ECE 301 - Digital Electronics17 Conversion of a Decimal Fraction Example: Convert the decimal number 0.7 to binary. 0.7 * 2 = 1.4: a-1 = 1 0.4 * 2 = 0.8: a-2 = 0 0.8 * 2 = 1.6: a-3 = 1 0.6 * 2 = 1.2: a-4 = 1 0.2 * 2 = 0.4: a-5 = 0 0.4 * 2 = 0.8: a-6 = 0 0.7 10 = 0.1 0110 0110 0110... 2 process begins repeating here! In some cases, conversion results in a repeating fraction.
18
Spring 2011ECE 301 - Digital Electronics18 Conversion of a Mixed Decimal Number Convert the integer part of the decimal number using repeated division. Convert the fractional part of the decimal number using repeated multiplication. Combine the integer and fractional parts in the new base.
19
Spring 2011ECE 301 - Digital Electronics19 Conversion of a Mixed Decimal Number Example: Convert 48.5625 10 to binary. Confirm the results using the Power Series Expansion.
20
Spring 2011ECE 301 - Digital Electronics20 Conversion between Bases Conversion between any two bases can be carried out directly using repeated division and repeated multiplication. Base A → Base B However, it is, generally, easier to convert Base A to its decimal equivalent and then convert the decimal value to Base B. Base A → decimal value → Base B Power Series Expansion Repeated Division, Repeated Multiplication
21
Spring 2011ECE 301 - Digital Electronics21 Conversion between Bases Conversion between binary and octal can be carried out by inspection. Each octal digit corresponds to 3 bits 101 110 010. 011 001 2 = 5 6 2. 3 1 8 010 011 100. 101 001 2 = 2 3 4. 5 1 8 7 4 5. 3 2 8 = 111 100 101. 011 010 2 3 0 6. 0 5 8 = 011 000 110. 000 101 2 Is the number 392.24 8 a valid octal number?
22
Spring 2011ECE 301 - Digital Electronics22 Conversion between Bases Conversion between binary and hexadecimal can be carried out by inspection. Each hexadecimal digit corresponds to 4 bits 1001 1010 0110. 1011 0101 2 = 9 A 6. B 5 16 1100 1011 1000. 1110 0111 2 = C B 8. E 7 16 E 9 4. D 2 16 = 1110 1001 0100. 1101 0010 2 1 C 7. 8 F 16 = 0001 1100 0111. 1000 1111 2 Note that the hexadecimal number system requires additional characters to represent its 16 values.
23
Spring 2011ECE 301 - Digital Electronics23 Number Systems Base:1028 16 What is the value of 12?
24
Spring 2011ECE 301 - Digital Electronics24 Binary Arithmetic
25
Spring 2011ECE 301 - Digital Electronics25 Binary Addition 00 11 + 0 +1 01 1 10 Sum Carry Sum
26
Spring 2011ECE 301 - Digital Electronics26 Binary Addition: Examples 01011011 +01110010 00111100 +10101010 10110101 +01101100
27
Spring 2011ECE 301 - Digital Electronics27 Binary Subtraction 0 10 11 - 0 -1 01 1 0 Difference Borrow
28
Spring 2011ECE 301 - Digital Electronics28 Binary Subtraction: Examples 01110101 -00110010 00111100 -10101100 10110001 -01101100
29
Spring 2011ECE 301 - Digital Electronics29 Binary Arithmetic Single-bit AdditionSingle-bit Subtraction What logic function is this? ABDifference 0 00 0 11 1 01 1 1 0 ABCarrySum 0 00 0 0 10 1 1 00 1 1 1 1 0
30
Spring 2011ECE 301 - Digital Electronics30 Binary Multiplication 0 0 11 x 0 x1 00 0 1 Product
31
Spring 2011ECE 301 - Digital Electronics31 Binary Multiplication: Examples 0110 x1010 1011 x0110 1001 x1101
32
Spring 2011ECE 301 - Digital Electronics32 Representation of Negative Numbers
33
Spring 2011ECE 301 - Digital Electronics33 10011010 What is the decimal value of this number? Is it positive or negative? If negative, what representation are we using?
34
Spring 2011ECE 301 - Digital Electronics34 b n1– b 1 b 0 Magnitude MSB Unsigned number b n1– b 1 b 0 Magnitude Sign Signed number b n2– 0 denotes 1 denotes + –MSB Unsigned and Signed Binary Numbers
35
Spring 2011ECE 301 - Digital Electronics35 Unsigned Binary Numbers For an n-bit unsigned binary number, all n bits are used to represent the magnitude of the number. ** Cannot represent negative numbers.
36
Spring 2011ECE 301 - Digital Electronics36 Unsigned Binary Numbers For an n-bit binary number 0 <= D <= 2 n – 1 where D = decimal equivalent value For an 8-bit binary number:0 <= D <= 2 8 – 1 2 8 = 256 For a 16-bit binary number:0 <= D <= 2 16 – 1 2 16 = 65536
37
Spring 2011ECE 301 - Digital Electronics37 Signed Binary Numbers For an n-bit signed binary number, n-1 bits are used to represent the magnitude of the number; the leftmost bit is, generally, used to indicate the sign of the number. 0 = positive number 1 = negative number
38
Spring 2011ECE 301 - Digital Electronics38 Signed Binary Numbers Representations for signed binary numbers: 1. Sign and Magnitude 2. 1's Complement 3. 2's Complement
39
Spring 2011ECE 301 - Digital Electronics39 Sign and Magnitude For an n-bit signed binary number, The leftmost bit is the sign bit. The remaining n-1 bits represent the magnitude. Includes a representation for +0 and -0 - (2 n-1 – 1) <= N <= + (2 n-1 – 1)
40
Spring 2011ECE 301 - Digital Electronics40 Sign and Magnitude: Example What is the Sign and Magnitude representation for the following decimal values, using 8 bits? + 97 - 68 - 97 + 68
41
Spring 2011ECE 301 - Digital Electronics41 Sign and Magnitude: Example Can the following decimal numbers be represented using 8-bit Sign and Magnitude representation? - 212 - 127 +128 +255
42
Spring 2011ECE 301 - Digital Electronics42 Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.