Dr. Nermin Hamza 1
Materials Book: Digital Design 4 th M. Morris Mano and Michael D. Ciletti 2
Agenda Introduction Number System 3
Introduction Digital Logic and Computer Organization is the science of utilizing logic design in organizing digital systems, including computer systems. A Digital System is a one in which all signals are represented by discrete values. Computers, calculators and most electronic systems contains large amount of digital logic. 4
Introduction Digital systems usually operate with two-valued signals (0 & 1). Inputs an outputs of a digital system represent real quantities, binary (two-valued), or otherwise encoded multi-valued. Multi-valued inputs (decimal, character,…,etc.) each, must be represented by a set of binary digits (bits), which we call coding the inputs into binary. 5
Introduction Examples: 1- A System with three inputs A, B and C and one output Z, such that Z =1 iff two of the inputs are 1. ABCZ
Introduction SOLUTION : ABCZ
Number system 1- Decimal system 8
The decimal: numeral system (also called base ten or occasionally denary) has ten as its base. Its digits from 0 to 9. It is the numerical base most widely used by modern civilizations 9 Number System
decimal system Let 7392 Which means : 7* * * *10 0 So : as a law If : …. a 3 a 2 a 1 a 0 ……. a 3 *10 3 +a 2 *10 2 +a 1 *10 1 +a 0 *
Number System Let Which means : 0. 9* * * *10 -4 So : as a law If : 0.a -1 a -2 a -3 a -4 0.a -1 * a -2 * a -3 * a -4 *
Number System So the : a 3 a 2 a 1 a 0.a -1 a -2 a -3 a -4 a 3 *10 3 +a 2 *10 2 +a 1 *10 1 +a 0 * a -1 * a -2 * a -3 * a -4 *
Binary System 13
Number System What about binary system? the digit at Decimal system from 0 to 9 so the base is 10 In binary system the digit is: 0 or 1 so the base is 2 The previous law could be the same but with base of two 14
Octal System 15
Octal System The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. 16
Hexadecimal System 17
Hexadecimal hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F (or alternatively a–f) to represent values ten to fifteen. For example, the hexadecimal number 2AF3 is equal 18
Conversion To Decimal System: 19
Number System The general law for conversion to decimal system: N = d n * R n + d n-1 * R n-1 +…+ d 0 * R 0 + d -1 *R -1 +…d -m * R -m Where n is number of digits, m number of fraction digits and R is the radix/base and d i are the coefficients such that 0 ≤ d i < R 20
Number System From binary to Decimal a 3 a 2 a 1 a 0.a -1 a -2 a -3 a -4 a 3 *2 3 +a 2 *2 2 +a 1 *2 1 +a 0 *2 0 +a -1 *2 -1 +a -2 *2 -2 +a -3 *2 -3 +a -4 *2 -4 Example : = 1*2 4 +1*2 3 +0*2 2 +1*2 1 +0* * * = =
Number System Convert the number ( ) 5 The solution is : (511.4) 10 22
From Decimal to binary 23
Number System To compute the binary equivalent of a decimal number: divide the decimal number by the radix (2 in this case) keep the remainder, divide again and keep the remainder, repeat this process until the result of the division is zero The sequence of digits obtained (the remainders) arranged from right to left is the number in the radix (binary) system. 24
Number System Example (decimal to binary): 9) 10 = ??) 2 Divide by 2 numberquotientReminderCoeffectiont 941a 0 = 1 420a 1 = 0 210a 2 = 0 101a 3 = 1 a 3 a 2 a 1 a
Number System Solve : (41) 10 : (???) 2 numberquotientReminderCoeffectiont 41201a 0 = a 1 = a 2 = 0 521a 3 = 1 210a 4 = 0 101a 5 = 1 The solution :
Number System The fraction part : Multiply by two numberIntegerfractionCoefficient * a -1 = *200.75a -2 = *210.5a -3 = 1 0.5*210a -4 = 1 0. a -1 a -2 a -3 a
Number System Rule: Conversion from decimal to binary Divide the number by two in the integer part And multiply by two in the fraction part 28
Number System From base 10 to base Division. Multiplication Reminder. Integer 29
Number System Convert the following decimal into Binary numbers: a b. 512 c. 217 d. 177 e. 105 Convert the following Binary numbers to Decimal: a b c d
What about from decimal to octal and Hexadecimal ?? 31
Number System 1- from decimal to octal like binary but divide by 8 in integer part and multiply by 8 in fraction part 2- from decimal to hexadecimal but divide by 16 32
From binary to octal 33
Number System From binary to octal Octal (r=8) so 7= 111 Every 3 digits one digit at octal system Ex:
Number System ( ) 2 ( ??) 8 Solution is : ( ) = ( ) 8 = (1352) 8 35
From binary to Hexadecimal 36
Number System From binary to hexadecimal Hexadecimal (r=16) so 15= 1111 Every 3 digits one digit at octal system Ex:
Number System ( ) 2 ( ??) 8 Solution is : ( ) = ( ) 8 = (1352) 8 38
Number System Exercises: 1- ( ) 2 (???) (???) ( )2 (??) 8 4- (1352.7) 8 (??) ( ) 10 (??) Solutions 1- (2EA.8) (746.5) (1352) 8 4- ( ) (1352.7) 8 39
Number System Binary Addition
Number System Binary Subtraction:
Number System One-bit Adder C in a b C out S 42
Number System 43
RADIX COMPLEMENT If N is number for base r (r-1)’s complement = (r n -1)-N r’s complement = r n -N ≠ 0 r’s complement = (r-1)’s complement +1 44
RADIX COMPLEMENT In binary system : 1’s complement and 2’s complement 101 = 1’s comp. is : 010 r= 2 r-1=1 …. 1’s complement : (2 n -1)-N Let (2 3 =8 )-1= 7 so = 2’s complement is : 011 r =2 r n -N Let (2 3 =8 ) = 1000 =
RADIX COMPLEMENT Get 1’s complement and 2’s complement For : and Solution: 1’s : and ’s: and
RADIX COMPLEMENT Get 9’s comp and 10’s comp For : and The solution : 9’s comp: and ’s comp: and
Exercise Solve : a. (127.4) 8 ( ) 10 b. (B65F) 16 ( ) 10 c. (110101) 2 ( ) 10 d. (153) 10 ( ) 8 48
Exercise The solution a. (127) 8 (87 ) 10 b. (B65F) 16 (46687 ) 10 c. (110101) 2 ( 53) 10 d. (153) 10 ( 231) 8 49