Download presentation
Presentation is loading. Please wait.
1
EGRE 254 Number Systems and Codes 1/12/09
Digital Logic Design EGRE 254 Number Systems and Codes 1/12/09 11/20/2018
2
Positional Number Systems
11/20/2018 Positional Number Systems Numbers are commonly represented in the base 10 positional number system. For example 11/20/2018
3
In general (see page 26) A number D of radix or base r with p digits to the left of the radix point and n digits to the right of the radix point can be expressed as: di – in base 10 di – in base r 11/20/2018
4
11/20/2018 Examples = (1x x x x10-1 )8 = (1x82 + 5x81 + 6x80 + 7x8-1 )10 = ( )10 = 559 = (5x x100)9 = (5x91 + 5x90)10 = (45 + 5)10 = 5010 1212 = (1x x120)10 = (12 + 2)10 = 1410 = = = 44.75 11/20/2018
5
Examples Does r10 = 10r ? Prove it! Does rb = br ? Prove it!
11/20/2018 Examples Does r10 = 10r ? Prove it! Does rb = br ? Prove it! 111b = Find b. (41/3)b = 13b Find b. (33/3)b = 11b Find b. 1. 10r = (1 x r1 + 0 x r0)10 = r10 2. Consider 23 = 210 = 102 != 112 3. 111b = 1xb2 + 1xb1 + 1 = b2 + b + 1 = 133 b2 + b = 0 (b-11)(b+12) = 0 b = 11, b = -12 (-12)2 + (-12) + 1 = 144 – Note: (12)-12 = 1x(-12)1 + 2x(-12)0 = = -10. Q. What is the advantage of a number system with a negative base? We don’t need the “-” sign. 4. 4b + 1 = 3(b+3) = 3b + 9 b= 9-1 = 8 5. 3b + 3 = 3(b + 1) = 3b + b ? |b| > 3 11/20/2018
6
Decimal (10) Binary (2) Octal (8) Hexadecimal (16) 1 2 10 3 11 4 100 5
1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 1010 12 A 1011 13 B 1100 14 C 1101 15 D 1110 16 E 1111 17 F 11/20/2018
7
Example (5D4.A2)16 = (5x102+Dx101+4+Ax10-1+2x10-2)16
= (5x162+13x x16-1+2x16-2)10 = ( )10 = ( )10 11/20/2018
8
How do we convert from base 10 to base r?
We could use previous techniques, but we would have to do arithmetic in base r. Not desirable. Consider two cases. Integer number. Fractional number. 11/20/2018
9
Base 10 to base r (integer case)
11/20/2018
10
Example – Integer to Hex
1492 = (d3 d2 d1 d0)16 = d3x163+ d2x162+ d1x16+ d0 1492/16 = 93+4/16 = d3x162+ d2x16+ d1+ d0/16 d0 = 4 93 = d3x162+ d2x16+ d1 93/16 = 5 +13/16 = d3x16+ d2+ d1/16 d1 = 1310 = D16 5 = d3x16+ d2 5/16 = 0 + 5/16 = d3 + d2/16, d3 = 0, d2 = 5 = 5D416 11/20/2018
11
In practice You may get mixed up on direction to read the answer.
5D416 or 4D516? Note that 5D4 = 0…05D4 4D5 not same as 4D50…0 11/20/2018
12
Example fraction to hex
( )10 = (.d-1 d-2 d-3…)16 = (d-1x16-1+ d-2x16-2+ d-3x16-3+…)10 How do we find d-1? Multiply by 16. 16 x = = d-1+ d-2x16-1+ d-3x16-2+… d-1 = 10 and .125 = d-2x16-1+ d-3x16-2+… Multiply by 16. Then,.125 x 16 = 2.00 = d-2+ d-3x16-1+… d-2 = 2 and d-n = 0 for n > 2. Therefore, ( )10 = (.A2)16 11/20/2018
13
Example For a number containing both an integer and a fractional part. Compute the two parts separately and combine. = 5D4.A216 11/20/2018
14
Special Case converting between base r and rn
Convert to binary. Could convert to decimal and then binary. Easier way. 11/20/2018
15
Examples Convert (11010.11)2 to octal, and to hexadecimal.
11/20/2018 Examples Convert ( )2 to octal, and to hexadecimal. ( )2 = (11, )2 = 32.68 ( )2 = (1, )2 =1A.C16 Convert ( )3 to base 9 = 32. Convert ( )8 to hexadecimal. Hint 8 = 23 and 16 = 24. ( )8 = (001,010,011, ,110,111)2 = ( )2 = (29C.BB8)16 11/20/2018
16
11/20/2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.