Module 1: Foundations of Digital Logic
Where digital design starts
In 1947 three physicists at Bell Labs got a small piece of germanium to act as a switch, with no moving parts, controlled by a small voltage. That was the first transistor. A transistor in a modern processor switches billions of times a second, and there are billions of them on one chip. Everything digital, from a video stream to a message on your phone, comes down to that one idea: a switch that is either on or off, 1 or 0.
Before you write Verilog to tell those switches what to do, you need the mathematics and logic that describe them. That is what this module covers.
I have seen many people skip this and go straight to Verilog syntax. In my experience it does not save time. Without a working grasp of digital logic you end up spending days debugging hardware problems that ten minutes of Boolean algebra would have prevented.
What the module covers
There are five sections, and each builds on the previous one, so I recommend taking them in order.
- Number systems and binary arithmetic. How hardware represents numbers, how it handles negative values, and what goes wrong when a result does not fit.
- Boolean algebra. The algebra of logic. A small set of rules that let you simplify circuits on paper.
- Logic gates. How Boolean expressions become physical devices, what they cost, and how fast they are.
- Karnaugh maps. A graphical way of simplifying logic expressions before you write any HDL.
- Combinational building blocks. Multiplexers, decoders, encoders, comparators: the standard parts that appear in almost every design.
What you will be able to do afterwards
By the end of the module a few things should feel natural:
- Read a logic diagram in a datasheet and see what it does without reading the accompanying text.
- Spot redundant logic in an expression and simplify it in your head.
- Understand a synthesis report. When the tool infers a ripple-carry adder, you will know what gates it has put on the chip.
- Reason about arithmetic bugs, in particular why an addition overflows and how to detect it.
The sections
1.1 Number Systems and Binary Arithmetic
Bits, bytes and hex, then two’s complement for signed numbers, then binary addition, subtraction and overflow. By the end you should be reading hex as easily as decimal.
1.2 Boolean Algebra
Boole published his algebra in 1854, a century before the first electronic computer. We cover the axioms and theorems, De Morgan’s laws and canonical forms, and practise simplifying expressions by hand.
1.3 Logic Gates
The seven basic gates, the compound cells found in real libraries, why NAND and NOR are universal, and what a CMOS gate looks like at transistor level.
1.4 Karnaugh Maps
Two-, three- and four-variable maps, grouping rules, don’t-care conditions, and a look at the Quine-McCluskey method that tools use when maps get too big.
1.5 Combinational Building Blocks
Multiplexers, decoders, encoders, priority encoders and comparators, designed from scratch and then written in Verilog.
The first article asks the obvious question: why do computers use only two digits?