← ProblemsCircuits / Combinational Logic / Karnaugh Map to Circuit
K-map implemented with a multiplexer
15%kmapmuxA function of four variables a, b, c, d is given by the Karnaugh map below:
| a'b' | a'b | ab | ab' | |
|---|---|---|---|---|
| c'd' | 0 | 0 | 0 | 1 |
| c'd | 1 | 0 | 0 | 0 |
| cd | 1 | 0 | 1 | 0 |
| cd' | 1 | 0 | 0 | 1 |
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.