Home / Learn Chip Programming / Boolean Algebra and Simplifying Logic
Boolean Algebra and Simplifying Logic
Boolean algebra is the mathematics of gates. It lets you shrink a big circuit into a smaller, cheaper and faster one.
Theory in plain words
What it is
Boolean algebra uses variables that are 0 or 1 and three operations: AND (written as multiplication), OR (addition) and NOT (a bar or !).
Why we use it
A first draft of a circuit is usually bigger than needed. Simplifying it saves silicon area, power and time, which on a chip that is made in millions means real money.
How it works
Apply the laws step by step, or use a Karnaugh map (K-map) to see which terms can be merged. Tools like Yosys and Quartus do this automatically, but you must understand the result.
Where it is used
- Designing decoders, controllers and state machines
- Optimising conditions in embedded C
- Understanding synthesis reports
The laws you must know
| Law | AND form | OR form |
|---|---|---|
| Identity | A . 1 = A | A + 0 = A |
| Null | A . 0 = 0 | A + 1 = 1 |
| Idempotent | A . A = A | A + A = A |
| Complement | A . !A = 0 | A + !A = 1 |
| Commutative | A . B = B . A | A + B = B + A |
| Distributive | A . (B + C) = A.B + A.C | A + B.C = (A + B).(A + C) |
| Absorption | A . (A + B) = A | A + A.B = A |
| De Morgan | !(A . B) = !A + !B | !(A + B) = !A . !B |
De Morgan in words: NOT of an AND is the OR of the NOTs, and NOT of an OR is the AND of the NOTs. It is how you turn AND/OR logic into NAND/NOR logic.
Check two expressions are equal
This is how verification tools work: compare outputs for all input combinations. With n inputs there are 2^n rows.
Sum of products and K-map
Any truth table can be written as an OR of AND terms (sum of products). A Karnaugh map arranges the truth table so neighbouring cells differ by one input. Circle groups of 1, 2, 4 or 8 neighbouring ones. Each group becomes one simpler product term.
| A | B | C | Y |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
!(a && b) equals !a || !b. Simpler conditions are easier to read and less likely to be wrong.Quick quiz
1. What is !(A AND B) by De Morgan?
NOT of AND becomes OR of the NOTs.
2. Why simplify logic?
Smaller circuits are cheaper and faster.
Common questions
What is !(A AND B) by De Morgan?
!A OR !B. NOT of AND becomes OR of the NOTs.
Why simplify logic?
To use fewer gates, less power and less delay. Smaller circuits are cheaper and faster.