Upload
alison-esberto
View
493
Download
3
Tags:
Embed Size (px)
Citation preview
DIGIDESREVIEW: NUMBER SYSTEMS
June 3, 2010
INTRODUCTION
� A digital computer manipulates discrete elements of information and these elements are represented in binary form.
� Operands used for calculations are expressed in binary number system. Operations are carried Operands used for calculations are expressed in binary number system. Operations are carried out by means of binary logic. Quantities are stored in binary storage elements.
� The purpose of this discussion is to review various binary concepts as a frame of reference for future detailed study of digital logic systems.
NUMBER SYSTEMNumber Representation
� General representation of a number from a base-R system
a4a3a2a1a0.a-1a-2a-3
where:
aj : coefficient with possible values of 0 to r-1
Number System
Number Base Conversion
Integer Representation
Binary Codes, aj : coefficient with possible values of 0 to r-1
i : place value
r : base/radix
� A number expressed in base-r system has coefficients multiplied by powers of r
anrn+an-1rn-1+..+a2r2+a1r+a0
+a-1r-1+a-2r-2+.. +a-(n-1)r-(n-1)+a-nr
-n
Binary Codes, Storage and Registers
Binary Logic
NUMBER SYSTEMCommonly Used Number Systems : Binary, Octal, Hexadecimal
Type of Number
System
Base/radix Possible Values
of Coefficients
Binary 2 0, 1
Octal 8 0, 1, 2, 3, 4, 5, 6,
Number System
Number Base Conversion
Integer Representation
Binary Codes, Octal 8 0, 1, 2, 3, 4, 5, 6, 7
Hexadecimal 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Binary Codes, Storage and Registers
Binary Logic
4401004
3300113
2200102
1100011
0000000
Hexadecimal
(Base 16)
Octal
(Base 8)
Binary
(Base 2)
Decimal
(Base 10)
Number System
Number Base Conversion
Integer Representation
Binary Codes,
NUMBER SYSTEMCommonly Used Number Systems : Binary, Octal, Hexadecimal
F17111115
E16111014
D15110113
C14110012
B13101111
A12101010
91110019
81010008
7701117
6601106
5501015
4401004Binary Codes, Storage and Registers
Binary Logic
NUMBER SYSTEMArithmetic Operations
� Arithmetic operations with numbers in base- r follow the same rules as for decimal
numbers.
� Only the r allowable digits are used.
Number System
Number Base Conversion
Integer Representation
Binary Codes,
� Only the r allowable digits are used.Binary Codes, Storage and Registers
Binary Logic
NUMBER SYSTEMSample Problems
� Write the first 20 decimal digits in base-30, 1, 2, 10, 11, 12, 20, 21, 22, 100,
101, 102, 110, 111, 112, 120, 121, 122,
200, 201,…
Number System
Number Base Conversion
Integer Representation
Binary Codes,
� Add the following numbers in the given base without converting to decimal(1230)4 + (23)4 = (1313)4
(135.4)6 + (43.2)6 = (223.0)6
Binary Codes, Storage and Registers
Binary Logic
NUMBER BASE CONVERSIONSample Problems
Base-10 to Base-2, -8, and -16
� (41.6875)10 = (101001.1011)2
� (153.513)10 = (231.406517)8
� (35.75)10 = (23.C)16
Number System
Number Base Conversion
Integer Representation
Binary Codes, � (35.75)10 = (23.C)16
Base-2 to Base-10, -8, and -16
� (1010.011)2 = (10.375)10
� (1101011.1111)2 = (153.74)8
� (1011001011.1111001)2 = (2CB.F2)16
Binary Codes, Storage and Registers
Binary Logic
NUMBER BASE CONVERSIONSample Problems
Base-8 to Base-2, -10, and -16
� (673.124)8 = (110111011.001010100)2
� (630.4)8 = (408.5)10
� (261.12)8 = (B1.28)16
Number System
Number Base Conversion
Integer Representation
Binary Codes, � (261.12)8 = (B1.28)16
Base-16 to Base-2, -8, and -10
� (306.D)16 = (1100000110.1101)2
� (1A.B)16 = (26.6875)10
� (F2E.A)16 = (7456.5)8
Binary Codes, Storage and Registers
Binary Logic
NUMBER BASE CONVERSIONChallenge
� Convert the decimal number 250.5 to base-3, base-4, and base-7.(100021.1111)3
(3322.2)4
(505.33333)7
Number System
Number Base Conversion
Integer Representation
Binary Codes, (505.33333)7
� Convert the following numbers to decimal(12121)3 = (151)10
(8.3)9 = (8.33333)10
(198)12 = (260)10
Binary Codes, Storage and Registers
Binary Logic
NUMBER BASE CONVERSIONChallenge
� Convert the decimal number 250.5 to base-3, base-4, and base-7.(100021.1111)3
(3322.2)4
(505.33333)7
Number System
Number Base Conversion
Integer Representation
Binary Codes, (505.33333)7
� Convert the following numbers to decimal(12121)3 = (151)10
(8.3)9 = (8.33333)10
(198)12 = (260)10
Binary Codes, Storage and Registers
Binary Logic
Integer Representation (Complements)
� Complements are used in digital computers to simplify subtraction and for logical manipulations.
Number System
Number Base Conversion
Integer Representation
Binary Codes,
� 2 types of complements for each base-r system:
� r’s complement
� (r-1)’s complement
Binary Codes, Storage and Registers
Binary Logic
Integer Representation (Complements) The r’s Complement
� Given a positive number N in base-r with an integer part of n digits, the r’scomplement of N is defined as rn – N for N
≠ 0 and 0 for N = 0.
Number System
Number Base Conversion
Integer Representation
Binary Codes, ≠ 0 and 0 for N = 0.Binary Codes, Storage and Registers
Binary Logic
Decimal Numbers
10’s complement of 52520 is = 105 – 52520 = 47480
10’s complement of 0.3267 is
Binary Numbers
2’s complement of 101100 is = (26)10 – (101100)2= 1000000 – 101100= 010100
2’s complement of 0.0110 is
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Integer Representation (Complements) The r’s Complement
10’s complement of 0.3267 is= 100 – 0.3267= 0.6733
10’s complement of 25.639 is= 102 – 25.639= 74.361
2’s complement of 0.0110 is= (20)10 – (0.0110)2= 1 – 0.0110= 0.1010
2’s complement of 10.001 is= (22)10 – (10.001)2= 100 – 10.001= 1.111
Binary Codes, Storage and Registers
Binary Logic
� Given a positive number N in base-r with an integer part of n digits and a fraction part of m digits, the (r-1)’s complement of N is defined as rn – r-m – N.
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Integer Representation (Complements) The (r-1)’s Complement
N is defined as r – r – N.Binary Codes, Storage and Registers
Binary Logic
Decimal Numbers
9’s complement of 52520 is = 105 – 100 – 52520 = 99999 – 52520 = 47479
9’s complement of 0.3267 is= 100 – 10-4 – 0.3267
Binary Numbers
1’s complement of 101100 is = (26)10 – (20)10 –
(101100)2= 111111 – 101100= 010011
1’s complement of 0.0110 is
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Integer Representation (Complements) The (r-1)’s Complement
= 100 – 10-4 – 0.3267 = 0.9999 – 0.3267 = 0.6732
9’s complement of 25.639 is= 102 – 10-3 – 25.639 = 99.999 – 25.639= 74.360
1’s complement of 0.0110 is= (20)10 – (2-4)10 – (0.0110)2= 0.1111 – 0.0110= 0.1001
1’s complement of 10.001 is= (22)10 – (2-3)10 – (10.001)2= 11.111 – 10.001= 1.11
Binary Codes, Storage and Registers
Binary Logic
Integer Representation (Complements) Subtraction with r’s Complement
� Add the minuend M to the r’s complement of the subtrahend N.
� Inspect the result obtained in step 1 for an end carry:
Number System
Number Base Conversion
Integer Representation
Binary Codes, end carry:
� If an end carry occurs, discard it.
� If an end carry does not occur, take the r’scomplement of the number obtained in step 1 and place a negative sign in front.
Binary Codes, Storage and Registers
Binary Logic
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Using 10’s complement, subtract 72532 – 3250
Using 10’s complement, subtract 3250 - 72532
Integer Representation (Complements) Subtraction with r’s Complement
Binary Codes, Storage and Registers
Binary Logic
NUMBER BASE CONVERSIONSubtraction with r’s Complement
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Using 2’s complement,
subtract
1010100 - 1000100
Using 2’s complement, subtract
1000100 - 1010100
Binary Codes, Storage and Registers
Binary Logic
� Add the minuend M to the (r-1)’s complement of the subtrahend N.
� Inspect the result obtained in step 1 for an end carry:
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Integer Representation (Complements) Subtraction with (r-1)’s Complement
end carry:
� If an end carry occurs, add 1 to the least significant digit (end-around carry).
� If an end carry does not occur, take the (r-1)’s complement of the number obtained in step 1 and place a negative sign in front.
Binary Codes, Storage and Registers
Binary Logic
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Integer Representation (Complements) Subtraction with (r-1)’s Complement
Using 9’s complement, subtract 72532 – 3250
Using 9’s complement, subtract 3250 - 72532
Binary Codes, Storage and Registers
Binary Logic
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Integer Representation (Complements) Subtraction with (r-1)’s Complement
Using 1’s complement,
subtract
1010100 - 1000100
Using 1’s complement, subtract
1000100 - 1010100
Binary Codes, Storage and Registers
Binary Logic
� Binary codes
� used to represent any discrete element of information distinct among a group of quantities
� Binary codes merely change the symbols and
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersBinary Codes
Binary codes merely change the symbols and
not the meaning of the elements of information that they represent.
� In representing a group of 2n distinct elements in a group, a minimum of n bits must be adopted.
Binary Codes, Storage and Registers
Binary Logic
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersBinary Codes
010 010000100110010100102
010 001000010111010000011
010 000100000000001100000
Biquinary
504 3210242184-2-1Excess-3
BCD
(8421)
Decimal
Digit
Binary Codes, Storage and Registers
Binary Logic
101 000011111111110010019
100 100011101000101110008
100 010011011001101001117
100 001011001010100101106
100 000110111011100001015
011 000001000100011101004
010 100000110101011000113
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersBinary Codes: Error Detection Code
010101
100100
010011
100010
100001
010000
Even ParityOdd ParityMessage
Binary Codes, Storage and Registers
Binary Logic
011111
101110
101101
011100
101011
011010
011001
101000
100111
010110
010101
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersBinary Codes: Gray Code (Reflected Code)
01115
01104
00103
00112
00011
00000
Reflected CodeDecimal Number
Binary Codes, Storage and Registers
Binary Logic
100015
100114
101113
101012
111011
111110
11019
11008
01007
01016
01115
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersBinary Codes: Alphanumeric Codes
� 6-Bit internal code“A” 010 001 “1” 000 001
“B” 010 010 “5” 000 101
� 7-Bit ASCII code“A” 100 0001 “1” 011 001
Binary Codes, Storage and Registers
Binary Logic
“A” 100 0001 “1” 011 001
“B” 100 0010 “5” 011 101
� 8-Bit EBCDIC code“A” 1100 0001 “1” 1111 0001
“B” 1100 0010 “5” 1111 0101
� Register
� a group of binary cells used to store and hold binary information
� A register with n cells can store any discrete quantity of information that contains n-bits.
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersRegisters
quantity of information that contains n-bits.
� The state of a register is an n-tuple number of 1’s and 0’s with each bit designating the state of one cell in the register.
� The content of a register is a function of the interpretation given to the information stored in it.
Binary Codes, Storage and Registers
Binary Logic
Given a 16-cell register:Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersRegisters
16151413121110987654321
1001001111000011
� State: (16-tuple number) 1100001111001001
� Content:
Binary equivalent (50121)10
Alphanumeric code (EBCDIC) C, I
Excess-3 code 9096
Binary Codes, Storage and Registers
Binary Logic
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersRegisters: Register Transfer
Binary Codes, Storage and Registers
Binary Logic
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Codes, Storage and RegistersRegisters: Register Transfer
Binary Codes, Storage and Registers
Binary Logic
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary Logic
� Binary Logic
� is used to describe, in a mathematical way, the manipulation and processing of binary information
Consists of binary variables and logical Binary Codes, Storage and Registers
Binary Logic
� Consists of binary variables and logical operations
� Variables are designated by letters of the alphabet such as A, B, C, x, y, z, etc. with each variable having only two distinct values: 1 and 0
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary LogicDefinition
� Binary Logic
� is used to describe, in a mathematical way, the manipulation and processing of binary informationBinary Codes,
Storage and Registers
Binary Logic
� Consists of binary variables and logical operations
� Variables are designated by letters of the alphabet such as A, B, C, x, y, z, etc. with each variable having only two distinct values: 1 and 0
Number System
Number Base Conversion
Integer Representation
Binary Codes,
Binary LogicLogical Operations
� Three basic logical operations are: AND, OR, and NOT
Binary Codes, Storage and Registers
Binary Logic
� Truth table
• a table of all possible combinations of the variables showing the relation between the values that the variables may take and the result of the operation