Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CS 352 Introduction to Logic Design Lecture 1 Ahmed Ezzat Number Systems and Boolean Algebra, Ch-1 + Ch-2 1 Outline 2 Introduction Number Systems and Conversion Binary Arithmetic Representation of Negative Numbers Binary Codes Basic Boolean Operations Boolean Expressions and Truth Tables Basic Theorems Commutative, Associative, and Distribitution laws Simplification Theorems Multiplying Out & Factoring DeMorgan’s Laws CS-352 Ahmed Ezzat Introduction 3 Digital Systems: works with discrete values, and can be divided into: – System Design: Breaks overall system into subsystems and specify characteristics of each subsystem – Logic Design: Determine how to interconnect basic building blocks to perform a specific function – Circuit Design: Specify interconnection of specific components, such as resistors and transistors, to form a gate, flip-flop, or other logic block CS-352 Ahmed Ezzat Introduction (2) Switching Circuits: A form of digital system, and comes in 2 flavors: – – 4 Combinational Circuits: Output values depend only on the present input values and not on past values Sequential Circuits: Output depend on both the present and past input values CS-352 Ahmed Ezzat Introduction (3) Boolean Algebra describes the relationship between input and output signals mathematically. To be economic, we need to simplify the boolean algebra Karnaugh map and Quine-McCluskey procedures. Basic memory element used in designing sequential circuit is called Flip/Flop (F/F). F/Fs are the basic building blocks for counters, registers, etc. VHDL is a hardware description language used in the design of Combinational logic, Sequential logic and digital systems. This course is devoted to the study of “Logic Design.” 5 CS-352 Ahmed Ezzat Number Systems and Conversion (1) Decimal numbers are written using positional notations: 2 1 0 -1 2 1 0 -1 101.012 = 1 x 2 + 0 x 2 + 1 x 2 + 0 x 2 + 1 x 2 = 4 + 1 + ¼ = 5.25 6 -2 123.45 = 1 x 10 + 2 x 10 + 3 x 10 + 4 x 10 + 5 x 10 Any positive integer R (R > 1) can be used as a Radix or base of a number system For base R, then R digits (0, 1, 2, 3, …R-1) digits are needed to represent any number in that base Numbers written in positional notation can be written in a power series of R. CS-352 -2 Ahmed Ezzat Number Systems and Conversion (2) 2 1 0 -1 101.018 = 1 x 8 + 0 x 8 + 1 x 8 + 0 x 8 + 1 x 8 = 64 + 1 + 1/64 = 65.015625 1 -2 0 3F16 = 3 x 16 + 15 x 16 = 48 + 15 = 63 7 CS-352 Ahmed Ezzat Number Systems and Conversion (3): Converting Decimal Number N Base R To convert a decimal number N to a base R number: Notice that N = (a n a n-1 ... a 2 a 1 a 0 )R N = an Rn + a n-1 R n-1 + ... + a1 R1 + a0 Divide N by R to get Q1 remainder (i.e., a0) N/R = Q1 = an R n-1 + a n-1 R n-2 + ... + a2 R1 + a 1 Divide Q1 by R to get Q2 remainder (i.e., a1) Repeat process until an is found. 8 CS-352 Ahmed Ezzat Number Systems and Conversion (4): Converting Decimal Number N Base R Convert 53 decimal to a binary number: Check your work! 110101 1 + 0 + 4 + 16 + 32 = 53 9 CS-352 Ahmed Ezzat Number Systems and Conversion (5): Converting Decimal Number N Base R To convert a decimal fraction F to base R: Notice that F = (.a-1 a -2 ... a -m)R Multiply F by R = F * R = a -1 + F1 Multiply F1 by R = F1 * R = a -2 + F2 Repeat process until am is found or process repeats. 10 CS-352 Ahmed Ezzat Number Systems and Conversion (6): Converting Decimal Fraction F Base R Convert 0.625 to a binary number: 0.62510 = (0.101) 2 0.710 = 01 0110 0110 0110…2 11 CS-352 Ahmed Ezzat Number Systems and Conversion (7): Converting Between two bases other than Decimal 12 Best to convert source number to decimal first and then convert the decimal number to the new base: e.g., Convert 231.34 to base 7 CS-352 Ahmed Ezzat Number Systems and Conversion (8): Converting Decimal Fraction F Base R Converting between binary and octal and binary and hexadecimal is easily done by inspection because each octal digit corresponds to exactly three binary digits and each hexadecimal digit corresponds to exactly 4 binary digits. (1 000 111 . 011 001)2 = (1 0 7 . 3 1)8 = (4 7 . 6 4) 16 (F C 2 . 7) 16 = (1111 1100 0010 . 0111) 2 13 CS-352 Ahmed Ezzat Binary Arithmetic (1) 14 Arithmetic is usually done in binary in digital systems because such logic networks are easier to design. The methods for binary addition, subtraction, multiplication, and division are the same as for decimal addition, etc. except that everything is done in powers of 2. Add 5 + 12 in binary: 11 carries 00101 = 5 +01100 = 12 --------10001 = 17 CS-352 Ahmed Ezzat Binary Arithmetic (2) Subtract 5 from 12 in binary: 111 borrows 01100 = 12 - 00101 = 5 --------00111 7 15 CS-352 Ahmed Ezzat Binary Arithmetic (3) Multiply 13 by 5 in binary: 1101 = 13 (multiplicand) x 0101 = 5 (multiplier) --------1101 0000 1101 0000 ------------1000001 = 65 16 CS-352 Ahmed Ezzat Binary Arithmetic (4) Divide 14510 (dividend) by 1110 (divisor) in binary: Quotient is 11012 = 1310, and remainder is 102 = 210 17 CS-352 Ahmed Ezzat Representation of Negative Numbers (1) 18 Sign and Magnitude Representation: For an n-bits number, the MSB is the sign bit and the remaining (n-1) bits represents the magnitude. Thus an n-bit word can represent +2n-1 -2n-1 integer numbers 2’s Complement and 1’s Complement Representation: is more common because arithmetic operations are easier. Thus an n-bit word can represent +(2n-1 -1) 0 -2n-1 CS-352 Ahmed Ezzat Representation of Negative Numbers (2) 19 CS-352 Ahmed Ezzat Representation of Negative Numbers (3) 20 CS-352 Ahmed Ezzat Representation of Negative Numbers (4) 21 CS-352 Ahmed Ezzat Representation of Negative Numbers (5) 22 CS-352 Ahmed Ezzat Representation of Negative Numbers (6) 23 1’s complement addition is similar to 2’s complement addition except that instead of discarding the last carry-bit, it is added to the n-bit (LSB) of the sum in the position furthest to the right. CS-352 Ahmed Ezzat Binary Codes (1) 24 Computers internally use binary, however I/O devices typically use decimal numbers. A Binary-Coded-Decimal (BCD – 8-4-2-1) is formed by replacing each decimal digit by its 4-bit binary equivalent: 342.61 --> 0011 0100 0010 . 0110 0001 Excess-3 code is obtained from BCD by adding 3 (0011). The 2-out-of-5 code has exactly 2 bits out of the 5 are 1. Gray code has successive decimal codes differ in only one digit – typically used when transforming analog values into digital form CS-352 Ahmed Ezzat Binary Codes (2) 25 CS-352 Ahmed Ezzat Basic Boolean Operations (1) 26 Basic Mathematics for studying logic design of digital systems is Boolean algebra Basic Operations are AND, OR, and Complement (inverse) Truth Tables list all combinations of inputs and the corresponding outputs for combinational circuits. An AND gate produces a 1 iff all inputs are 1 An OR gate produces a 1 iff one or more inputs are 1 A NOT gate (inverter) produces an output opposite to the input CS-352 Ahmed Ezzat Basic Boolean Operations (2) 27 CS-352 Ahmed Ezzat Basic Boolean Operations (3) Switching Algebra 28 CS-352 Ahmed Ezzat Boolean Expressions and Truth Tables (1) 29 Boolean expression is the application of basic operations to one or more variables (x, y, etc.) or constants (0 or 1) CS-352 Ahmed Ezzat Boolean Expressions and Truth Tables (2) 30 A truth table specifies the values of a Boolean expression for every possible combination of values of the variables in the expression Two expressions are equal iff they have the same truth tables CS-352 Ahmed Ezzat Boolean Expressions and Truth Tables (3) Expressions (AB’ + C) = (A + C)(B’ + C) 31 CS-352 // equivalent Ahmed Ezzat Basic Theorems (1) 32 CS-352 Ahmed Ezzat Basic Theorems (2) 33 The above six axioms completely define switching algebra. All other facts about the system can be proved starting with the axioms. CS-352 Ahmed Ezzat Commutative, Associative and Distributive Laws 34 Commutative law: Associative law: Distributive law: XY = YX X+Y=Y+X (XY)Z = X(YZ) = XYZ (X + Y) + Z = X + (Y + Z) = X + Y + Z XYZ = 1 iff X = Y = Z = 1 X + Y + Z = 0 iff X = Y = Z = 0 X(Y + Z) = XY + XZ X + YZ = (X + Y)(X + Z) CS-352 Ahmed Ezzat Simplification Theorems (1) 35 XY + XY’ = X (X + Y)(X + Y’) = X X + XY = X X(X + Y) = X (X + Y’) Y = XY XY’ + Y = X + Y CS-352 Ahmed Ezzat Simplification Theorems (2) 36 CS-352 Ahmed Ezzat Multiplying Out and Factoring (1) Multiply Out (Sum Of Products): An expression is said to be in sum-ofproducts form when all products are the products of single variables only. The distributive laws are used to multiply out an expression to obtain a sumof-products form. Applying 2nd Distributive law [ (X + YZ) = (X + Y)(X + Z) ] first, when applicable, can reduce the amount of work required to arrive at a simplified sum-of-products form. Example: AB + AC + CD' + E is a sum of products A(B+C) + CD + E' is not a sum of products Multiplying out is a technique that is simpler than traditional multiplication of the given expression 37 CS-352 Ahmed Ezzat Multiplying Out and Factoring (2) Multiplying out: (A + BC)(A + D + E) Assume X = A, Y = BC, Z=D+E Then (X + Y)(X + Z) = X + YZ A + BC(D + E) = A + BCD + BCE Traditional Multiplication Alternative: (A + BC)(A + D + E) = A + AD + AE + ABC + BCD + BCE = A(1 + D + E + BC) + BCD + BCE = A + BCD + BCE 38 Multiplying out: AB'(C + D) + (C + D)' Assume X = AB’ Y = (C + D)’ and using XY’ + Y = X + Y Then: AB'(C + D) + (C + D)' = XY’ + Y X + Y = AB' + (C + D)' CS-352 Ahmed Ezzat Multiplying Out and Factoring (3) 39 Multiplying out: (A + B)(B + C)(B + D')(ACD' + E) = (A + B)(B + CD')(ACD' + E) by D2 = (B + ACD')(ACD' + E) by D2 = ACD' + BE by D2 Multiplying out: (A + B')(A + D' + C)(A + D' + B) = (A + B')(A + D' + BC) by D2 = A + B'(D' + BC) by D2 = A + B'D' by D1 Factoring (Product-of-Sums): A + B’CD Assume: X = A, Y = B’, Z = CD = (X +YZ) = (X + Y)(X + Z) = (A + B’)(A + CD) = (A + B’)(A + C)(A + D) CS-352 Ahmed Ezzat Multiplying Out and Factoring (4) 40 Factoring: ABC + A'B'C + CD' = C(AB + A'B') + CD' = C(AB + A'B' + D') = C((AB + A')(AB + B') + D') = C((A + A')(B + A')(A + B')(B + B') + D') = C((B + A')(A + B') + D') = C(B + A'+ D')(A + B'+ D') CS-352 by D1 by D1 by D2 by D2 by D2 by D2 Ahmed Ezzat Multiplying Out and Factoring (5) Factoring: ABC + A'B'C = C(AB + A'B') = C((AB + A')(AB + B')) = C( (A' + A) (A' + B) (B' + B)(B' + A) ) by D1 by D2 by D2 = C(A' + B)(B' + A) 41 CS-352 Ahmed Ezzat Multiplying Out and Factoring (6) 42 Factoring: C’D + C’E’ + G’H = C’(D + E’) + G’H = (C’ + G’H)(D + E’ + G’H) = (C’ + G’)(C’ + H)(D + E’ + G’)(D + E’ + H) CS-352 by D1 by D2 by D2 Ahmed Ezzat DeMorgan’s Laws (1) DeMorgan's laws: the inverse or complement of any Boolean expression can be found by successively applying the following theorems: (X + Y)' = X'Y' (XY)' = X'+ Y' DeMorgan's laws are generalized as follows: (X 1 + X 2 + X 3 + ... + X n )' = X1'X2'X3' ... Xn' (X 1 X 2 X 3 ... X n )' = X1'+ X2'+ X3'+ ... + Xn' 43 CS-352 Ahmed Ezzat DeMorgan’s Laws (2) 44 Method: Replace each variable with its complement. Replace 0 with 1 and 1 with 0. Replace OR with AND and AND with OR. Note: ANDing takes precedence over ORing. Use parentheses to preserve operation hierarchy in the complemented expression. CS-352 Ahmed Ezzat DeMorgan’s Laws (3) 45 Example: [(a'b + 1)(cd + e') + f(g'+ 0) + h]' = ([a'b + 1]' + [cd + e']') * ([f(g'+ 0)]') * (h') = ([a'b]'0 + [cd]'e) (f'+ [g'+ 0]') h' = ((a + b')0 + (c'+ d')e)(f' + g1)h' CS-352 Ahmed Ezzat DeMorgan’s Laws (4) 46 [(A’ + B)C’]’ = [(A’ + B)’ + C] = AB’ + C [(AB’ + C)D’ + E]’ = [(AB’ + C)’ + D] E’ = [(AB’)’ C’ + D]E’ = [(A’ + B)C’ + D]E’ [A’B + AB’]’ = (A’B)’ (AB’)’ = (A + B’)(A’ + B) = AA’ + AB + A’B’ + BB’ = AB + A’B’ CS-352 Ahmed Ezzat 47 CS-352 Ahmed Ezzat