Build a 4:1 multiplexer in one minute
Place a Multiplexer
Open the Plexers library and click the Multiplexer tool, then click the canvas.Check: A multiplexer with two data inputs is on the canvas.
Set Select Bits to 2
In the Properties panel, change Select Bits to 2. The inputs grow to four.Check: Four data inputs and one select port.
Connect data and select
Wire four 1-bit input pins to the data inputs. Wire a 2-bit input pin to the select port, which is one port and carries both select bits.Check: Four input pins on the data side and a 2-bit pin on the select port.
Test it
Poke the select pin: S = 0 chooses input 0, S = 3 chooses input 3.Check: Output follows the input the select names.
Describe this circuit
Components: Input pin D0; Input pin D1; Input pin D2; Input pin D3; Multiplexer 1; Output pin Y; Input pin S.
- Input pin D0 connects to Multiplexer 1 (net D0, d0).
- Input pin D1 connects to Multiplexer 1 (net D1, d1).
- Input pin D2 connects to Multiplexer 1 (net D2, d2).
- Input pin D3 connects to Multiplexer 1 (net D3, d3).
- Multiplexer 1 connects to Input pin S (net S, s), 2 bits wide.
- Multiplexer 1 connects to Output pin Y (net y, Y).
| # | D0 | D1 | D2 | D3 | S | Y |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 00 | 0 | |
| 0 | 0 | 0 | 0 | 01 | 0 | |
| 0 | 0 | 0 | 0 | 10 | 0 | |
| 0 | 0 | 0 | 0 | 11 | 0 | |
| 0 | 0 | 0 | 1 | 00 | 0 | |
| 0 | 0 | 0 | 1 | 01 | 0 | |
| 0 | 0 | 0 | 1 | 10 | 0 | |
| 0 | 0 | 0 | 1 | 11 | 1 | |
| 0 | 0 | 1 | 0 | 00 | 0 | |
| 0 | 0 | 1 | 0 | 01 | 0 | |
| 0 | 0 | 1 | 0 | 10 | 1 | |
| 0 | 0 | 1 | 0 | 11 | 0 | |
| 0 | 0 | 1 | 1 | 00 | 0 | |
| 0 | 0 | 1 | 1 | 01 | 0 | |
| 0 | 0 | 1 | 1 | 10 | 1 | |
| 0 | 0 | 1 | 1 | 11 | 1 | |
| 0 | 1 | 0 | 0 | 00 | 0 | |
| 0 | 1 | 0 | 0 | 01 | 1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 1 | |
| 1 | 1 | 1 | 0 | 00 | 1 | |
| 1 | 1 | 1 | 0 | 01 | 1 | |
| 1 | 1 | 1 | 0 | 10 | 1 | |
| 1 | 1 | 1 | 0 | 11 | 0 | |
| 1 | 1 | 1 | 1 | 00 | 1 | |
| 1 | 1 | 1 | 1 | 01 | 1 | |
| 1 | 1 | 1 | 1 | 10 | 1 | |
| 1 | 1 | 1 | 1 | 11 | 1 |
Download circ-mux-4-to-1.circ.
Selecting with single wires
The select port is one multi-bit port. Two separate 1-bit wires cannot both feed it: the wire turns orange and the output reads U (F09).
Describe this circuit
Components: Input pin D0; Input pin D1; Input pin D2; Input pin D3; Multiplexer 1; Output pin Y; Input pin S0; Input pin S1.
- Input pin D0 connects to Multiplexer 1 (net D0, d0).
- Input pin D1 connects to Multiplexer 1 (net D1, d1).
- Input pin D2 connects to Multiplexer 1 (net D2, d2).
- Input pin D3 connects to Multiplexer 1 (net D3, d3).
- Multiplexer 1 connects to Input pin S0, Input pin S1 (net S0, S1), 2 bits wide.
- Multiplexer 1 connects to Output pin Y (net y, Y).
Join the wires with a splitter set to Fan Out 2 and Bit Width In 2. End 0 carries bit 0, the least significant bit.
Describe this circuit
Components: Input pin D0; Input pin D1; Input pin D2; Input pin D3; Multiplexer 1; Output pin Y; Input pin S0; Input pin S1; Splitter 1.
- Input pin D0 connects to Multiplexer 1 (net D0, d0).
- Input pin D1 connects to Multiplexer 1 (net D1, d1).
- Input pin D2 connects to Multiplexer 1 (net D2, d2).
- Input pin D3 connects to Multiplexer 1 (net D3, d3).
- Multiplexer 1 connects to Splitter 1 (net sel), 2 bits wide.
- Multiplexer 1 connects to Output pin Y (net y, Y).
- Input pin S0 connects to Splitter 1 (net S0, s0).
- Input pin S1 connects to Splitter 1 (net S1, s1).
| # | S1 | S0 | Input chosen |
|---|---|---|---|
| 0 | 0 | D0 | |
| 0 | 1 | D1 | |
| 1 | 0 | D2 | |
| 1 | 1 | D3 |
See Splitter and wire colours.
Multiplexer attributes
| Attribute | What it does |
|---|---|
| Facing | Which way the multiplexer points. |
| Select Location | Which side the select port is on. |
| Select Bits | How many select bits. Inputs = 2 to the power of this. We placed 1, 2 and 3. |
| Data Bits | Width of every data input and the output. |
| Disabled Output | Floating or Zero: the output when the enable is off. |
| Include Enable? | Adds an enable input. |
| Gate Size | Narrow or Wide. |
| Three-state? | On the decoder: unselected outputs float. |
Names are those in the 5.0.0 string table (F73). The explanations are ours.
Enable and disabled output
| # | I0 | I1 | S | EN | O |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | |
| 0 | 0 | 0 | 1 | 0 | |
| 0 | 0 | 1 | 0 | 0 | |
| 0 | 0 | 1 | 1 | 0 | |
| 0 | 1 | 0 | 0 | 0 | |
| 0 | 1 | 0 | 1 | 0 | |
| 0 | 1 | 1 | 0 | 0 | |
| 0 | 1 | 1 | 1 | 1 | |
| 1 | 0 | 0 | 0 | 0 | |
| 1 | 0 | 0 | 1 | 1 | |
| 1 | 0 | 1 | 0 | 0 | |
| 1 | 0 | 1 | 1 | 0 | |
| 1 | 1 | 0 | 0 | 0 | |
| 1 | 1 | 0 | 1 | 1 | |
| 1 | 1 | 1 | 0 | 0 | |
| 1 | 1 | 1 | 1 | 1 |
The default 5.0.0 multiplexer has no enable input. In 2.7.1 the default instance has one more port (5 against 4, F23), which is why handouts show an extra pin.
Demultiplexer
The reverse of a multiplexer: the input goes to the output the select names.
| # | D | S | Y0 | Y1 | Y2 | Y3 |
|---|---|---|---|---|---|---|
| 0 | 00 | 0 | 0 | 0 | 0 | |
| 0 | 01 | 0 | 0 | 0 | 0 | |
| 0 | 10 | 0 | 0 | 0 | 0 | |
| 0 | 11 | 0 | 0 | 0 | 0 | |
| 1 | 00 | 1 | 0 | 0 | 0 | |
| 1 | 01 | 0 | 1 | 0 | 0 | |
| 1 | 10 | 0 | 0 | 1 | 0 | |
| 1 | 11 | 0 | 0 | 0 | 1 |
Describe this circuit
Components: Input pin D; Input pin S; Demultiplexer 1; Output pin Y0; Output pin Y1; Output pin Y2; Output pin Y3.
- Input pin D connects to Demultiplexer 1 (net D, d).
- Input pin S connects to Demultiplexer 1 (net S, s), 2 bits wide.
- Demultiplexer 1 connects to Output pin Y0 (net y0, Y0).
- Demultiplexer 1 connects to Output pin Y1 (net y1, Y1).
- Demultiplexer 1 connects to Output pin Y2 (net y2, Y2).
- Demultiplexer 1 connects to Output pin Y3 (net y3, Y3).
Decoder
A decoder sets the output the select names to 1 and the rest to 0.
| # | S | Y0 | Y1 | Y2 | Y3 |
|---|---|---|---|---|---|
| 00 | 1 | 0 | 0 | 0 | |
| 01 | 0 | 1 | 0 | 0 | |
| 10 | 0 | 0 | 1 | 0 | |
| 11 | 0 | 0 | 0 | 1 |
| # | S | Y0 | Y1 | Y2 | Y3 | Y4 | Y5 | Y6 | Y7 |
|---|---|---|---|---|---|---|---|---|---|
| 000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| 001 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | |
| 010 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | |
| 011 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | |
| 100 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | |
| 101 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | |
| 110 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | |
| 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| # | S | O0 | O1 | O2 | O3 |
|---|---|---|---|---|---|
| 00 | 1 | 0 | 0 | 0 | |
| 01 | 0 | 1 | 0 | 0 | |
| 10 | 0 | 0 | 1 | 0 | |
| 11 | 0 | 0 | 0 | 1 |
| # | S | EN | O0 | O1 | O2 | O3 |
|---|---|---|---|---|---|---|
| 00 | 0 | 0 | 0 | 0 | 0 | |
| 00 | 1 | 1 | U | U | U | |
| 01 | 0 | 0 | 0 | 0 | 0 | |
| 01 | 1 | U | 1 | U | U | |
| 10 | 0 | 0 | 0 | 0 | 0 | |
| 10 | 1 | U | U | 1 | U | |
| 11 | 0 | 0 | 0 | 0 | 0 | |
| 11 | 1 | U | U | U | 1 |
A decoder picks a register in a register file and drives the digit select of a 7-segment display.
Priority Encoder
The Priority Encoder reports the highest-numbered input that is 1. A plain encoder is the special case with one active input.
| # | I0 | I1 | I2 | I3 | EN | O | EN2 | GS |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 00 | 0 | 0 | |
| 0 | 0 | 0 | 0 | 1 | UU | 1 | 0 | |
| 0 | 0 | 0 | 1 | 0 | 00 | 0 | 0 | |
| 0 | 0 | 0 | 1 | 1 | 11 | 0 | 1 | |
| 0 | 0 | 1 | 0 | 0 | 00 | 0 | 0 | |
| 0 | 0 | 1 | 0 | 1 | 10 | 0 | 1 | |
| 0 | 0 | 1 | 1 | 0 | 00 | 0 | 0 | |
| 0 | 0 | 1 | 1 | 1 | 11 | 0 | 1 | |
| 0 | 1 | 0 | 0 | 0 | 00 | 0 | 0 | |
| 0 | 1 | 0 | 0 | 1 | 01 | 0 | 1 | |
| 0 | 1 | 0 | 1 | 0 | 00 | 0 | 0 | |
| 0 | 1 | 0 | 1 | 1 | 11 | 0 | 1 | |
| 0 | 1 | 1 | 0 | 0 | 00 | 0 | 0 | |
| 0 | 1 | 1 | 0 | 1 | 10 | 0 | 1 | |
| 0 | 1 | 1 | 1 | 0 | 00 | 0 | 0 | |
| 0 | 1 | 1 | 1 | 1 | 11 | 0 | 1 | |
| 1 | 0 | 0 | 0 | 0 | 00 | 0 | 0 | |
| 1 | 0 | 0 | 0 | 1 | 00 | 0 | 1 | |
| 1 | 0 | 0 | 1 | 0 | 00 | 0 | 0 | |
| 1 | 0 | 0 | 1 | 1 | 11 | 0 | 1 | |
| 1 | 0 | 1 | 0 | 0 | 00 | 0 | 0 | |
| 1 | 0 | 1 | 0 | 1 | 10 | 0 | 1 | |
| 1 | 0 | 1 | 1 | 0 | 00 | 0 | 0 | |
| 1 | 0 | 1 | 1 | 1 | 11 | 0 | 1 | |
| 1 | 1 | 0 | 0 | 0 | 00 | 0 | 0 | |
| 1 | 1 | 0 | 0 | 1 | 01 | 0 | 1 | |
| 1 | 1 | 0 | 1 | 0 | 00 | 0 | 0 | |
| 1 | 1 | 0 | 1 | 1 | 11 | 0 | 1 | |
| 1 | 1 | 1 | 0 | 0 | 00 | 0 | 0 | |
| 1 | 1 | 1 | 0 | 1 | 10 | 0 | 1 | |
| 1 | 1 | 1 | 1 | 0 | 00 | 0 | 0 | |
| 1 | 1 | 1 | 1 | 1 | 11 | 0 | 1 |
Bit Selector
The Bit Selector picks a group of bits from a wider value by an index. Output Bits sets the group size. Use it when the choice changes while the circuit runs; use a splitter when it is fixed.
| # | D | S | O |
|---|---|---|---|
| 0000 | 00 | 0 | |
| 0000 | 01 | 0 | |
| 0000 | 10 | 0 | |
| 0000 | 11 | 0 | |
| 0001 | 00 | 1 | |
| 0001 | 01 | 0 | |
| 0001 | 10 | 0 | |
| 0001 | 11 | 0 | |
| 0010 | 00 | 0 | |
| 0010 | 01 | 1 | |
| 0010 | 10 | 0 | |
| 0010 | 11 | 0 | |
| 0011 | 00 | 1 | |
| 0011 | 01 | 1 | |
| 0011 | 10 | 0 | |
| 0011 | 11 | 0 | |
| 0100 | 00 | 0 | |
| 0100 | 01 | 0 | |
| 0100 | 10 | 1 | |
| 0100 | 11 | 0 | |
| 0101 | 00 | 1 | |
| 0101 | 01 | 0 | |
| 0101 | 10 | 1 | |
| 0101 | 11 | 0 | |
| 0110 | 00 | 0 | |
| 0110 | 01 | 1 | |
| 0110 | 10 | 1 | |
| 0110 | 11 | 0 | |
| 0111 | 00 | 1 | |
| 0111 | 01 | 1 | |
| 0111 | 10 | 1 | |
| 0111 | 11 | 0 | |
| 1000 | 00 | 0 | |
| 1000 | 01 | 0 | |
| 1000 | 10 | 0 | |
| 1000 | 11 | 1 | |
| 1001 | 00 | 1 | |
| 1001 | 01 | 0 | |
| 1001 | 10 | 0 | |
| 1001 | 11 | 1 | |
| 1010 | 00 | 0 | |
| 1010 | 01 | 1 | |
| 1010 | 10 | 0 | |
| 1010 | 11 | 1 | |
| 1011 | 00 | 1 | |
| 1011 | 01 | 1 | |
| 1011 | 10 | 0 | |
| 1011 | 11 | 1 | |
| 1100 | 00 | 0 | |
| 1100 | 01 | 0 | |
| 1100 | 10 | 1 | |
| 1100 | 11 | 1 | |
| 1101 | 00 | 1 | |
| 1101 | 01 | 0 | |
| 1101 | 10 | 1 | |
| 1101 | 11 | 1 | |
| 1110 | 00 | 0 | |
| 1110 | 01 | 1 | |
| 1110 | 10 | 1 | |
| 1110 | 11 | 1 | |
| 1111 | 00 | 1 | |
| 1111 | 01 | 1 | |
| 1111 | 10 | 1 | |
| 1111 | 11 | 1 |
Building them from gates
For labs that forbid built-in parts. A 2:1 mux from a NOT, two ANDs and an OR, and a 2-to-4 decoder from two NOTs and four ANDs. Both matched the built-in tables in 5.0.0.
Describe this circuit
Components: Input pin D0; Input pin D1; Input pin S; NOT Gate 1; AND Gate 1; AND Gate 2; OR Gate 1; Output pin Y.
- Input pin D0 connects to AND Gate 1 (net D0, d0).
- Input pin D1 connects to AND Gate 2 (net D1, d1).
- Input pin S connects to NOT Gate 1, AND Gate 2 (net S, s).
- NOT Gate 1 connects to AND Gate 1 (net ns).
- AND Gate 1 connects to OR Gate 1 (net p0).
- AND Gate 2 connects to OR Gate 1 (net p1).
- OR Gate 1 connects to Output pin Y (net y, Y).
Describe this circuit
Components: Input pin S0; Input pin S1; NOT Gate 1; NOT Gate 2; AND Gate 1; Output pin Y0; AND Gate 2; Output pin Y1; AND Gate 3; Output pin Y2; AND Gate 4; Output pin Y3.
- Input pin S0 connects to NOT Gate 1, AND Gate 2, AND Gate 4 (net S0, s0).
- Input pin S1 connects to NOT Gate 2, AND Gate 3, AND Gate 4 (net S1, s1).
- NOT Gate 1 connects to AND Gate 1, AND Gate 3 (net ns0).
- NOT Gate 2 connects to AND Gate 1, AND Gate 2 (net ns1).
- AND Gate 1 connects to Output pin Y0 (net y0, Y0).
- AND Gate 2 connects to Output pin Y1 (net y1, Y1).
- AND Gate 3 connects to Output pin Y2 (net y2, Y2).
- AND Gate 4 connects to Output pin Y3 (net y3, Y3).
Download mux from gates and decoder from gates. To turn a truth table into gates, see Combinational Analysis.
Common mistakes
- Two 1-bit wires on a 2-bit select: orange wire, U output.
- Select bits in the wrong order: S0 is the least significant bit.
- Data inputs counted from the wrong end: input 0 is the top input with the default facing.
- Trusting a priority encoder’s address when Group Select is 0.
- Driving a bus from a multiplexer without tri-state: use a decoder and controlled buffers.
Version differences
| Feature | 2.7.1 | 5.0.0 |
|---|---|---|
| Default multiplexer ports | 2.7.1: yes5 ports (one more) | 5.0.0: yes4 ports (F23) |
| Select bits range | 2.7.1: untested | 5.0.0: partial1 to 3 tested |
| Include Enable? attribute | 2.7.1: untested | 5.0.0: yestested (F41) |
Cells say untested where we did not run 2.7.1. See also all components.