Electrical – How to make an XOR gate with basic components

digital-logicintegrated-circuitlogic-gatesnot-gatetransistors

I am a very beginner in logic gates and electronic etc. I am trying to make an XOR gate only with the help of some basic components like transistors in the NI Multisim simulator. I have use AND and NOT gate circuits that I made and that were working alone but when I combine them all to make an XOR gate with those gate then it is not working at all. (My design is given below that I made in the simulator.)

Please help me fix this and increase my basic understanding of all these topics.

enter image description here

Best Answer

I can see at least four issues with your design.

Firstly because you are using bipolar transistors your "and gate" doesn't actually implement an "AND" function, because the base-emitter junction of a bipolar transistor forms a diode. So if current flows in to the base of the lower transistor it will flow out of the emitter, no matter what the upper transistor is doing. You could fix that by using mosfets instead of bipolars but that would make other problems worse.

Secondly the "and gate" is not regenerative, the output voltage will always be lower than the input voltage and your LEDs drop more voltage. In some cases you can get away with non-regenerative gate designs, but it's easy for the volt drops to add up on you. A bipolar base-emitter junction drops about 0.7V, a LED somewere around 2V, mosfets are highly variable but nearly always more than a bipolar. It's not too hard to end up eating up all your voltage and ending up with none left.

Thirdly some of the paths through your circuit have NO current limiting. This is likely what is causing your simulation errors and if you tried to build the circuit for real may well result in fried components.

Fourthly many of your lines have nothing to pull them back down to ground when they are in the "off" state. Again you can sometimes get away with this but other times small leakage currents can cause big problems.


Start out by designing yourself NAND and NOR gates. Once you have NAND and NOR gates that behave sensibly (i.e. near full voltage on output for high, clean zero volts for low, output current capability much higher than input current requirements) you can then work out how to combine them into an XOR gate.