Altifigence Academy

15 / 63 · Concept

From a truth table to a MUX and Shannon expansion

Derive selection logic algebraically and decompose arbitrary logic functions using multiplexers.

Derive the selection rule

To output a when sel is 0 and b when sel is 1, multiply each input by its selection condition, then OR the terms:

y=s‾a+sby=\overline s a+s b

Substituting s=0s=0 leaves only a; substituting s=1s=1 leaves only b. If a and b are equal, changing sel does not change the output. Tests that expose selection errors must therefore include unequal data inputs.

The blue path marks the selected input. Make a and b different, then change sel. With equal data values, even an incorrectly wired selector is difficult to distinguish from the output alone.

The data path changed by the select signal

y = sel ? b : a

A MUX provides a general decomposition of logic functions

For any Boolean function F, call the cofactors obtained by fixing s to 0 and 1 F0F_0 and F1F_1:

F=s‾F0+sF1F=\overline s F_0+sF_1

This is Shannon expansion. s ? F1 : F0 splits any function into two parts. For F=a⊕bF=a\oplus b with a as the selector, F0=bF_0=b and F1=b‾F_1=\overline b, so a MUXMultiplexer A combinational circuit that connects one of several inputs to the output according to a select signal. Specify how select bits map to input numbers. and inversionInversion The NOT operation, which changes 0 to 1 and 1 to 0. A bar over an expression applies NOT to the entire expression beneath it. Learn more implement XOR.

Four-to-one selection and priority

Selecting one of four inputs with two select bits can use two levels of 2-to-1 MUXes. In contrast, if (req0) ... else if (req1) ... prioritizes the earlier request when multiple requests are 1. Address selection and priority selection are distinct problems.

SystemVerilog
assign y = sel[1] ? (sel[0] ? d3 : d2)
                 : (sel[0] ? d1 : d0);

In an ideal balanced tree, 2m2^m inputs yield m selection stages. Physical delay depends on input arrival times, load and wiring as well as stage count. Function decomposition creates implementation candidates; it does not prove optimal delay.

Try it yourself

Express F=ab+a‾cF=a b+\overline a c as a MUX with a as the select signal. What are its two data inputs?

Read the explanation

For a=0a=0, F0=cF_0=c; for a=1a=1, F1=bF_1=b. Thus assign f = a ? b : c;. Compute the cofactors first to avoid swapping the inputs selected by 0 and 1.

Your choice applies to this browser. Change it any time using the footer.