Boolean Logic
Boolean Logic
1
Introduction
2
Introduction
3
3.2 Boolean Algebra
4
Truth Tables
• Help us understand Boolean logic and logic gates
• Shows how the input of a Boolean operation relates to its output
• Input combinations are shown on the left of the truth table
• 1 column for each input variable
• Output is shown on the right of the truth table
A B OUTPUT
0 0 0
Outputs are listed on the RHS
Input names 0 1 0
1 0 0
1 1 1
Scenario 2
First switch is closed, second switch is open
S1 = 1, S2 = 0
No current flows
No signal received in the output
Scenario 3
First switch is open, second switch is closed
S1 = 0, S2 = 1
No current flows
No signal received in the output
Scenario 4
First switch is closed, second switch is closed
S1 = 1, S2 = 1
Current flows
Output signal is received
AND Gate
In the Boolean AND operation the sign . is used
Note: 1.1 is not the same as 1+1
1.1 = 1
1+1 = 10
Let S1 = A, S2 = B
AND
moths AND butterflies
Boolean Operator OR
Scenario 2
First switch is closed, second switch is open
S1 = 1, S2 = 0
Current flows through the S1 circuit
Output signal is received
Scenario 3
First switch is open, second switch is closed
S1 = 0, S2 = 1
Current flows through the S2 circuit
Output signal is received
Scenario 4
First switch is closed, second switch is closed
S1 = 1, S2 = 1
Current flows
Output signal is received
OR Gate
In the Boolean OR operation the sign + is used
Let S1 = A, S2 = B
Or Truth Table
Input Output
A B Y=A+B (A or B)
0 0 0
1 0 1
0 1 1
1 1 1
OR Venn Diagram
OR
moths OR butterflies
Boolean Operator NOT
When A = 0, A =1
When A = 1, A =0
NOT Gate
Often called the inverter as it inverts (reverses) the incoming signal
If the incoming digital signal to the gate is 1
output from the gate will be 0
If the incoming digital signal to the gate is 0
output from the gate will be 1
NOT
moths NOT butterflies
NAND Gate
A combination of a NOT gate and an AND gate
AND gate
Output is 1 when all inputs are 1
NOT gate
Invert incoming data
NAND gate
Output of the AND gate is inverted
Output is 0 when all inputs are 1
Output is 1 for all other input combinations
In the Boolean NAND operation the signs ¬ and . are used
NAND Truth Table
Input Output
A B Y= ¬A.B (Not A and B)
0 0 1
1 0 1
0 1 1
1 1 0
NOR Gate
A combination of a NOT gate and an OR gate
OR gate
Output is 0 when all inputs are 0
NOT gate
Invert incoming data
NOR gate
Output of the OR gate is inverted
Output is 1 when all inputs are 0
Output is 0 for all other input combinations
In the Boolean NOR operation the signs ¬ and + are used
NOR Truth Table
Or Truth Table
Input Output
A B Y= ¬A+B (Not A or B)
0 0 1
1 0 0
0 1 0
1 1 0
Boolean Operator XOR
In Boolean algebra
XOR returns a true value when either input is true but both differ
0.0 = 0
1.0 = 1
0.1 = 1
1.1 = 0
Boolean Operator XOR
Exclusive OR
a logical operation that outputs true only when both inputs differ
(one is true, the other is false)
A or B but not both
It gains the name "exclusive or" because the meaning of "or" is
ambiguous when both operands are true
the exclusive or operator excludes that case.
This is sometimes thought of as "one or the other but not both".
This could be written as "A or B but not A and B".
XOR Gate
Exclusive OR
A modified version of the OR gate
Represented by the symbol
2 inputs, 1 output
OR gate
Output is 1 for the following inputs
01
10
11
XOR gate
Output is 1 for the following inputs
01
10
XOR Truth Table
Input Output
A B Y= ¬A+B (Not A or B)
0 0 0
1 0 1
0 1 1
1 1 0
Logic Gate Symbol Review
AND
OR
NOT
NAND
Logic Gate Symbol Review
NOR
XOR
Boolean Operator Symbols Review
+ OR
. AND
Building a Truth Table
Classroom Example
Represent the diagram displayed below, using a truth table
AND gates
NOT gates
OR gates
AND gates
NOT gates
OR gates
A B A B A .B A. B
0 0 1 1 0 0
0 1 1 0 1 0
1 0 0 1 0 1
1 1 0 0 0 0
OR gate
Building a Truth Table
Step 4
Determine output from OR gate
Symbol for OR is +, e.g. A + B
Value of 1 returned only when either or
both inputs are 1
A B A B A .B A. B A .B + A. B
0 0 1 1 0 0 0
0 1 1 0 1 0 1
1 0 0 1 0 1 1
1 1 0 0 0 0 0
De Morgan’s Laws
(A B)’ = A’ B’
(A B)’ = A’ B’
In binary
The complement of 1 is 0
The complement of 0 is 1
If A = 0
Then A’ = 1
(A + B)’ = A’.B’
A’ + B’ = (A.B)’
De Morgan’s Theorem 1: (A.B)’ = A’ + B’
Binary AND Binary OR
0.0 = 0 0+0 = 0
1.0 = 0 1+0 = 1
0.1 = 0 0+1 = 1
1.1 = 1 1+1 = 1
Truth Table
A B A.B (A.B)’ A’ B’ A’ + B’
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0
De Morgan’s Theorem 2: A’.B’ = (A + B)’
Binary AND Binary OR
0.0 = 0 0+0 = 0
1.0 = 0 1+0 = 1
0.1 = 0 0+1 = 1
1.1 = 1 1+1 = 1
Truth Table
A B A’ B’ A’.B’ A+B (A + B)’
0 0 1 1 1 0 1
0 1 1 0 0 1 0
1 0 0 1 0 1 0
1 1 0 0 0 1 0