Table of contents
Logic Gates
Parent: Digital Circuits
Subject: Computer Science
Type: Semester
SL#: 2402260825
Status: Current

Following are the interactive versions of the circuits used in the document:


Logic gates are used in a digital circuit to perform various operations and control flow in the circuit. There are various logic gates from basic to complex. Basic logic gates include, AND, OR, NOT, NAND, NOR, XOR, XNOR. Basic logic gates can be used to create other logic gates, like combining AND and NOT gives, NAND.

Basic Logic Gates

Following are the basic logic gates:

  • NOT
  • AND
  • OR
  • NAND
  • NOR
  • XOR
  • XNOT

NOT gate

Truth table for NOT gate:

AAX=AˉX=\bar{A}
01
10

NOT gate

AND gate

Truth table for AND gate:

AABBX=A.BX=A.B
000
010
100
111

AND gate

OR gate

Truth table for OR gate:

AABBX=A.BX=A.B
000
011
101
111

OR gate

NAND gate

Truth table for NAND gate:

AABBX=A.BX=A.B
001
011
101
110

NAND gate

NOR gate

Truth table for NOR gate:

AABBX=A.BX=A.B
001
010
100
110

NOR gate

XOR gate

Truth table for XOR gate:

AABBX=A.BX=A.B
000
011
101
110

XOR gate

XAND gate

Truth table for XAND gate:

AABBX=A.BX=A.B
001
010
100
111

XAND gate

Example 1: Draw logic circuit for AˉB(A+BˉC)+ACˉ\bar{A}B(A+\bar{B}C)+A\bar{C}.

Method 1: Using direct lines, the circuit can be drawm as:

Example 1: M1 circuit

Method 2: Using parallel lines, the circuit can be drawn as:

Example 1: M2 circuit

Example 2: Draw logic circuit for AˉC(A+Bˉ(A+BˉCˉ))\overline{\bar{A}C}(A+\bar{B}(A+\bar{B}\bar{C}))

Following is the logic circuit for the above operation:

Example 2 circuit

Universal Gates

NAND and NOR gates are called universal gates because they can be used to form any other gates.

Using NAND gate

NOT gate

NAND-NOT circuit

AND gate

NAND-AND circuit

OR gate

NAND-OR circuit

Using NOR gate

NOT gate

NOR-NOT circuit

AND gate

NOR-AND circuit

OR gate

NOR-OR circuit

Circuit Conversion

Using NAND only

NAND gate being an universal gate, can be used to convert all gates in a circuit to it, i.e., all gates within the circuit can be converted into NAND gate. The circuit thus will be made of only NAND gate. The steps to do so are:

  1. For AND gates, the NOT will be placed infront of the gate towards the output.
  2. For OR gates, the NOTs will be placed behind the gate from the inputs.
  3. All NOTs infront of AND gate will be cancelled. Consequetively any NOT behind OR gate will be cancelled.
  4. The circuit must be balanced. Any NOT added to the circuit must be countered with another NOT in the same line.

Example 3: Construct, AˉB(A+BˉC)+ACˉ\bar{A}B(A+\bar{B}C)+A\bar{C} using NAND gates only.

Circuit using normal gates:

Example 3: Rough circuit

In the above circuit, NOT gates from the main line will be converted into, NAND-NOT circuit. The AND gate operating BˉC\bar{B}C, will have a NOT infront of it, which will be countered by the NOT behind the frontal OR gate. The frontal OR's second input coming from AA will be changed to Aˉ\bar{A} in order to counter for the NOT behind the OR gate. The AND gate operating AˉB\bar{A}B, will have a NOT infront of it, and since it is connected further to an AND gate, a NOT gate will be added to balance the circuit. The final OR will receive two NOTs from the preceeding ANDs, and give the final result.

Final circuit using NAND gates only:

Example 3: Rough circuit

Exercise 1

  1. Draw a circuit for AˉC(A+Bˉ(A+BˉCˉ))\overline{\bar{A}C}(A+\bar{B}(A+\bar{B}\bar{C})), using NAND gates only.

  2. Draw a circuit for the following using NAND gates only:

    1. Aˉ(BˉC+Aˉ(B+Cˉ)+ACˉ)+BˉC\bar{A}(\bar{B}C+\bar{A}(B+\bar{C})+A\bar{C})+\bar{B}C
    2. (ACˉ+Aˉ(B+Aˉ))(Bˉ(A+Bˉ)+AˉCˉ)(A\bar{C}+\bar{A}(B+\bar{A}))(\bar{B}(A+\bar{B})+\bar{A}\bar{C})
    3. Aˉ(Cˉ(AˉB+Cˉ)+Bˉ(AˉCˉ+B))\bar{A}(\bar{C}(\bar{A}B+\bar{C})+\bar{B}(\bar{A}\bar{C}+B))
Docs
AnanyaGB
About
© MIT - 2024