Building Logic Gates with Transistors

Earlier you read about logic gates and their functions. Then you read about how to code logic gates in Verilog, VHDL, and C. Now its time to learn about creating logic gates with transistors. After reading all of these posts you will have learned about logic gate theory, coding logic gates in both hardware and software, and the physical hardware design of logic gates.

 

The first thing to know before we get into the structure of logic gates is the two types of transistors that will be used. There are NFETs (n-type or n-channel mosfet) and PFETs (p-type or p-channel mosfet.)

NFETs pass a signal when given a 1, and PFETs pass a signal when given a 0.
NFETs pass a signal when given a 1, and PFETs pass a signal when given a 0.

 

PFETs are like switches that are closed when the gate is given a 0 and are open when the gate is given a 1. In other words, a PFET will pass a value through it when it receives a 0.

 

NFETs are like switches that are closed when the gate is given a 1 and are open when the gate is given a 0. In other words, a NFET will pass a value through it when it receives a 1.

 

To make our logic gates we can use a combination of NFETs and PFETs.

 

A NOT gate made out of transistors.
A NOT gate made out of transistors.

The NOT gate only uses two transistors. If A is 1, then the PFET is off and the NFET is on, so GND or 0 gets passed. If A is 0 the PFET is on and the NFET in off so VDD or 1 gets passed.

 

An AND gate made out of transistors.
An AND gate made out of transistors.

The AND gate is slightly more complicated and requires six transistors. You can still go through the same process as before to see how it works. Give A and B values and see which transistors are on, and what values get passed.

 

A NAND gate made out of transistors.
A NAND gate made out of transistors.

The NAND gate is very closely related to the AND gate. Notice that the NAND gate is an AND gate without the NOT gate at the end.

 

An OR gate made out of transistors.
An OR gate made out of transistors.

The OR gate is very similar to the AND gate, except that the NFETs are in parallel rather than the PFETs being in parallel.

 

A NOR gate made out of transistors.
A NOR gate made out of transistors.

The NOR gate has the same relationship with the OR gate that the NAND gate has with the AND gate.

 

An XOR gate showing how it is built out of other gates. This is the way it was coded in the previous post.
An XOR gate showing how it is built out of other gates. This is the way it was coded in the previous post.

The XOR is quite a bit more complicated. It can be made up of five of the gates that we already described. You can see the block diagram describing how these gates are combined. In the transistor image I enclosed each gate in red dots.

 

An XOR gate made up of two NOT gates, two AND gates, and an OR gate.
An XOR gate made up of two NOT gates, two AND gates, and an OR gate.

The XNOR gate has the same relationship with the XOR gate that NAND has with AND and that NOR has with OR. Notice that in the XNOR gate the last NOT gate and the NOT gate in the OR gate can be cancelled out. Two negatives, in this case, do make a positive. So instead of the OR and NOT you could just use a NOR gate.

 

An XNOR gate. Note that the last NOT gate and the NOT gate in the OR gate can cancel to be simplified.
An XNOR gate. Note that the last NOT gate and the NOT gate in the OR gate can cancel to be simplified.

 

Now that you have an understanding of the basic logic gates used in digital design, check out the FPGA modules on Digilent’s Learn site!

Be the 1st to vote.

Leave a Reply

Your email address will not be published. Required fields are marked *