Digital Logic Foundations
What Is a Digital Circuit?
Reference for combinational logic: how logic gates transform input bits to output bits, and why truth tables describe that behavior.
5 min read · Updated
A digital circuit transforms input bit patterns into output bit patterns using logic gates. Each gate maps its inputs to an output according to a fixed rule — and because the rule is fixed and finite, you can write it down completely as a truth table.
In a combinational circuit the output depends only on the current inputs, with no memory of what came before. That property is what makes a truth table a complete description: list every input combination once, and you have specified the circuit's entire behavior.
This is the foundation Module 1 builds on. Before you write any Verilog, being able to look at a gate and predict its output for a given input is the skill the early lessons rehearse.
Switches, and the 0/1 convention
The first three lessons reason about ordinary on/off switches before any gate symbol appears, because a switch makes the rule visible. Two conventions make that reasoning precise, and both are idealisations chosen to keep the arithmetic out of the way:
- A switch input
xis 0 when the switch is open and 1 when it is closed. - The light
Lis 0 when it is off and 1 when it is on. - The supply needs a complete conducting path: current leaves the supply, passes through whatever is connected, and returns to the supply through the ground connection. "Ground" is that return path, not a separate component that does something.
- An ideal closed switch is a plain piece of wire, and an ideal open switch is a gap. Real switches and real chips are more complicated; nothing in these lessons depends on the difference.
Writing L(x₁, x₂) means "the state of the light, as it depends on the two inputs x₁ and x₂". The subscripts are part of the names — they distinguish one switch from another. They are not powers, and they are not time steps.
Three switch arrangements
| Arrangement | Light is on when | Expression | Operation |
|---|---|---|---|
| Two switches in series with the light | both switches are closed | L = x₁ · x₂ |
AND |
| Two switches in parallel with each other | at least one switch is closed | L = x₁ + x₂ |
OR |
| One switch in parallel with the light | the switch is open | L = x̄ |
NOT |
Two things are easy to run together here, so they are worth separating. In the OR arrangement the two switches are parallel with each other, and both sit in line with the light. In the inverting arrangement a single switch is parallel with the light itself: closing it puts both ends of the light at nearly the same voltage, so almost no current flows through the light and it goes out. A resistor in series with the supply is what keeps that closed switch from short-circuiting the supply as well.
So "parallel" on its own does not mean OR. What the parallel connection is across decides which operation you get.
The · and + symbols are the AND and OR operators. The plus sign in particular is not addition: 1 + 1 is 1 here, because "at least one input is 1" is satisfied.
Complement notation, and how far it carries
The third operation goes by two names: the complement of a value, or NOT applied to it. Written with an overbar, x̄ is 1 when x is 0, and 0 when x is 1.
The overbar is the clearest form on paper and the most awkward to type, so several spellings exist for it. For one Boolean value that is either 0 or 1, these all describe the same result:
x̄ x′ ~x !x NOT x
That equivalence is scoped deliberately. Verilog has both spellings and they are different operators:
~is bitwise inversion. It flips every bit of its operand and returns a value of the same width, so~4'b0010is4'b1101.!is logical negation. It asks only whether the operand is zero and returns a single bit, so!4'b0010is1'b0.
On a single bit the two agree, which is why the list above is safe as far as it goes. On a multi-bit value they do not, and confusing them is a common early bug. This course uses ~ for inversion throughout. (Reference: AMD Vivado Synthesis logical operators.)
Reading a gate symbol
Engineers do not draw switches when they design. Each operation has a standard symbol, and a circuit diagram is drawn from those symbols. A few reading conventions make an unfamiliar diagram legible:
- Every line is a signal carrying one value, not a pipe carrying current you have to trace.
- Diagrams are normally read left to right: input lines enter from the left-hand side, and the output line leaves from the right-hand side.
- Power and ground connections are normally omitted. The symbol abstracts the switch circuit, and the supply is assumed.
- A small circle where a signal meets a symbol means inversion at that point. It is the part of the NOT symbol that does the complementing, and it reappears on other gates later.
For the three gates above, shape is enough to tell them apart: the AND symbol has a flat back and an output end rounded like a capital D; the OR symbol has a back that curves inward and an output end that comes to a point; the NOT symbol is a triangle with that small circle on its output. Among these three, the NOT symbol is also the only one with a single input — but that is a fact about these three pictured gates, not a general rule, because plenty of other gates take one input or many.