Digital Logic Design - Virginia Commonwealth University

Digital Logic Design - Virginia Commonwealth University

Digital Logic Design EGRE 254 Number Systems and Codes 1/12/09 02/03/20 1 Positional Number Systems Numbers are commonly represented in the base 10 positional number system. For example 1492.1066 1492.106610 3 2 1 0 1 10 4 10 9 10 2 10 1

2 3 1 10 0 10 6 10 6 10 02/03/20 4 2 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: d d ...d d .d d d ... d p 1 p 2 1 0 p 1

1 2 n 1 n r p 1 i i d i 10 ( d i )10 r i n r i n 10 di in base r 02/03/20 di in base 10 3 Examples 156.78 = (1x102 + 5x101 + 6x100 + 7x10-1 )8 = (1x82 + 5x81 + 6x80 + 7x8-1 )10

= (64 + 40 + 6 + .875)10 = 110.87510 559 = (5x101 + 5x100)9 = (5x91 + 5x90)10 = (45 + 5)10 = 5010 1212 = (1x121 + 2x120)10 = (12 + 2)10 = 1410 101100.112 = 02/03/20 4 Examples Does r10 = 10r ? Does rb = br ? Prove it! 111b = 13310 (41/3)b = 13b Find b. (33/3)b = 11b Find b. 02/03/20

Prove it! Find b. 5 Decimal (10) 02/03/20 Binary (2) Octal (8) Hexadecimal (16) 0 0 0 0 1 1 1

1 2 10 2 2 3 11 3 3 4 100 4

4 5 101 5 5 6 110 6 6 7 111 7 7

8 1000 10 8 9 1001 11 9 10 1010 12 A

11 1011 13 B 12 1100 14 C 13 1101 15 D 14

1110 16 E 15 1111 17 F 6 Example (5D4.A2)16 = (5x102+Dx101+4+Ax10-1+2x10-2)16 = (5x162+13x161+4+10x16-1+2x16-2)10 = (1280+208+4+.625+.0078125)10 = (1492.6328125)10 02/03/20

7 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. D d p 1...d 2 d1d 0 r Fractional number. 02/03/20 D .d 1d 2 ...d p r 8 Base 10 to base r (integer case) D d p 1 r p 1 ... d 2 r 2 d1 r d 0 D d0

R0 p 2 1 d p 1 r ... d 2 r d1 Q1 r r r d 0 R0 Q1 d p 1 r p 2 ... d 2 r1 d1 Q1 d1 R1 p 3 d p 1 r ... d 2 Q2 r r r d1 R1 ... 02/03/20 9 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 149210 = 5D416 02/03/20 10 In practice 0 R 0 16 5 R 510 516 16 93 R 1310 D16

16 1492 R 410 416 02/03/20 You may get mixed up on direction to read the answer. 5D416 or 4D516? Note that 5D4 = 0 05D4 4D5 not same as 4D500 11 Example fraction to hex (.6328125)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 .6328125 = 10.125 = 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, (.6328125)10 = (.A2)16 02/03/20 12 Example For a number containing both an integer and a fractional part. Compute the two parts separately and combine. 1492.632812510 = 5D4.A216 02/03/20 13 Special Case converting between base r and r n Convert 132.68 to binary. Could convert to decimal and then binary. Easier way. (132.6)8 1 82 3 81 2 6 8 1 (0 22 0 21 1) 82 (0 22 1 21 1) 81 (0 22 1 21 0) (1 22 1 21 0) 8 1 (0 28 0 27 1 26 ) (0 25 1 24 1 23 ) (0 22 1 21 0) (1 2 1 1 2 2 0 2 3 )

(001,011,010.110) 2 02/03/20 14 Examples Convert (11010.11)2 to octal, and to hexadecimal. (11010.11)2 = (11,010.110)2 = 32.68 (11010.11)2 = (1,1010.1100)2 =1A.C16 Convert (121.121)3 to base 9 = 32. Convert (1234.567)8 to hexadecimal. Hint 8 = 23 and 16 = 24. 02/03/20 15 02/03/20 16

Recently Viewed Presentations

  • Chapter 3 Section 3-3 - Lake Stevens School District

    Chapter 3 Section 3-3 - Lake Stevens School District

    Chapter 3 Section 3-3 Cycles of Matter **Matter is recycled within and between ecosystems Water cycle Evaporation and Transpiration change water from the liquid state to the gas state Precipitation - water vapor condenses and falls back to Earth.
  • Safe Sleep for Babies SIDS and Other SleepRelated

    Safe Sleep for Babies SIDS and Other SleepRelated

    Besides sleep position, smoke exposure is the most important risk factor for SIDS. Maternal smoking also increases the chances of a baby being born too early (premature) and too small (low birth weight). Remember that prematurity and low birth weight...
  • 340b Program Background General Overview  What is the

    340b Program Background General Overview What is the

    - It's original intent was to 1) provide affordable drug access for low income and indigent families and 2) create a revenue stream for qualifying entities from the price spread between 340B pricing and AWP. When HCR was implemented a...
  • Snímek 1

    Snímek 1

    MODULARIZACE VÝUKY EVOLUČNÍ A EKOLOGICKÉ BIOLOGIE CZ.1.07/2.2.00/15.0204 OBECNÁ MYKOLOGIE (místy se zvláštním zřetelem k makromycetům)
  • NIZOZEMSKA - http://drzaveeuropskeunije.weebly.com/

    NIZOZEMSKA - http://drzaveeuropskeunije.weebly.com/

    Nakon 123 godine danas je na čelo Kraljevine Nizozemske stao muškarac. Willem-Alexander (45) proglašen je kraljem Nizozemske. KRALJ NIZOZEMSKE. Drvene cipele tradicionalna su obuća u Nizozemskoj. Najstarije klompe datiraju iz 13. stoljeća i pronađene su u Amsterdamu.
  • Chapter 6.3

    Chapter 6.3

    In Chicago, two workers were killed in a strike (knights of labor) by the police. The next day union members met to protest the killings… a bomb was thrown into the crowd killing 7 and wounding 60 police officers. Haymarket...
  •  The goal of this training is to understand

    The goal of this training is to understand

    Existing Job Assignments (Grandfather Clause). There is a "Grandfathering clause" in the hiring nepotism law for current elected officials or employees with family relationships that would otherwise be in violation of the nepotism policy unless there is a break in...
  • 90's Fashion: Proudly presented by N.K.O.T.B. - Drama

    90's Fashion: Proudly presented by N.K.O.T.B. - Drama

    90's Fashion: Proudly presented by N.K.O.T.B. 90' hair for women. 90's Hair for men. What all the cool chicks were wearing! Guys hip, cool threads. ... Created Date: 04/20/2015 17:41:20 Title: PowerPoint Presentation Last modified by: Tahanyth Webster-Otto Company: