# Exceedingly Simple XOR Gate

#### IsquaredC

Joined Nov 28, 2011
3
I've always been facinated with the concept of minimization in electronics, whether it's simplifying things like Boolean expressions or finding new ways to reduce component #'s in integrated circuit designs. I tried to apply these minimization techniques on a relatively component-heavy logic gate (XOR gate) and this is what I came up with (Thumbnail below). All-in-all, it uses four diodes, two resistors, and one PNP transistor. (Which I assume makes this a DTL circuit). This circuit uses a rectifier to separate the A and B inputs when one is zero and the other is one to allow current to pass through the base of the transistor, changing Q to 1. Are there even simpler XOR gate designs out there? And also, are rectifiers typically used in digital logic circuits or are they more exclusively used for rectifiying AC in things like power supplies?

#### Attachments

• 289.5 KB Views: 219

#### Ron H

Joined Apr 14, 2005
7,014
Here is a 3 transistor XOR. It is probably best implemented inside an IC.

#### hobbyist

Joined Aug 10, 2008
887
Your circuit looks good, and will work properly.

However one note about it, the strength of the output current is the direct result of the input current through the diode and PNP transistor.

This could cause eratic behavior, it is best to keep the outputs and inputs currents seperate from eachother.
So the output is consistent in current flow regardless how big or small the input signal strength is.

Here is one solution, to that kind of dilemna.
Better solutions would involve more components for even better stability.

In actuality the 2 inputs should have pull down resistors to ground as also.

Yes diodes are used in digital circuitry as well as rectifiers in analog circuits.

Digital circuits they are refered as steering diodes.

Last edited:

#### blondiepassesby

Joined Mar 23, 2014
2

#### blondiepassesby

Joined Mar 23, 2014
2
Here's an LTSpice sim with a 2N3906 that highlights the problem at ~20kHz.
At 100kHz, the trough disappear completely.

#### crutschow

Joined Mar 14, 2008
24,093
Here is a 3 transistor XOR. It is probably best implemented inside an IC.
Ron, that link doesn't work for me.
Edit: Never mind, I found the circuit shown below.

Last edited:

#### DickCappels

Joined Aug 21, 2008
6,091
I've always been fascinated with the concept of minimization in electronics... (some text removed for brevity)
You deserve a prize for originality.

#### Robin Mitchell

Joined Oct 25, 2009
819
@crutschow If A is 1 and B is 0 wont the output sink to ground? M1 would be on as VG > VS and M1 is connected to M3 which is also on.

#### crutschow

Joined Mar 14, 2008
24,093
If A is 1 and B is 0 wont the output sink to ground?
True. I didn't look at its operation closely when I posted.
The circuit is proposed here, but off-hand I don't see how it can work.

#### Jony130

Joined Feb 17, 2009
5,127
Here you can read how this circuit work

A second problem of current feedback through transistor M1 also occurs when A=1 and B=0. The output of the pass transistor is fed back through transistor M1 which is operating in the active region since its gate has a logic high input. This difficulty can be overcome by decreasing the W/L ratio of transistor M1. With W=L, the channel resistance of transistor M1 amounts to 2.34MΩ in 0.15μm technology and 1.82 MΩ in 0.35 μm technology. With A=1 and B=0, the drain current through transistor M1 is 0.314μA in 0.15 μm technology and 1.51μA and this greatly limits the currents through it thereby minimizing the steady state power dissipation. The resistance can be further increased and the current can be further decreased by further minimizing W/L ratio. For example with W/L=0.5, the drain current through transistor M1 is 0.157μA in 0.15 μm technology and 0.755μA in 0.35 μm technology.

#### Jony130

Joined Feb 17, 2009
5,127

#### crutschow

Joined Mar 14, 2008
24,093
No it isn't.
My apologies.
It looked the same at first glance due to the similar titles.

So apparently it works because of some particular adjustment of the threshold voltages and W/L ratios on the IC.
It won't work with discrete transistors.

#### WBahn

Joined Mar 31, 2012
25,090
Ron, that link doesn't work for me.
Edit: Never mind, I found the circuit shown below.
That circuit has a few problems.

If A is HI and B is LO, then output should be HI. But even with B LO, the inverter is pulling the output hard to ground via M1. So at the very least you have contention at Y between M1 and M3, which is presumably why M3 is 5x as wide as M1.

If both A and B are LO, then the output should be LO, but there isn't anything that is strongly doing this. You are trying to pull Y down using a PFET and so you will have a hard time pulling Y down much below the threshold voltage.

This design also couples the output back to the input, which is asking for trouble.

We used a version of an XOR gate that used transmission gates, but found that the resulting coupling between input and output was a disaster in the making and so changed to a fully CMOS implementation (and by CMOS I mean a complementary design in which the pull-up logic was the complement of the pull-down logic) with the resulting design containing 12 transistors. We never had reason to regret, though on some designs we moved the input signal inverters out of the XOR gate and shared them amongst many blocks that needed complementary input signals.

#### nornandxor

Joined Dec 11, 2017
148
I've always been facinated with the concept of minimization in electronics, whether it's simplifying things like Boolean expressions or finding new ways to reduce component #'s in integrated circuit designs. I tried to apply these minimization techniques on a relatively component-heavy logic gate (XOR gate) and this is what I came up with (Thumbnail below). All-in-all, it uses four diodes, two resistors, and one PNP transistor. (Which I assume makes this a DTL circuit). This circuit uses a rectifier to separate the A and B inputs when one is zero and the other is one to allow current to pass through the base of the transistor, changing Q to 1. Are there even simpler XOR gate designs out there? And also, are rectifiers typically used in digital logic circuits or are they more exclusively used for rectifiying AC in things like power supplies?
Hi,

I just built your circuit and the output has exactly the same as an OR gate behavior!!!!

#### crutschow

Joined Mar 14, 2008
24,093
I just built your circuit and the output has exactly the same as an OR gate behavior!!!!
Then you likely built it wrong.
Here's an LTspice simulation of the circuit, which clearly shows the XOR function (not OR).

#### ElectricSpidey

Joined Dec 2, 2017
799
XOR is exclusive OR

Not OR is NOR

#### crutschow

Joined Mar 14, 2008
24,093
XOR is exclusive OR

Not OR is NOR
I'm aware of that.
I see my statement was not clear.
By "(not OR)" I meant the simulated circuit was exhibiting the XOR function, not the OR gate behavior that ahmedkhalaf1 stated the circuit he build, exhibited.

#### Bordodynov

Joined May 20, 2015
2,469
See