Download presentation
Presentation is loading. Please wait.
Published byNatalie Hancock Modified over 8 years ago
1
CE1111 :Digital Logic Design lecture 01 Introduction Dr. Atef Ali Ibrahim
2
Course Administration Instructor:Dr. Atef Ali Ibrahim E_mail: attif_ali2002@yahoo.com Office Place: (Room CS-25 ) Office Hrs: TA: Tutorial: Text Book: M. Morris Mano; “Digital Design”, 4thEdition, prentice hall. Prerequisite: Recommended Text: Notes:Lecture slides and Assignments 2
3
Course Objectives Design of Digital logic systems. Building large systems from small components (logic gates ) EEG 481 Lec. 1 Introduction3
4
Chapter 1 4
5
Course Outlines Number Systems (conversion and coding) Boolean Algebra Gate Level minimization Combinational Logic Design Synchronous sequential logic Registers and counters Memories and Programmable logic 5
6
What is the Meaning of Digital Logic Design? Digital means: 6
7
7
8
Why Digital? Digital systems are easier to design and implement than analog systems. EEG 481 Lec. 1 Introduction8
9
9
10
Digital Logic circuit 10
11
11
12
12
13
13
14
N UMBER S YSTEMS – Representation A number with radix r is represented by a string of digits: A n - 1 A n - 2 … A 1 A 0. A - 1 A - 2 … A - m 1 A - m in which 0 A i < r and. is the radix point. The string of digits represents the power series: (Number)r = j = - m j j i i = 0 i rArA (Integer Portion) + (Fraction Portion) i = n - 1 j = - 1
15
Number Systems – Examples GeneralDecimalBinaryOctalHex. Radix (Base)r102816 Digits0 => r - 10 => 90 => 10 => 70 => F 0 1 2 3 Powers of 4 Radix 5 -2 -3 -4 r 0 r 1 r 2 r 3 r 4 r 5 r -1 r -2 r -3 r -4 1 10 100 1000 10,000 100,000 0.1 0.01 0.001 0.0001 1 2 4 8 16 32 0.5 0.25 0.125 0.0625 1 8 64 512 4096 32768 0.125 0.015625 …. ….. 1 16 256 4096 65536 1048576 0.0625 0.00390625 ….
16
Decimal Number System 16
17
Binary Number system EEG 481 Lec. 1 Introduction17
18
Octal Number system 18
19
Hexadecimal Number System 19
20
Numbers with different bases 20 The first 17 numbers in decimal, Binary, octal, and Hexadecimal
21
CONVERSION OF BASES Decimal to Base R number Base R to Decimal Conversion (736.4) 8 = 7 x 8 2 + 3 x 8 1 + 6 x 8 0 + 4 x 8 -1 = 7 x 64 + 3 x 8 + 6 x 1 + 4/8 = (478.5) 10 (110110) 2 =... = (54) 10 (110.111) 2 =... = (6.785) 10 (F3) 16 =... = (243) 10 (0.325) 6 =... = (0.578703703.................) 10 - Separate the number into its integer and fraction parts and convert each part separately. - Convert integer part into the base R number → successive divisions by R and accumulation of the remainders. - Convert fraction part into the base R number → successive multiplications by R and accumulation of integer digits Data Types
22
EXAMPLE Convert 41.6875 10 to base 2. Integer = 41 41 20 1 10 0 5 0 2 1 1 0 0 1 Fraction = 0.6875 0.6875 x 2 1.3750 x 2 0.7500 x 2 1.5000 x 2 1.0000 (41) 10 = (101001) 2 (0.6875) 10 = (0.1011) 2 (41.6875) 10 = (101001.1011) 2 Convert (63) 10 to base 5: (223) 5 Convert (1863) 10 to base 8: (3507) 8 Convert (0.63671875) 10 to hexadecimal: (0.A3) 16 Exercise Data Types
23
Decimal to Octal Conversion 23
24
Decimal to Hex. Conversion 24
25
Binary to Hex. Conversion 25
26
Binary to Octal Conversion 26
27
Signed Numbers 27
28
COMPLEMENT OF NUMBERS Two types of complements for base R number system: - R's complement and (R-1)'s complement The (R-1)'s Complement Subtract each digit of a number from (R-1) Example - 9's complement of 835 10 is 164 10 - 1's complement of 1010 2 is 0101 2 (bit by bit complement operation) The R's Complement Add 1 to the low-order digit of its (R-1)'s complement Example - 10's complement of 835 10 is 164 10 + 1 = 165 10 - 2's complement of 1010 2 is 0101 2 + 1 = 0110 2 Complements
29
SIGNED NUMBERS Representation Signed magnitude representation Signed 1's complement representation Signed 2's complement representation Example: Represent +9 and -9 in 7 bit-binary number Only one way to represent +9 ==> 0 001001 Three different ways to represent -9: In signed-magnitude: 1 001001 In signed-1's complement: 1 110110 In signed-2's complement: 1 110111 Need to be able to represent both positive and negative numbers - Following 3 representations
30
SIGNED NUMBERS Representation Signed Magnitude Signed-1’s complement Signed-2’s complement Decimal 0111 0110 0101 0100 0011 0010 0001 0000 1000 1001 1010 1011 1100 1101 1110 1111 - 0111 0110 0101 0100 0011 0010 0001 0000 1111 1110 1101 1100 1011 1010 1001 1000 - 0111 0110 0101 0100 0011 0010 0001 0000 - 1111 1110 1101 1100 1011 1010 1001 1000 +7 +6 +5 +4 +3 +2 +1 +0 -0 -2 -3 -4 -5 -6 -7 -8 -Range of Signed 2’s complement : -2 n-1 to 2 n-1 -1 -Range of Signed 1’s complement: -2 n-1 +1 to 2 n-1 -1 -Range of Signed Magnitude: -2 n-1 +1 to 2 n-1 -1
31
ARITHMETIC ADDITION: SIGNED MAGNITUDE [1] Compare their signs [2] If two signs are the same, ADD the two magnitudes - Look out for an overflow [3] If not the same, compare the relative magnitudes of the numbers and then SUBTRACT the smaller from the larger --> need a subtractor to add [4] Determine the sign of the result 6 0110 +) 9 1001 15 1111 -> 01111 9 1001 - ) 6 0110 3 0011 -> 00011 9 1001 -) 6 0110 - 3 0011 -> 10011 6 0110 +) 9 1001 -15 1111 -> 11111 6 + 9 -6 + 9 6 + (- 9) -6 + (-9) Overflow 9 + 9 or (-9) + (-9) 9 1001 +) 9 1001 (1)0010 overflow
32
ARITHMETIC ADDITION: SIGNED 2’s COMPLEMENT Example 6 0 0110 9 0 1001 15 0 1111 -6 1 1010 9 0 1001 3 0 0011 6 0 0110 -9 1 0111 -3 1 1101 -9 1 0111 -18 (1)0 1110 overflow 9 0 1001 +) 18 1 0010 (c n-1 c n ) Add the two numbers, including their sign bit, and discard any carry out of leftmost (sign) bit - Look out for an overflow
33
ARITHMETIC ADDITION: SIGNED 1’s COMPLEMENT Add the two numbers, including their sign bits. - If there is a carry out of the most significant (sign) bit, the result is incremented by 1 and the carry is discarded. 6 0 0110 -9 1 0110 -3 1 1100 -6 1 1001 9 0 1001 (1) 0(1)0010 1 3 0 0011 +) end-around carry -9 1 0110 (1)0 1100 1 0 1101 +) 9 0 1001 1 (1)0010 +) overflow Example not overflow (c n-1 c n ) = 0 (c n-1 c n ) Fixed Point Representations
34
COMPARISON OF REPRESENTATIONS * Easiness of negative conversion S + M > 1’s Complement > 2’s Complement * Hardware - S+M: Needs an adder and a subtractor for Addition - 1’s and 2’s Complement: Need only an adder * Speed of Arithmetic 2’s Complement > 1’s Complement(end-around C)
35
ARITHMETIC SUBTRACTION Take the complement of the subtrahend (including the sign bit) and add it to the minuend including the sign bits. ( A ) - ( - B ) = ( A ) + B ( A ) - B = ( A ) + ( - B ) Example : (-6) – (-13) = +7 in 8-bit representation 11111010 – 11110011 = 11111010 + 00001101 = 00000111 (+7) Fixed Point Representations Arithmetic Subtraction in 2’s complement
36
Binary codes Binary codes are used to represent discrete elements of information The codes must be in binary that the computer can only hold 0’s or 1’s. 36
37
Cont. Binary Codes Given n binary digits (called bits), there are 2 n distinct elements that can be represented. But, you can represent m elements, m < 2 n Examples: You can represent 4 elements with n = 2 bits: (00, 01, 10, 11). You can represent 4 elements with n = 4 digits: (0001, 0010, 0100, 1000). This second code is called a "one hot" code.
38
Example: A binary code for the seven colors of the rainbow Code 100 is not used Non-numeric Binary Codes Binary Code 000 001 010 011 101 110 111 Color Red Orange Yellow Green Blue Indigo Violet
39
Decimal BCD(8421) 2421 84-2-1 Excess-3 0 0000 0000 0000 0011 1 0001 0001 0111 0100 2 0010 0010 0110 0101 3 0011 0011 0101 0110 4 0100 0100 0100 0111 5 0101 1011 1011 1000 6 0110 1100 1010 1001 7 0111 1101 1001 1010 8 1000 1110 1000 1011 9 1001 1111 1111 1100 d 3 d 2 d 1 d 0 : symbol in the codes BCD: d 3 x 8 + d 2 x 4 + d 1 x 2 + d 0 x 1 8421 code. 2421: d 3 x 2 + d 2 x 4 + d 1 x 2 + d 0 x 1 84-2-1: d 3 x 8 + d 2 x 4 + d 1 x (-2) + d 0 x (-1) Excess-3: BCD + 3 Note: 8,4,2,-2,1,-1 in this table is the weight associated with each bit position. External Representations D ECIMAL C ODES - Binary Codes for Decimal Digits
40
Chapter 1 40 Binary Coded Decimal (BCD) The BCD code is the 8,4,2,1 code. 8, 4, 2, and 1 are weights BCD is a weighted code This code is the simplest, most intuitive binary code for decimal digits and uses the same powers of 2 as a binary number, but only encodes the first ten values from 0 to 9.
41
Warning: Conversion or Coding? Do NOT mix up conversion of a decimal number to a binary number with coding a decimal number with a BINARY CODE. 13 10 = 1101 2 (This is conversion) 13 0001|0011 (This is coding)
42
BCD Addition BCD addition of two numbers involve following rules:- 1) Maximum value of the sum for two digits = 9 (max digit 1) + 9 (max digit 2) + 1 (previous addition carry) = 19 2) If sum of two BCD digits is less than or equal to 9 (1001) without carry then the result is a correct BCD number. 3) If sum of two BCD digits is greater than or equal to 10 (1010) the result is in-correct BCD number. Perform steps 4 for correct BCD sum. 4) Add 6 (0110) to the result. 42
43
Example -BCD addition Add 599 and 984 using BCD numbers 1 2 3 599 0101 1001 1001 +984 1001 1000 0100 1110 10001 1101 Binary Sum 1, 2 and 3 are greater than 1010. So, from Step 3 and 4 add ‘6’ to the sum. carry 1 1 Result 1110 10001 1101 + 6 0110 0110 0110 1 0101 1000 0011 End Carry Answer. Result of BCD addition is 1583 Exercise: add 599 + 484 using BCD addition 43
44
G RAY C ODE – Decimal
45
A LPHANUMERIC C ODES - ASCII Character Codes ASCII means “American Standard Code for Information Interchange” The ASCII code assigns binary patterns for - Numbers 0 to 9 - All the letters of English alphabet, uppercase and lowercase - Many control functions (E.g. BS = Backspace, CR = Carriage Return) and punctuation marks. The ASCII system uses 7 bits to represent each code 45
46
ASCII Code
47
P ARITY B IT Error-Detection Codes parity, an extra bit appended onto the code word to make the number of 1’s odd or even. A code word has even parity if the number of 1’s in the code word is even. A code word has odd parity if the number of 1’s in the code word is odd.
48
4-Bit Parity Code Example The codeword "1111" has even parity and the codeword "1110" has odd parity. Both can be used to represent 3-bit data. Even Parity Odd Parity Message - Parity Message - Parity 000 - 0 - 1 001 - 1 - 0 010 - 1 - 0 011 - 0 - 1 100 - 1 - 0 101 - 0 - 1 110 - 0 - 1 111 - 1 - 0
49
Parity Bit Generation For b 6 b 5... b 0 (7-bit information); even parity bit b even b even = b 6 b 5 ... b 0 For odd parity bit b odd = b even 1 = b even PARITY BIT GENERATION
50
PARITY GENERATOR AND PARITY CHECKER Parity Generator Circuit (even parity) b6b5b4b3b2b1b0b6b5b4b3b2b1b0 b even Parity Checker b6b5b4b3b2b1b0b6b5b4b3b2b1b0 b even Even Parity error indicator Error Detecting codes
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.