Complex logic gates
We can represent Boolean logic by creating circuit diagrams that combine simple logic gates. Logic gates can be built up into chains of logical decisions. Some logic gates may have more than two inputs.
The diagram below shows a complex logic gate combining three simple gates. It is possible to work out intermediate outputs (D, the output of the NOT gate, and E, the output of the AND gate) along with the final output. For example:
Z = NOT A OR (B AND C)
This logic gate truth table is written as:
| Input A | Input B | Input C | D = NOT A (intermediate output - NOT gate) | E = B AND C (intermediate output - AND gate) | Z = D OR E (final output - OR gate) |
| 0 | 0 | 0 | 1 | 0 | 1 |
| 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 0 | 1 | 1 |
| Input A | 0 |
|---|---|
| Input B | 0 |
| Input C | 0 |
| D = NOT A (intermediate output - NOT gate) | 1 |
| E = B AND C (intermediate output - AND gate) | 0 |
| Z = D OR E (final output - OR gate) | 1 |
| Input A | 0 |
|---|---|
| Input B | 0 |
| Input C | 1 |
| D = NOT A (intermediate output - NOT gate) | 1 |
| E = B AND C (intermediate output - AND gate) | 0 |
| Z = D OR E (final output - OR gate) | 1 |
| Input A | 0 |
|---|---|
| Input B | 1 |
| Input C | 0 |
| D = NOT A (intermediate output - NOT gate) | 1 |
| E = B AND C (intermediate output - AND gate) | 0 |
| Z = D OR E (final output - OR gate) | 1 |
| Input A | 0 |
|---|---|
| Input B | 1 |
| Input C | 1 |
| D = NOT A (intermediate output - NOT gate) | 1 |
| E = B AND C (intermediate output - AND gate) | 1 |
| Z = D OR E (final output - OR gate) | 1 |
| Input A | 1 |
|---|---|
| Input B | 0 |
| Input C | 0 |
| D = NOT A (intermediate output - NOT gate) | 0 |
| E = B AND C (intermediate output - AND gate) | 0 |
| Z = D OR E (final output - OR gate) | 0 |
| Input A | 1 |
|---|---|
| Input B | 0 |
| Input C | 1 |
| D = NOT A (intermediate output - NOT gate) | 0 |
| E = B AND C (intermediate output - AND gate) | 0 |
| Z = D OR E (final output - OR gate) | 0 |
| Input A | 1 |
|---|---|
| Input B | 1 |
| Input C | 0 |
| D = NOT A (intermediate output - NOT gate) | 0 |
| E = B AND C (intermediate output - AND gate) | 0 |
| Z = D OR E (final output - OR gate) | 0 |
| Input A | 1 |
|---|---|
| Input B | 1 |
| Input C | 1 |
| D = NOT A (intermediate output - NOT gate) | 0 |
| E = B AND C (intermediate output - AND gate) | 1 |
| Z = D OR E (final output - OR gate) | 1 |
Case study – Boolean logic
School children are rewarded for healthy eating in the school canteen. If they buy a combination of a healthy starter, main and dessert, they receive bonus points on their loyalty card.
The school canteen will always offer one healthy starter, a choice of two healthy mains and one healthy dessert option.
A sample menu is shown below:
Starters
- Vegetable soup (healthy option)
- Chicken wings
- Garlic mushrooms
Mains
- Vegetable lasagne (healthy option)
- Fish cakes (healthy option)
- Hamburger
- Lasagne
Dessert
- Fruit salad (healthy option)
- Ice cream
The selections that will qualify for bonus points can be represented as:
Vegetable soup AND (vegetable lasagne OR fish cakes) AND fruit salad.