Se ha denunciado esta presentación.
Se está descargando tu SlideShare. ×

# Number system

Próximo SlideShare
Number Systems
Cargando en…3
×

1 de 94
1 de 94

# Number system

Digital number system,
Complemented number system,
1’s Complement,
2’s Complement,
8421 BCD Code,
Gray Code,
Excess-3 Code ,
Boolean Algebra,
DeMorgan's Theorem

Digital number system,
Complemented number system,
1’s Complement,
2’s Complement,
8421 BCD Code,
Gray Code,
Excess-3 Code ,
Boolean Algebra,
DeMorgan's Theorem

## Más Contenido Relacionado

### Más de Mantra VLSI

Gratis con una prueba de 30 días de Scribd

Ver todo

Gratis con una prueba de 30 días de Scribd

Ver todo

### Number system

1. 1. Digit’s 01010
2. 2. NUMBER SYSTEM BASE Symbol Intro…
3. 3. Common Number Systems System Base Symbols Used by humans? Used in computers? Decimal 10 0, 1, … 9 Yes No Binary 2 0, 1 No Yes Octal 8 0, 1, … 7 No No Hexa-decimal 16 0, 1, … 9, A, B, … F No No
4. 4. Conversion Among Bases  The possibilities: Decimal Octal Hexadecimal Binary
5. 5. Quick Example 2510 = 110012 = 318 = 1916 Base/Radix
6. 6. Decimal to Decimal (just for fun) Decimal Octal Hexadecimal Binary
7. 7. 12510 => 5 x 100= 5 2 x 101= 20 1 x 102= 100 125 Base Weight
8. 8. Binary to Decimal Hexadecimal Decimal Octal Binary
9. 9. Binary to Decimal  Technique  Multiply each bit by 2n, where n is the “weight” of the bit  The weight is the position of the bit, starting from 0 on the right  Add the results
10. 10. Example 1010112 => 1 x 20 = 1 1 x 21 = 2 0 x 22 = 0 1 x 23 = 8 0 x 24 = 0 1 x 25 = 32 4310 Bit “0”
11. 11. Octal to Decimal Decimal Octal Hexadecimal Binary
12. 12. Octal to Decimal  Technique  Multiply each bit by 8n, where n is the “weight” of the bit  The weight is the position of the bit, starting from 0 on the right  Add the results
13. 13. Example 7248 => 4 x 80 = 4 2 x 81 = 16 7 x 82 = 448 46810
14. 14. Hexadecimal to Decimal Decimal Octal Hexadecimal Binary
15. 15. Hexadecimal to Decimal  Technique  Multiply each bit by 16n, where n is the “weight” of the bit  The weight is the position of the bit, starting from 0 on the right  Add the results
16. 16. Example ABC16 => C x 160 = 12 x 1 = 12 B x 161 = 11 x 16 = 176 A x 162 = 10 x 256 = 2560 274810
17. 17. Decimal to Binary Decimal Octal Hexadecimal Binary
18. 18. Decimal to Binary  Technique  Divide by two, keep track of the remainder  First remainder is bit 0 (LSB, least-significant bit)  Second remainder is bit 1  Etc.
19. 19. Example 12510 = ?2 2 125 2 6 2 1 2 3 1 0 2 1 5 1 2 7 1 2 3 1 2 1 1 0 1 12510 = 11111012
20. 20. Octal to Binary Decimal Octal Hexadecimal Binary
21. 21. Octal to Binary  Technique  Convert each octal digit to a 3-bit equivalent binary representation
22. 22. Example 7058 = ?2 7 0 5 111 000 101 7058 = 1110001012
23. 23. Hexadecimal to Binary Decimal Octal Hexadecimal Binary
24. 24. Hexadecimal to Binary  Technique  Convert each hexadecimal digit to a 4-bit equivalent binary representation
25. 25. Example 10AF16 = ?2 1 0 A F 0001 0000 1010 1111 10AF16 = 00010000101011112
26. 26. Decimal to Octal Decimal Octal Hexadecimal Binary
27. 27. Decimal to Octal  Technique  Divide by 8  Keep track of the remainder
28. 28. Example 123410 = ?8 8 1234 8 154 2 19 2 8 2 3 8 0 2 123410 = 23228
29. 29. Decimal to Hexadecimal Decimal Octal Hexadecimal Binary
30. 30. Decimal to Hexadecimal  Technique  Divide by 16  Keep track of the remainder
31. 31. Example 123410 = ?16 123410 = 4D216 16 1234 77 2 16 4 13 = D 16 0 4
32. 32. Binary to Octal Decimal Octal Hexadecimal Binary
33. 33. Binary to Octal  Technique  Group bits in threes, starting on right  Convert to octal digits
34. 34. Example 10110101112 = ?8 1 011 010 111 1 3 2 7 10110101112 = 13278
35. 35. Binary to Hexadecimal Decimal Octal Hexadecimal Binary
36. 36. Binary to Hexadecimal  Technique  Group bits in fours, starting on right  Convert to hexadecimal digits
37. 37. Example 10101110112 = ?16 10 1011 1011 2 B B 10101110112 = 2BB16
38. 38. Octal to Hexadecimal Decimal Octal Hexadecimal Binary
39. 39. Octal to Hexadecimal  Technique  Use binary as an intermediary
40. 40. Example 10768 = ?16 1 0 7 6 001 000 111 110 2 3 E 10768 = 23E16
41. 41. Hexadecimal to Octal Decimal Octal Hexadecimal Binary
42. 42. Hexadecimal to Octal  Technique  Use binary as an intermediary
43. 43. Example 1F0C16 = ?8 1 F 0 C 0001 1111 0000 1100 1F0C16 = 174148 1 7 4 1 4
44. 44. Exercise – Convert ... Decimal Binary Octal Don’t use a calculator! Hexa-decimal 33 1110101 703 1AF Skip answer Answer
45. 45. Exercise – Convert … Answer Decimal Binary Octal Hexa-decimal 33 100001 41 21 117 1110101 165 75 451 111000011 703 1C3 431 110101111 657 1AF
46. 46. Common Powers (1 of 2)  Base 10 Power Preface Symbol 10-12 pico p 10-9 nano n 10-6 micro  10-3 milli m 103 kilo k 106 mega M 109 giga G 1012 tera T Value .000000000001 .000000001 .000001 .001 1000 1000000 1000000000 1000000000000
47. 47. Common Powers (2 of 2)  Base 2 Power Preface Symbol 210 kilo k 220 mega M 230 Giga G Value 1024 1048576 1073741824 • What is the value of “k”, “M”, and “G”? • In computing, particularly w.r.t. memory, the base-2 interpretation generally applies
48. 48. Review – multiplying powers  For common bases, add powers ab  ac = ab+c 26  210 = 216 = 65,536 or… 26  210 = 64  210 = 64k
49. 49. Binary Addition (1 of 2)  Two 1-bit values A B A + B 0 0 0 0 1 1 1 0 1 1 1 10 “two”
50. 50. Binary Addition (2 of 2)  Two n-bit values  Add individual bits  Propagate carries  E.g., 10101 21 + 11001 + 25 101110 46
51. 51. Multiplication (1 of 3)  Decimal (just for fun) 35 x 105 175 000 35 3675
52. 52. Multiplication (2 of 3)  Binary, two 1-bit values A B A  B 0 0 0 0 1 0 1 0 0 1 1 1
53. 53. Multiplication (3 of 3)  Binary, two n-bit values  As with decimal values  E.g., 1110 x 1011 1110 1110 0000 1110 10011010
54. 54. Fractions  Decimal to decimal (just for fun) 3.14 => 4 x 10-2 = 0.04 1 x 10-1 = 0.1 3 x 100 = 3 3.14
55. 55. Fractions  Binary to decimal 10.1011 => 1 x 2-4 = 0.0625 1 x 2-3 = 0.125 0 x 2-2 = 0.0 1 x 2-1 = 0.5 0 x 20 = 0.0 1 x 21 = 2.0 2.6875
56. 56. Fractions  Decimal to binary 3.14579 .14579 x 2 0.29158 x 2 0.58316 x 2 1.16632 x 2 0.33264 x 2 0.66528 x 2 1.33056 etc. 11.001001...
57. 57. Exercise – Convert ... Decimal Binary Octal Don’t use a calculator! Hexa-decimal 29.8 101.1101 3.07 C.82
58. 58. Exercise – Convert … Answer Decimal Binary Octal Hexa-decimal 29.8 11101.110011… 35.63… 1D.CC… 5.8125 101.1101 5.64 5.D 3.109375 11.000111 3.07 3.1C 12.5078125 1100.10000010 14.404 C.82
59. 59. Complemented number system
60. 60. Sign-Magnitude Notation The simplest form of representation that employs a sign bit, the leftmost significant bit. For an N-bit word, the rightmost N-1 bits hold the magnitude of the integer. Thus,  00010010 = +18  10010010 = -18
61. 61. Drawbacks of Sign-Magnitude Notation Addition and subtraction require a consideration of both the signs of the numbers, and their relative magnitudes, in order to carry out the requested operation.
62. 62. 1’s Complement Notation  Positive integers are represented in the same way as sign-magnitude notation.  A negative integer is represented by the 1's complement of the positive integer in sign-magnitude notation.  The ones complement of a number is obtained by complementing each one of the bits, i.e., a 1 is replaced by a 0, and a 0 is replaced by a 1.  18 (Base 10) = 00010010  -18 = 1's complement of 18 = 11101101
63. 63. 2’s Complement Notation The 2's complement representation of positive integers is the same as in sign-magnitude representation. A negative number is represented by the 2's complement of the positive integer with the same magnitude. 1. Perform the 1's complement operation. 2. Treating the result as an unsigned binary integer, add 1.
64. 64. 2’s Complement Example 18 = 00010010 1's complement = 11101101 +1 ________ 2’S of 18 = 11101110 = -18d
65. 65. Binary Addition and Subtration The simplest implementation is one in which the numbers involved can be treated as unsigned integers for purposes of addition. 1’s complement Addition 2’s complement Addition
66. 66. 1’s complement Addition  Consider the Subtrahend & Minuend.  Calculate the 1’s complement of the Subtrahend number.  Add it to the Minuend  If the resulting is producing any carry then add the carry to the LSB of the Result the sign is same as of the Minuend.  If there is no carry then again take the 1’s complement of the result and place minus sign before the result.  This is the Require Result.
67. 67. Example ex. +1 0001 Minuend -6 0110 Subtrahend 1’s complement of 6 = 1001 Add : 0001 Minuend 1001 1’s Complement of Subtrahend Result =1010 (No carry) Again take the 1’ s Complement of 1010 = - 0101 Answer = > -5
68. 68. Ones Complement End Around Carry Perform the operation -2 + -4 1’s complement of -2 = 1101 1’s complement of -4 = 1011 ------- 1)1000 --> 1 -------- 1001 = -6
69. 69. 2’s complement Addition  Calculate the 2’s complement of the Subtrahend number.  Add the 2’s complement to the Minuend Number  If the resultant has a carry discard it & this is the final Ans.  Else if there is no carry calculate the 2’s complement of the Resultant.  This is the final Answer.
70. 70. 2’s Complement Addition : a)5 - 7 Binary equivalent of 7 = 0111 1’s complement of 7 = 1000 2’s complement of 7 = 1001 Now add 5 = 0101 + (-)7 = 1001 1110 = -2  In 2’s Complement addition, the Carry Out of the most significant bit is ignored!
71. 71. 8421 BCD Code  In the 8421 Binary Coded Decimal (BCD) representation each decimal digit is converted to its 4-bit pure binary equivalent.  This coding is an example of a binary coded (each decimal number maps to four bits) weighted (each bit represents a number: 1, 2, 4, etc.) code.  57dec = 0101 0111bcd
72. 72. Questions  Q. What is the decimal number for the following 8421 BCD Code 0001 1001 0111 0010bcd?  A. 1972  Q. What is the 8421 BCD Code for the decimal number 421?  A. 0100 0010 0001
73. 73. Gray Code  Gray coding is used for its speed & freedom from errors.  In BCD or 8421 BCD when counting from 7 (0111) to 8 (1000) requires 4 bits to be changed simultaneously.  If this does not happen then various numbers could be momentarily generated during the transition so creating spurious numbers which could be read.  Gray coding avoids this since only one bit changes between subsequent numbers. Two simple rules.  1. Start with all 0s.  2. Proceed by changing the least significant bit (lsb) which will bring about a new state.
74. 74. Gray Code Continued Decimal Gray Code 0 0000 1 0001 2 0011 3 0010 4 0110 5 0111 6 0101 7 0100 8 1100 9 1101 10 1111 11 1110 12 1010 13 1011 14 1001 15 1000
75. 75. Excess-3 Code  Excess-3 is a non weighted code used to express decimal numbers. The code derives its name from the fact that each binary code is the corresponding 8421 code plus 0011(3).  1000 of 8421 = 1011 in Excess-3
76. 76. ASCII Code  ASCII: American Standard Code for Information Interchange  The standard ASCII code defines 128 character codes (from 0 to 127), of which, the first 32 are control codes (non-printable), and the other 96 are representable characters.  In addition to the 128 standard ASCII codes there are other 128 that are known as extended ASCII, and that are platform-dependent.
77. 77. ASCII Code Table
78. 78. Boolean Algebra
79. 79. Boolean function • Boolean function: Mapping from Boolean variables to a Boolean value. • Truth table: Represents relationship between a Boolean function and its binary variables. It enumerates all possible combinations of arguments and the corresponding function values.
80. 80. Boolean function and logic diagram • Boolean algebra: Deals with binary variables and logic operations operating on those variables. • Logic diagram: Composed of graphic symbols for logic gates. A simple circuit sketch that represents inputs and outputs of Boolean functions.
81. 81. Gates  Refer to the hardware to implement Boolean operators.  The most basic gates are
82. 82. Boolean function and truth table
83. 83. Basic identities of boolean algebra • A Boolean algebra is a closed algebraic system containing set of elements and the operators. • The . (dot) operator is known as logical And. • The + (plus) which refer to logical OR.
84. 84. Basic Identities of Boolean Algebra (1) x + 0 = x (2) x · 0 = 0 (3) x + 1 = 1 (4) x · 1 = x (5) x + x = x (6) x · x = x (7) x + x’ = 1 (8) x · x’ = 0 (9) x + y = y + x (10) xy = yx (11) x + ( y + z ) = ( x + y ) + z (12) x (yz) = (xy) z X I/P O/P = X + I/P 0 0 0 = > X 1 0 1 => X X I/P O/P = X . I/P 0 0 0 1 0 0 X I/P O/P = X . I/P 0 1 0 => X 1 1 1 => X
85. 85. Basic Identities of Boolean Algebra (DeMorgan’s Theorem) (15) ( x + y )’ = x’ y’ (16) ( xy )’ = x’ + y’ (17) (x’)’ = x
86. 86. Function Minimization using Boolean Algebra  Examples: (a) a + ab = a(1+b)=a (b) a(a + b) = a.a +ab=a+ab=a(1+b)=a. (c) a + a'b = (a + a')(a + b)=1(a + b) =a+b (d) a(a' + b) = a. a' +ab=0+ab=ab
87. 87. Try  F = abc + abc’ + a’c
88. 88. The other type of question Show that; 1- ab + ab' = a 2- (a + b)(a + b') = a 1- ab + ab' = a(b+b') = a.1=a 2- (a + b)(a + b') = a.a +a.b' +a.b+b.b' = a + a.b' +a.b + 0 = a + a.(b' +b) + 0 = a + a.1 + 0 = a + a = a
89. 89. More Examples  Show that; (a) ab + ab'c = ab + ac (b) (a + b)(a + b' + c) = a + bc (a) ab + ab'c = a(b + b'c) = a((b+b').(b+c))=a(b+c)=ab+ac (b) (a + b)(a + b' + c) = (a.a + a.b' + a.c + ab +b.b' +bc) = (a + ab’ + a.c + a.b + 0 + b.c) =( a(1+b’ + c + b)+ b.c) = ( a+ b.c)
90. 90. Principle of Duality  The dual of a statement S is obtained by interchanging . and +; 0 and 1.  Dual of (a*1)*(0+a’) = 0 is (a+0)+(1*a’) = 1  Dual of any theorem in a Boolean Algebra is also a theorem.  This is called the Principle of Duality.
91. 91. DeMorgan's Theorem (a) (a + b)' = a'b' (b) (ab)' = a' + b' Generalized DeMorgan's Theorem (a) (a + b + … z)' = a'b' … z' (b) (a.b … z)' = a' + b' + … z‘
92. 92. DeMorgan's Theorem  F = ab + c’d’  F’ = ??  F = ab + c’d’ + b’d  F’ = ??  Show that: (a + b.c)' = a'.b' + a'.c'
93. 93. More DeMorgan's example Show that: (a(b + z(x + a')))' =a' + b' (z' + x') Sol: (a(b + z(x + a')))' = a' + (b + z(x + a'))' = a' + b' (z(x + a'))' = a' + b' (z' + (x + a')') = a' + b' (z' + x'(a')') = a' + b' (z' + x'a) =a‘+b' z' + b'x'a =(a‘+ b'x'a) + b' z' =(a‘+ b'x‘)(a +a‘) + b' z' = a‘+ b'x‘+ b' z‘ = a' + b' (z' + x')
94. 94. More Examples (a(b + c) + a'b)'=b'(a' + c') ab + a'c + bc = ab + a'c (a + b)(a' + c)(b + c) = (a + b)(a' + c)