In one of my previous questions, I wanted to know what integrated circuit I could use to replace my logic gates in the circuit below: circuit with logic gates

The accepted answer helps me to redesign my circuit and replace the gates by an integrated circuit.

However, a second answer tickled my curiosity. It is said:

You can wire up a multiplexer to act as any of the standard gate types (AND, OR, NOT, etc.) It's pretty easy to find a quad 2:1 multiplexer chip, and that one chip should be enough to implement all the logic you've shown.

I tried to redesign my circuit using 2:1 multiplexers:

circuit with multiplexers

The issue here is I'm using 2 different 2:1 multiplexers and I can't convert them into a 2 x 2:1 multiplexer. Indeed, the selector input is different for the two multiplexers and I'm not able to find a configuration with the same selector.

How can I redesign my circuit to use only one chip? Is there a method to convert logic gates to multiplexers?

  • 1
    \$\begingroup\$ You can find at least 3 of those muxes in a chip, so what's the problem? \$\endgroup\$
    – user16324
    Commented Nov 1, 2020 at 13:44
  • \$\begingroup\$ @BrianDrummond The problem is I didn't know that. :) But I'm also curious to know how it is possible to build a circuit using a quad 2:1 multiplex chip. \$\endgroup\$
    – Pierre
    Commented Nov 1, 2020 at 14:08
  • 4
    \$\begingroup\$ Instead of torturing your brain about it, simply make a truth table for a multiplexer. Then compare that to the truth table of an inverter, AND gate or OR gate. Note that if you connect one of the mux's inputs to zero or one you can get a behavior identical to a certain gate. \$\endgroup\$ Commented Nov 1, 2020 at 14:25
  • 1
    \$\begingroup\$ @Andyaka a quad MUX with independent Select inputs would need at least 18 pins : the classic 74xx157 has a common Select input which won't implement this answer. I was thinking about the 74HC4053; can you think of a suitable quad mux? \$\endgroup\$
    – user16324
    Commented Nov 1, 2020 at 14:29
  • 1
    \$\begingroup\$ ADG1634. \$\endgroup\$
    – Andy aka
    Commented Nov 1, 2020 at 15:24

2 Answers 2


74xx1G97 chips implement a single multiplexer. Their datasheets (e.g., SN74LVC1G97) show how to wire it to implement your logic "NAND with one inverted input" with a single MUX:

Figure 3. 2-to-1 Data Selector

Figure 5. 2-Input NAND Gate With One Inverted Input

(There are five similar chips that allow different logic gates to be implemented: SN74LVC1G57, SN74LVC1G58, SN74LVC1G97, SN74LVC1G98, SN74LVC1G99.)


So think of the truth table of a logic circuit, to know the output of the circuit you look up the value in the table corresponding to the input. The bits of the inputs gives you a number and you select from the table using that number as an index. This idea is called a look up table and is very common electronics hardware. And it physically is a multiplexer with its inputs wired up to all constants 1s and 0s. I have a part on my desk, xc7z010clg400, that has 17600 LUTs. They are 5 inputs, so each one is a multiplexer with 5 addr inputs, one output, and 32 programmable constant bits at the inputs to the multiplexer. They are used to acheive the same thing you are asking about, you're right to want to be able to use one general approach rather than need to pick between what kind of gate every time.

Now if you only have 2x1 multiplexers, you are going to need to start by building a bigger multiplexer then you can apply the LUT theory with that. Just always start off with 2^n-1 multiplexers for n inputs, connect them up in a binary tree, and then connect all the inputs to the values from the truth table.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.