Logic Gates and oolean lgebra The ridge etween Symbolic Logic nd Electronic Digital Computing Compiled y: Muzammil hmad Khan mukhan@ssuet.edu.pk asic Logic Functions and or nand nor xor xnor not 2 Logic Gates and oolean lgebra
Logic Gate Symbols! ND! OR! NND! NOR! XOR! XNOR! NOT 3 Logic Gates Logic Gate 4! Logic Gates are the basic building blocks for building electronic (digital) circuits! They have output terminal, and ( n ) input terminal(s)! Output will be or, depending on the digital levels of the input terminal(s)! These gates form the basic building blocks of digital systems; that evaluate digital input levels and produce specific output response! 7 Logic Gates: ND, OR, NOT, NND, NOR, XOR, X-NOR Logic Gates and oolean lgebra 2
Logic Gate Notations! Not is written Ā! and is written! or is written +! xor is written 5 Related Terminologies 6! oolean Expression n expression which evaluates to either true or false is called a oolean Expression. n expression that results in a value of either TRUE or FLSE. For example, the expression 2 < 5 (2 is less than 5) is a oolean expression because the result is TRUE. ll expressions that contain relational operators, such as the less than sign (<), are oolean. The operators -- ND, OR, XOR, NOR, and NOT -- are oolean operators. oolean expressions are also called comparison expressions, conditional expressions, and relational expressions. Logic Gates and oolean lgebra 3
Related Terminologies 7! Truth Table truth table shows how a logic circuit's output responds to various combinations of the inputs, using logic for true and logic for false. truth table is a breakdown of a logic function by listing all possible values the function can attain ll permutations of the inputs are listed on the left, and the output of the circuit is listed on the right. The desired output can be achieved by a combination of logic gates. truth table can be extended to any number of inputs. The input columns are usually constructed in the order of binary counting with a number of bits equal to the number of inputs. Related Terminologies! Logic Circuit Logic Circuit is a graphical representation of a program using formal logic 8 Logic Gates and oolean lgebra 4
ND Gate ND! This is a Two-Input ND Gate (label inputs & output)! y convention, letters, are used as inputs, and letter(s) X is used as output! ND Gate Operation is defined as: The output, X, is HIGH if input and input are both HIGH. Output is only when all inputs are! Let s complete a truth table for the ND gate 9 ND Gate ND! ND Gate Truth Table X = X = X = X = ND Truth Table X Logic Gates and oolean lgebra 5
ND Gate ND! Notation of ND Gate ND.! ND gates may have more than two inputs! How many combinations to be listed in a truth table? OR Gate OR! This is a two-input OR gate (label inputs & output)! OR Gate Operation is defined as: The output at X will be HIGH whenever input or input is HIGH or both are HIGH. Output is only when any of the inputs is! Let s complete a truth table for the OR gate 2 Logic Gates and oolean lgebra 6
OR Gate OR! OR Gate Truth Table X = X = X = X = OR Truth Table X 3 OR Gate OR! Notation of OR Gate OR +! ND gates may have more than two inputs! How many combinations to be listed in a truth table? 4 Logic Gates and oolean lgebra 7
NOT Gate NOT! Not gate is also known as Inverter Gate! NOT gate is a one-input-one-output logic gate! Notation of NOT Gate: NOT = 5 NOT Gate NOT! Not Gate Truth Table NOT Truth Table X When =, Output X is NOT, Hence = When =, Output X is NOT, Hence = 6 Logic Gates and oolean lgebra 8
XOR Gate! XOR is also called as Exclusive OR! Operation of XOR gate True if either true but not both! Similar Input, Output will be! Dissimilar Input, Output will be! Notation of XOR gate: + 7 XOR Gate! XOR Truth Table XOR Truth Table True if either true but not both Similar Input, Output will be X Dissimilar Input, Output will be 8 Logic Gates and oolean lgebra 9
XOR Gate 9 NND Gate NND! NND gate ( NOT-ND = NND, opposite of ND )! The simplest NND gate is a two-input-oneoutput logic gate! Operation of NND gate: NND gate = Output is only when all inputs are 2 Logic Gates and oolean lgebra
NND Gate NND! NND Gate Truth Table X = X = X = X = NND Truth Table X 2 NOR Gate NOR! NOR gate ( NOT-OR = NOR, opposite of OR )! The simplest NOR gate is a two-input-one-output logic gate! Operation of NOR gate: NOR gate = Output is only when all inputs are 22 Logic Gates and oolean lgebra
NOR Gate NOR! NOR Gate Truth Table X = X = X = X = NOR Truth Table X 23 NXOR Gate! NXOR gate ( NOT-XOR = NOR, opposite of XOR )! The simplest NXOR gate is a two-input-oneoutput logic gate! Operation of XNOR gate Similar Input, Output will be Dissimilar Input, Output will be 24 Logic Gates and oolean lgebra 2
NXOR Gate! NXOR Truth Table NXOR Truth Table X 25 oolean Exp Logic Circuit! To draw a circuit from a oolean expression: From the left, make an input line for each variable. Next, put a NOT gate in for each variable that appears negated in the expression. Still working from left to right, build up circuits for the sub-expressions, from simple to complex. 26 Logic Gates and oolean lgebra 3
Logic Circuit: + (+)! Logic Circuit: + (+)! Input Lines for Variables 27 Logic Circuit: + (+)! NOT Gate for 28 Logic Gates and oolean lgebra 4
Logic Circuit: + (+)! Sub-expression 29 Logic Circuit: + (+)! Sub-expression + + 3 Logic Gates and oolean lgebra 5
Logic Circuit: + (+)! Sub-expression + + + 3 Logic Circuit: + (+)! Sub-expression ( + ) + + 32 (+) Logic Gates and oolean lgebra 6
Logic Circuit: + (+)! Entire Expression + + 33 (+) Logic Circuit oolean Exp! In the opposite direction, given a logic circuit, we can write a oolean expression for the circuit.! First we label each input line as a variable.! Then we move from the inputs labeling the outputs from the gates.! s soon as the input lines to a gate are labeled, we can label the output line.! The label on the circuit output is the result. 34 Logic Gates and oolean lgebra 7
Logic Circuit oolean Exp + + _ + 35 Entire Expression _ (+) (+) Simplifying oolean Expressions! s in ordinary algebra, some oolean expressions can be simplified! The logic circuit that results from a simplified expression will have fewer gates and operations! XOR is not a asic Function 36 = + Logic Gates and oolean lgebra 8
Laws of oolean lgebra Identity Law Zero Law + =. =. = + = Idempotent Law Commutative Law + = + = +. = = 37 ssociative Law Distributive Law (+) + C = + (+C) (+C) = + C () C = (C) + C = (+) (+C) Laws of oolean lgebra bsorption Law + = (+) = Complement Law + _ = _ = DeMorgan s _ Law + = = + Double Complement _ = 38 Logic Gates and oolean lgebra 9
Identity and Null Law! Identity Law! Null Law! + =!. =! =! + =!. =! = Ā 39 Idempotence and Inverse Law! Idempotence Law! Inverse Law! + =!. =! =! + Ā =!. Ā =! Ā = = 4 Logic Gates and oolean lgebra 2
Commutative and ssociative Law! Commutative Law! ssociative Law! + = +! =! =! + + C = (+)+C = +(+C)! C = () C = (C)! C = ( ) C = ( C) 4 Distributive and bsorption Law! Distributive Law! bsorption Law! + C = ( + C)! C = ( C)! + =! (+) = 42 Logic Gates and oolean lgebra 2
DeMorgan s Law + = = + 43 DeMorgan s Law! Implementation of DeMorgan's Theorem with basic gates. 44 Logic Gates and oolean lgebra 22
Simplification Revisited 45! Once we have the E for the circuit, perhaps we can simplify. ( + )( + ) = ( + ) = = = ( + )( + )( + ) ( + + ) ( + ) = + = Logic Circuit oolean Exp 46 Reduces to: Logic Gates and oolean lgebra 23
Example 47 ( + ) pply Distributi ve Law + pply Inverse Law + pply Identity Law Example 2 48 + C + D + CD pply ssociative Law ( + C) + (D + CD) pply Distributive Law ( + C) + D( + C) pply Distributive Law again ( + D)( + C) Logic Gates and oolean lgebra 24
Example 3 49 + + ( ) Use Substituti on ( + ) pply ssociative Law ( + ) + + pply Idempotence Use Substituti on Example 4 5 + + pply ssociativ e Law + ( + ) pply DeMorgan' s Law + pply Inverse Law Logic Gates and oolean lgebra 25
Example 5 5 Rewrite using nd & Or + pply DeMorgan' s ( )( ) pply DeMorgan' s Law again ( + )( + ) Law Example 5 (continued) ( + )( + ) pply Inverse ( + )( + ) Law pply Distributi ve Law + + + pply Inverse Law + + + pply Identity Law + 52 Logic Gates and oolean lgebra 26
Example 6 53 + ( + ) ( )( DeMorgan's Law DeMorgan's Law + + + Distributive Law + + + Inverse Law + Identity Law Equivalence ( + )( + ) pply InverseLaw lgebraic Manipulation Examples 54. X + XY = X (+Y) = X 2. XY + XY = X (Y + Y ) = X 3. X + X Y = (X + X ) (X + Y) = X + Y 4. X (X + Y) = X + XY = X ( + Y) = X 5. (X + Y)(X + Y ) = X + XY + XY + YY = X ( + Y ) + XY = X + XY = X + XY = X ( + Y) = X 6. X(X + Y) = XX +XY = XY Logic Gates and oolean lgebra 27
The oolean Triangle oolean Expression Logic Circuit Truth Table 55 Logic Gates Implementation! uilt from transistors solid-state electronic switches either OFF or ON extremely small and fast built from semiconductor materials such as silicon 56 Logic Gates and oolean lgebra 28
Logic Gates Implementation! Transistors -> Gates! Two or more transistors combine to form a gate ND gate -- two transistors in series! value is the control line of the first transistor! value2 is the control line of the second transistor OR gate -- two transistors in parallel! each value is the control line of one transistor NOT gate -- one transistor plus a resistor! value is the control line 57 Where do we go from Gates?! Combinations of gates form electrical circuits Transform a set of oolean input values into a set of oolean output values Output depends solely on current input Each unique combination of inputs produces a specific output value Circuits are combined into integrated circuits (ICs) or computer chips ICs are connected together to carry out more complex tasks Put enough of the right ICs together and you have a computer 58 Logic Gates and oolean lgebra 29
Review asic Logic Gates 59 Conclusion! Logic Gates and oolean lgebra are the bridge between symbolic logic and electronic digital computing. Compiled y: Muzammil hmad Khan mukhan@ssuet.edu.pk 6 Logic Gates and oolean lgebra 3