HDLbits
Start Practicing

Circuits/Combinational Logic

4-to-1 Multiplexer

easy
muxcombinationalcase

Build a 4-to-1 multiplexer that chooses between four single-bit data inputs based on a 2-bit select signal.

Interface

Signal Direction Width Description
a input 1 Data input, selected when sel = 0
b input 1 Data input, selected when sel = 1
c input 1 Data input, selected when sel = 2
d input 1 Data input, selected when sel = 3
sel input 2 Select line
out output 1 Selected output

Truth table

sel out
00 a
01 b
10 c
11 d

Use a case statement inside a combinational always block to implement the selection.