Master the fundamental concepts of digital logic & boolean algebra through this focused micro-challenge.
A 1-bit multiplexer (MUX) routes one of two data inputs to a single output, controlled by a select line S. When S=0, output follows I0; when S=1, output follows I1.
cLoading…
MUX blocks appear everywhere: ALU operation select, register-file read ports, and memory bank switching in embedded SoCs.
A demultiplexer (DEMUX) is the inverse: one data input fans to one of two outputs based on S. For example, with D=1 and S=0, only O0 goes high while O1 stays 0.
For this exercise, you will build both circuits from AND, OR, and NOT gates. You will use the MUX in the 4-bit ALU task to choose between ADD and SUB results on the same datapath, which is exactly how real ALUs share hardware across operations.
Keep the relevant datasheet, ISA manual, or architecture textbook chapter open while you implement. When your output disagrees with the reference trace on the same program, the bug is usually a mis-decoded opcode, a stale register read, or a flag bit left unchanged after arithmetic.
For this exercise, you will use those habits while implementing the requirement in the starter code. Microarchitectural product names change across CPU generations, but the control ideas (fetch, bypass, cache lines, vector lanes) stay stable enough to debug from first principles.
Implement multiplexer and demultiplexer using logic gates.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github