Lecture 04 - Logical Operations
Lecture 04 - Logical Operations
Lecturer (CS)
Institute of Space Technology, Islamabad
Logical Operations
• The value of a Boolean expression may either be ‘true’ or ‘false’,
represented by a ‘1’ or a ‘0’
• There are three basic Boolean expressions:
• AND
• OR
• NOT
• Other logic operations (derived from these three) include ‘NAND’,
‘NOR’, ‘XOR’ etc.
Logical Operations
• AND
• ‘if any input is low (0), output is low’ or ‘output is high (1) only if all the inputs are
high’
• Two or more inputs, only one output
• OR
• ‘if any input is high, output is high’ or ‘output is low only if all the inputs are low’
• Two or more inputs, only one output
• NOT
• ‘output is complement of the input’
• Single input, single output
Logical Operations
• Truth table
• Contains all the possible input values and their outputs
• 2n entries of a truth table show all the possible input combinations (n =
number of inputs)
• Boolean expression
• Consists of Boolean variables
• Another way to represent the input-output relationship
Logical Operations
• Logical Diagram (circuit)
• Representation in the form of a circuit
• All the inputs and outputs can have only two values, ‘0’ or ‘1’
Logic AND:
Truth Table Logical Diagram
x y z x
z
y
0 0 0
0 1 0
Boolean Equation
1 0 0
1 1 1
z x y
Logic OR:
Truth Table Logical Diagram
x y z x
z
y
0 0 0
0 1 1
Boolean Equation
1 0 1
1 1 1 z x y
Logical NOT:
Truth Table Logical Diagram
x y x y
0 1
1 0 Boolean Equation
y x'
Logic NAND:
Truth Table Logical Diagram
x y z x
z
y
0 0 1
0 1 1
Boolean Equation
1 0 1
1 1 0 z x y
Logic NOR:
Truth Table Logical Diagram
x y z x
z
y
0 0 1
0 1 0
Boolean Equation
1 0 0
1 1 0 z x y
Logic XOR:
Truth Table Logical Diagram
x y z x
z
y
0 0 0
0 1 1
Boolean Equation
1 0 1
1 1 0 z x y
Logic XNOR:
Truth Table Logical Diagram
x y z x
z
y
0 0 1
0 1 0
Boolean Equation
1 0 0
1 1 1 z=x y