Topic 1 of 13
Introduction to Digital Logic
What a digital system is, why it uses only 0 and 1, and how simple gates grow into a computer.
← → move between slides · F full screen · M slide list
Before we start
Why this matters
What do a light switch, a calculator, and the robot vacuum currently stuck under your sofa have in common?
All three are having exactly one conversation, forever: yes or no. No maybes, no “let me think about it”, no vibes. Over the next 13 chapters you'll watch that painfully simple conversation, repeated a few billion times, somehow add up to a phone that can beat you at chess and still not know where your keys are.
Outline
Topics in this chapter
Select a topic to jump to the slide that explains it.
Concept 1 of 5
What digital logic design is
Digital logic design is the craft of building systems that represent information with a small set of discrete values, almost always 0 and 1, and then process, store and move that information. A phone, a calculator and a CPU are built from the same ingredients: logic gates, storage elements and a clock.
This course climbs a ladder. You start with single gates, add arithmetic circuits and data selectors, then memory, counters and finite state machines, and finish with the datapath of a small computer.
Concept 2 of 5
Analog and digital signals
An analog signal changes continuously and can take any value in a range. Noise shifts the value and nothing in the signal tells you it happened. A digital signal uses ranges: any voltage below a low threshold reads as logic 0 (LOW), and any voltage above a high threshold reads as logic 1 (HIGH). Small noise leaves the decoded bit unchanged.
- Reliability and noise tolerance
- Easy storage and copying
- Easy processing and programmability
- Repeatability: the same input always gives the same output
Concept 3 of 5
Bits, bytes and truth tables
One binary digit is a bit. Eight bits make a byte. n bits give 2n different patterns, and those patterns can stand for numbers, characters, instructions or control signals.
The basic operations are AND, OR and NOT. A truth table lists every input combination and the output for each. A function of n inputs has 2n rows.
Concept 4 of 5
Kilobytes, megabytes and gigabytes
A byte is 8 bits, and computers count naturally in powers of two — so storage sizes are rounded to the nearest convenient power of two instead of an exact power of ten. Each step up multiplies by 210 = 1024, not by 1000.
| Prefix | Power of 2 | Bytes |
|---|---|---|
| Kilobyte (KB) | 2¹⁰ | 1,024 |
| Megabyte (MB) | 2²⁰ = 1024 KB | 1,048,576 |
| Gigabyte (GB) | 2³⁰ = 1024 MB | 1,073,741,824 |
| Terabyte (TB) | 2⁴⁰ = 1024 GB | 1,099,511,627,776 |
| Petabyte (PB) | 2⁵⁰ = 1024 TB | 1,125,899,906,842,624 |
| Exabyte (EB) | 2⁶⁰ = 1024 PB | 1,152,921,504,606,846,976 |
Concept 4 of 5
Kilobytes, megabytes and gigabytes (cont.)
Each step is still just 1024 times the last one — a typical laptop drive is measured in GB or TB today, while PB and EB are the scale data centres and cloud-storage providers deal in (Google and Facebook each store several EB of data). That's also why a drive advertised as “500 GB” shows up as less in your file explorer: storage manufacturers use the decimal definition (1 KB = 1000 bytes exactly, the SI prefix), while operating systems usually report the binary value above. The unambiguous binary names are KiB, MiB, GiB, TiB, PiB and EiB (kibi-, mebi-, gibi-, tebi-, pebi-, exbi-byte) — but “KB/MB/GB/TB” gets used loosely for both in everyday speech, which is exactly where the confusion comes from.
Concept 5 of 5
From transistors to computers
A combinational circuit produces outputs that depend only on its present inputs. A sequential circuit also depends on stored state, so it needs memory elements and usually a clock.
Inside the Computer is an interactive diagram of a desktop PC — click the case, the CPU, RAM and more to see how each level of this chain sits physically inside the box.
Inside the ComputerAn interactive diagram of a desktop PC — click any part, from the case down to the CPU and RAM, to see what it does.Truth tables
Truth tables
AND
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
Rows in a truth table
| Inputs n | Rows 2ⁿ |
|---|---|
| 1 | 2 |
| 2 | 4 |
| 3 | 8 |
| 4 | 16 |
| 5 | 32 |
| 6 | 64 |
Each input combination has its own row.
Interactive
Demo: noise on analog and digital signals
Interactive
Demo: bits and bytes
Worked example 1 of 2
Worked example 1
Show the solution
- Each input doubles the number of combinations.
- Rows = 25 = 32.
Worked example 2 of 2
Worked example 2
Show the solution
- 8 bits give 28 = 256 patterns.
- Counting from 0, the largest is 256 − 1 = 255.
Practice
Practice (1 of 2)
Try each one on paper first, then check your answer.
Show the answer
Show the answer
Show the answer
Practice
Practice (2 of 2)
Try each one on paper first, then check your answer.
Show the answer
Place switches, gates and LEDs, then use the Truth table tester to see every input combination.
Gate ForgeA free circuit simulator — place and wire gates, generate truth tables and timing diagrams, and work through 90+ guided problems.Check yourself
Quiz
Summary
Summary
- Digital systems process discrete values, usually 0 and 1.
- A bit is one binary digit and a byte is 8 bits. n bits give 2n patterns.
- AND, OR and NOT are the basic operations. A truth table lists all 2n input combinations.
- Combinational output depends on present inputs only. Sequential output also depends on stored state.
- Gates build circuits, circuits build modules, modules build CPUs.