Home
13Digital Systems & Practice
13

Topic 13 of 13

Digital Systems & Practice

Put the blocks together: a small ALU, a traffic light, a digital lock, and design workflows.

← → move between slides · F full screen · M slide list

Before we start

Why this matters

You've now built gates, memory, counters and state machines one lonely piece at a time — so what happens when you finally let them all hang out in the same box?

A digital lock that never forgets its combination (unlike you, probably). A traffic light that will never show green in both directions and start a demolition derby. A tiny ALU that adds and compares like a miniature CPU running on too much coffee. This closing chapter is the reunion episode.

Concept 1 of 4

Building blocks and workflows

Gates›Combinational circuits›Sequential circuits›Registers and counters›Memory›Control logic

Combinational workflow: specification → truth table → Boolean expression → K-map → implementation → verification.

Sequential workflow: identify states → state diagram → state table → state assignment → choose flip-flops → equations → implement and verify.

Concept 2 of 4

Inside a CPU

A CPU has a datapath (registers, ALU, buses) and a control unit. The control unit is a finite state machine that decodes instructions and coordinates the datapath. The CPU talks to memory over an address bus, a data bus and a control bus. A 4-bit ALU combines an adder-subtractor and logic gates, with select lines that choose the result through multiplexers.

Concept 2 of 4

Inside a CPU (cont.)

A (4 bits)B (4 bits)Op code (3 bits)ALUResult (4 bits)
A 4-bit ALU block: the A and B operands and a 3-bit op code (matching the eight operations in the truth table on the next slide) select the operation, producing a 4-bit result.

Concept 3 of 4

Example systems

  • Traffic light: an FSM with states for each light combination and a counter that times each state.
  • Digital lock: an FSM that tracks a button sequence and unlocks when the correct one is detected.
  • Vending machine: states record accumulated credit, inputs are coins, outputs release product or change.
  • Digital clock: counters divide the clock frequency, registers hold digits, decoders drive displays.

Concept 4 of 4

Troubleshooting checklist

  1. Clock assumptions: edge, frequency, is it running?
  2. Input values and switch positions.
  3. Truth table or state table against the circuit.
  4. Gate connections and pin numbers.
  5. Reset and initial state.
  6. Timing: setup, hold, and every state transition.

Truth tables

Truth tables (1 of 2)

4-bit ALU functions

Op codeOperation
000A + B
001A − B
010A AND B
011A OR B
100A XOR B
101NOT A
110A + 1
111Pass B

Traffic light controller

State ABNorth–SouthEast–WestTicks
00GreenRed4
01YellowRed2
10RedGreen4
11RedYellow2

Truth tables

Truth tables (2 of 2)

Digital lock for code 1011

StateInput 0 → nextInput 1 → next
001
121
203
324
4 (unlocked)01

State k means the first k digits of the code have been matched.

Interactive

Demo: ALU, traffic light and lock

Worked example 1 of 2

Worked example 1

How many AND gates make the partial products of a 3×3 multiplier?
Show the solution
  1. Each of the 3 bits of B multiplies each of the 3 bits of A.
  2. 3 × 3 = 9 AND gates.
  3. Adders then sum the shifted rows into a 6-bit product.

Worked example 2 of 2

Worked example 2

How many flip-flops does the traffic light controller in the demo need?
Show the solution
  1. Four states (NS green, NS yellow, EW green, EW yellow).
  2. ⌈log₂4⌉ = 2 flip-flops, plus a counter for timing.

Practice

Practice (1 of 2)

Try each one on paper first, then check your answer.

1. Design a 3×3 multiplier.
Show the answer
Generate nine partial products with AND gates, then add the shifted rows with half and full adders. See the multiplier on the Projects page.
2. Design an FSM that detects 101.
Show the answer
Use the Chapter 8 simulator for the table and equations.
3. Design a MOD-6 counter.
Show the answer
3 flip-flops, states 000 to 101, reset on 110 or use next-state logic.

Practice

Practice (2 of 2)

Try each one on paper first, then check your answer.

4. List the blocks in a mini digital system.
Show the answer
Input switches, combinational logic, a register, a counter, display logic and a control FSM.
Practice in Gate Forge

Combine an adder, a multiplexer and flip-flops into a tiny ALU, and Save the parts as components.

Open Gate ForgeGate 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

  • Complex systems are built by combining simple blocks.
  • A CPU is a datapath plus a control unit connected to memory by buses.
  • FSMs make controllers such as traffic lights and locks.
  • Follow the workflow: specify, model, simplify, implement, verify.
  • Troubleshoot clock, inputs, connections, reset and timing.