Boolean Logic
Boolean Logic
1
Introduction
2
Introduction
3
3.2 Boolean Algebra
4
• 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
Input Output
A B Y=A.B (A and B)
0 0 0
1 0 0
0 1 0
1 1 1
AND
moths AND butterflies
In Boolean algebra + signifies OR
1+1 means 1 or 1
alternatively
true or true
OR returns a true value when at least one input is true
0+0 = 0
1+0 = 1
0+1 = 1
1+1 = 1
In the Boolean OR operation the sign + is used
Input Output
A B Y=A+B (A or B)
0 0 0
1 0 1
0 1 1
1 1 1
OR
moths OR butterflies
In Boolean algebra an over line symbol signifies NOT
Not reverses the input signal
The output signal will be the opposite of the input
When A = 0, A =1
When A = 1, A =0
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
Input Output
A B
1 0
0 1
NOT
moths NOT butterflies
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
Input Output
A B Y= ¬A.B (Not A and B)
0 0 1
1 0 1
0 1 1
1 1 0
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
Input Output
A B Y= ¬A+B (Not A or B)
0 0 1
1 0 0
0 1 0
1 1 0
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
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".
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
A
Input Output
A B Y= ¬A+B (Not A or B)
0 0 0
1 0 1
0 1 1
1 1 0
AND
OR
NOT
NAND
NOR
XOR
+ OR
. AND
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
AND gates
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
(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)’
(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
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
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