This repository explains the implementation of Logic Gates in CMOS Logic using LTspice Simulator. This shows the schematics of Logic Gates and plot the output waveform to verify the functionality.
Logic Gate: A logic gate is a device that performs logical operations on one or more binary inputs and produces a single binary output. The primary way of building logic gates uses diodes or transistors acting as electronic switches. Today, most logic gates are made from MOSFETs (metal–oxide–semiconductor field-effect transistors). Logic circuits include such devices as multiplexers, registers, arithmetic logic units (ALUs), computer memory and microprocessors which may contain more than 100 million logic gates.
Logic Gates - Basic Gates and Universal Gates
Basic Gates: Basic gates, also known as elementary or fundamental gates, include the AND, OR and NOT gates. These gates operates on binary signals (0s and 1s) and provide the basis for all digit computations. Other gates such as XOR, XNOR, NAND and NOR can be derived from basic gates.
Universal Gates: A universal gate is a digital logic gate that can be used to implement any Boolean function without requiring other gates. NAND and NOR Gates are universal gates.
CMOS: Complementary metal–oxide–semiconductor (CMOS) is a type of MOSFET that uses complementary and symmetrical pairs of p-type and n-type MOSFETs for logic functions. Input is applied at the common gate of PMOS and NMOS transistors.Output is taken from the PMOS and NMOS drain. CMOS technology is used for constructing integrated circuit (IC) chips, including microprocessors, microcontrollers, memory chips and other digital logic circuits. Two important characteristics of CMOS devices are high noise immunity and low static power consumption.
PMOS: The PMOS transistor is a p-channel device. It conducts current when a negative voltage (logic low) is applied to its gate terminal with respect to the source terminal. In CMOS, PMOS acts as pull up network in which the source is connected to VDD. When logic low(0) is applied is CMOS, the PMOS transistor turns on and connects the VDD to output which makes the output to logic high(1).
NMOS: The NMOS transistor is an n-channel device. It conducts current when a positive voltage (logic high) is applied to its gate terminal with respect to the source terminal. In CMOS, MMOS acts as pull down network in which the source is connected to ground. When logic high(1) is applied is CMOS, the NMOS transistor turns on and connects the output to ground which makes the output to logic low(0).
The main goal of this project are given below
LTspice Simulation Files: Files with .asc extension represents LTspice simulation files for each logic gate.
Figure 1: Logic Symbol, Truth table and Logic Circuit of AND gate
Figure 2: Logic Symbol, Truth table and Logic Circuit of OR gate
Figure 3: Logic Symbol, Truth table and Logic Circuit of NOT gate
Figure 4: Logic Symbol, Truth table and Logic Circuit of NAND gate
Figure 5: Logic Symbol, Truth table and Logic Circuit of NOR gate
LTspice captures schematics of different circuits and shows the results of simulation by using waveform viewer. Circuit simulation analysis provides the transient, AC and DC analysis.
PULSE(0 5 0 1n 1n 5u 10u)
PULSE(0 5 0 1n 1n 10u 20u)
.include D:\NIELIT\ENGR3426\ENGR3426\engr3426.sub
.tran 100u
Output: The output Vout is based on the functionality of logic gates.
PULSE(0 5 1n 1n 10u 20u) is a syntax used to define a pulse waveform for a voltage source VB
Initial Value (Vintial): 0[V] This is the voltage level of the source before the pulse begins.
Pulse Value (Von): 5[V] This is the voltage level during the ON period of the pulse.
Delay Time (Tdelay): 0[s] This is the delay time from input voltage to output voltage. In this case, there is no delay.
Rise Time (Trise): 1n[s] This is the time taken for the pulse to change from the Initial Value to the Pulse Value.
Fall Time (Tfall): 1n[s] This is the time taken for the pulse to change from the Pulse Value back to the Initial Value.
On Time (Ton): 5u for VA and 10u for VB This is the time for which the pulse on for some period of time
Time period (Tperiod): 10us for VA and 20us for VB This is the total time for one complete cycle of the pulse waveform.
Number of Cycles (Ncycles): 10 This specifies how many cycles of the pulse waveform should be generated.
.tran
is used as a keyword.So, with the given inputs, the voltage source will start at 0V, then immediately rise to 5V. It will remain at 5V upto 5us for VA and 10us for VB, then drop back down to 0V. The total period for one complete cycle of this waveform is 10us for VA and 20us for VB. This cycle will repeat 10 times.
File - New Schematic (Ctrl+N)
Component (P)
in the toolbar.Wire (W)
in the toolbar.
Figure 6: Length and Width of transistors
Figure 7: Transient Analysis values
Figure 8: LTspice Schematic of AND Gate
Figure 9: LTspice Schematic of OR Gate
Figure 10: LTspice Schematic of NOT Gate
Figure 11: LTspice Schematic of NAND gate
Figure 12: LTspice Schematic of NOR gate
Run/Pause(Alt+R)
to run the schematic.Add Plot Pane Above
option by left click on the waveform viewer window. Add 3 panes for 2 inputs and 1 output.The pulse rises from 0 to 5v. Depending on the pulse width and period settings, the pulse will repeat at regular intervals. The generated output is based on the applied inputs VA, VB and the logic functionality. The graphs VA - V(n002), VB - V(n003), Vout - V(vout) represent the inputs and output respectively with different colours. The simulation results verifies the functionality of circuits.
Figure 13: Simulated waveform of AND Gate
Figure 14: Simulated waveform of OR Gate
Figure 15: Simulated waveform of NOT Gate
Figure 16: Simulated waveform of NAND gate
Figure 17: Simulated waveform of NOR gate