Level 13: Operation Selection
Open the level →Where it fits in the machine →
Task
Goal: build an operation selector: a BusMUX picks the result — ADD, AND, or OR — based on OpSelect.
Build a selector that picks one of three arithmetic operations.
The main idea: a processor runs many operations over the same wires, and it is the multiplexer that sorts the results: the OpSelect code picks whose result reaches the output. One destination, many sources.
Path to this level
The competencies this level develops and their formation levels.
Related Materials
- ALU: Heart of Math
- ALU8 — arithmetic logic unit
- BusMUX — bus multiplexer
Solution for self-check
Try building the circuit yourself first. The solution below is a way to check yourself if you're stuck or have already solved it.
What you should get: OpSelect=0 outputs the sum A+B, OpSelect=1 — bitwise AND, OpSelect=2 — bitwise OR.
Three compute units are already on the canvas, connected to inputs A and B: ADDER8 (addition), BusAND (bitwise AND), BusOR (bitwise OR). Each operation runs in parallel — what is left is to pick the correct result with a multiplexer cascade.
- Split OpSelect via Splitter into bits: bit 0 will select between ADD and AND, bit 1 will add OR to the chain.
- Place the first BusMUX: input A — ADDER8 output, input B — BusAND output, selector — Splitter.Bit0. With OpSelect=0 the ADDER8 passes, with OpSelect=1 — BusAND.
- Place the second BusMUX: input A — first BusMUX output, input B — BusOR output, selector — Splitter.Bit1. With OpSelect=2 the BusOR passes.
- The second BusMUX output is Result.
The multiplexer is a data router: one destination, many sources — and the OpSelect code decides whose result reaches the output.
Check yourself
How does OpSelect=2 (bits 10) pass through the cascade?
Bit 1 is 1, so the second MUX switches to the BusOR bus; bit 0 no longer participates on that tier — the first MUX picked between ADD and AND.