# How to make XOR gate using 2x1 multiplexer?

Status
Not open for further replies.

#### carrot

##### Full Member level 3
Hi

Is it possible to make XOR gate using 2x1 multiplexer?
if yes how? if no why?

#### checkmate

2x1 mux using nand gates

Let me take a shot.
Below is the truth table of a 2x1 multiplexer.

A B S | O
======
0 0 0 | 0
0 0 1 | 0
0 1 0 | 0
0 1 1 | 1
1 0 0 | 1
1 0 1 | 0
1 1 0 | 1
1 1 1 | 1

I can't seem to find any combination of 2-inputs and one fixed-input giving an XOR gate.

#### aryajur

realize nand gate as xor gate

Well if you have more than 1 2x1 Multiplexer it can be done. If you have 2 2x1 Multiplexers you can make a NAND gate. And then by 4 Nand Gates you can make a XOR Gate.

2x1 to AND:
Tie A to 0, then the Mux is a AND Gate with Inputs B and S. Make an Inverter of the 2nd Mux by tying A, B to say 1, 0. And cascade the 2, you have a NAND. Use 4 such NANDs to get a XOR. Thus to make a XOR by this way u need 8 2x1 MUX !

Hope this helped !!

#### Ace-X

using mux to make xor gate

aryajur said:
Thus to make a XOR by this way u need 8 2x1 MUX !

3 2x1 MUXes should be enough to build ANY 2-inputs gate.

First of all, you can build 4x1 MUX from those 3 2x1 MUXes. And then use the same approach as LUT in FPGA, by providing constant 1s and 0s on MUX inputs, that correspond to output column of truth table for desired gate.

#### Fom

xor gate from 2 to 1 mux truth table

You can build any logic using 2x1 MUX. The only reason why we don't use that it will be not optimal design.

#### nand_gates

build a +nand gate using a +multiplexer

Here it goes...

Code:
         +-----+
b ---|0    |
|     |---> Y = a xor b
b_bar ---|1 S  |
+--+--+
|
a------+

Here you need an inverter which can be build using another 2:1 mux!

#### checkmate

how to make an xor gate with 2 muxes

Fom said:
You can build any logic using 2x1 MUX. The only reason why we don't use that it will be not optimal design.
This is generally true because you can build an entire look-up table using them. But why the enthusiasm on multiplexers?

#### maharshi_qis

##### Full Member level 5
xor by nand gate

With single 2*1 mux u may not get X-0r gate..........but by using more than 1 mux and by using additional gates u can realize x-or gate ..

#### mohammed.peer

##### Junior Member level 3
xor gate with two mux

Hi..
Yes It is Possible to make Xor gate using single 2:1 Mux.
Here is the way

Lets say inputs of xor gate are A and B and output=y

connect select line to A
Connect 0 -> B
and 1 -> B_bar

#### sivakumar_tumma

##### Full Member level 4
xor by only nand gate

checkmate said:
Fom said:
You can build any logic using 2x1 MUX. The only reason why we don't use that it will be not optimal design.
This is generally true because you can build an entire look-up table using them. But why the enthusiasm on multiplexers?

I think in FPGAs there will be muxes ,and we have to route properly so that we can get the logic what we want. so there is lot of enthusiasm in muxes.

#### dbshailesh

##### Junior Member level 1
xor gate from two mux

Hi,
You can design any logic using mux in two ways,using Levevls and/or using interconnection between differernt nodes.

For XOR implementation..interconnection without using Levels

(A)i0------!\
! !__Y
i1 !---! !
! !/
!__ !
!
!
(B)Sel

Refer www.asic-world.com for many VLSI stuff, it is a nice website by Deepak Kumar Tala ..Thanks Deepak

#### tronix

ways to build an xor gate out of nand gates

nand_gates said:
Here it goes...

Code:
         +-----+
b ---|0    |
|     |---> Y = a xor b
b_bar ---|1 S  |
+--+--+
|
a------+

Here you need an inverter which can be build using another 2:1 mux!

I think perfectly okay a solution

mohammed.peer said:
Hi..
Yes It is Possible to make Xor gate using single 2:1 Mux.
Here is the way

Lets say inputs of xor gate are A and B and output=y

connect select line to A
Connect 0 -> B
and 1 -> B_bar

similar to what nand_gates wrote and perfectly okay

Status
Not open for further replies.