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.

In shortUse laws like De Morgan to rewrite logic. Fewer gates means less area, less power and less delay.

Theory in plain words

Design flowTruth tableBoolean expressionSimplify (laws or K-map)Gates
Design flow

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

LawAND formOR form
IdentityA . 1 = AA + 0 = A
NullA . 0 = 0A + 1 = 1
IdempotentA . A = AA + A = A
ComplementA . !A = 0A + !A = 1
CommutativeA . B = B . AA + B = B + A
DistributiveA . (B + C) = A.B + A.CA + B.C = (A + B).(A + C)
AbsorptionA . (A + B) = AA + 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

Equivalence checker (De Morgan and absorption)Try it Yourself

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.

ABCY
0000
0111
1011
1100
1111
Tip:In C, the same ideas simplify conditions: !(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?

2. Why simplify logic?

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.