← ProblemsCircuits / Combinational Logic / Karnaugh Map to Circuit

K-map implemented with a multiplexer

15%kmapmux

A function of four variables a, b, c, d is given by the Karnaugh map below:

a'b'a'babab'
c'd'0001
c'd1000
cd1010
cd'1001

It is to be built from a single 4-to-1 multiplexer whose select input is {a, b} (so mux_in[0] is chosen when ab = 00, mux_in[1] when ab = 01, mux_in[2] when ab = 10, and mux_in[3] when ab = 11). The mux itself lives in the test harness — your top_module only computes the four data inputs mux_in[3:0] as functions of c and d.

Each column of the map fixes one data input completely: for a given (a, b), the function reduces to a function of just c and d — read it straight off that column.