TOPIC: 2 Input NOR gate using CMOS.

NAME: Yogeshwary Shinde
 
PROOCEDURE:
1 .Download esim and install it in the OS. Also download ngspice 34.
2 .Open esim and create new project, name it NOR. A new project file will be created 
   in the esm window.
3 .Select the project file and click on open schematic.
4 .A blank new schematic will open.
5 .Click on place components in the side bar and place the NMOS, PMOS , ports and gnd
   on the schematic and connect it as shown in the circuit diagram.
6 .Change the field values of PMOS to M1 and M2 and NMOS to M3 and M4, and field values
   of all the ports from U? to U1.
7 .Label all the ports, inputs port to vin_1 and vin_2 and output port to v_out and the 
   port connected to pmos to vdd. Be sure to place the label properly, they will be used
   to give inputs and obtained outputs.
8 .Save the schematic by clicking on save schematic project option in the upper toolbar.
9 .Now click on the perform electrical rules check and click on the run option to find 
   out if there are any errors in the circuits.
10.Place the pwr component on the gnd if there are any errors on the gnd terminal.
11.Click on the generate netlist option on the upper toolbar to create a spice netlist.
   In the window that will open click on the spice then select default format and click
   on generate netlist and save the netlist in your esim workspace.
12.Go to the esim workspace, into the NOR folder copy NOR.cir file and paste it in 
   sky130_pd_fr folder (if sky130 is not there in the OS then download it).
13.Now open the NOR.cir file with notepad and edit the netlist as below:

	* \NOR.cir

	.lib "models/sky130.lib.spice" tt

	xM3  v_out vin_2 GND GND sky130_fd_pr__nfet_01v8		
	xM4  v_out vin_1 GND GND sky130_fd_pr__nfet_01v8		
	xM2  v_out vin_2 Net-_M1-Pad1_ vdd sky130_fd_pr__pfet_01v8		
	xM1  Net-_M1-Pad1_ vin_1 vdd vdd sky130_fd_pr__pfet_01v8

	Vdd vdd 0 1.8
	Vd0 vin_1 0 pulse(0 1.8 0s 0s 0s 5us 10us)
	Vd1 vin_2 0 pulse(0 1.8 0s 0s 0s 10us 20us)

	.tran 0.1us 40us
	.control
	run 

	plot V(vin_1) V(vin_2) V(v_out)
		
	.endc
	.end
   

   A.Here pmos and nmos have been replaced with sky130_fd_pr__pfet_01v8 and sky130_fd_pr__nfet_01v8 
     respectively.
   B.Give the control statement as shown above vdd is given 1.8v  
     vin_1 is given a digital pulse with HIGH value of 1.8V and LOW of 0V and input is HIGH at 0us, 
     10us, 20us and so on for the interval of 5us.
     vin_2 is given a digital pulse with HIGH value of 1.8V and LOW of 0V and input is HIGH at 0us, 
     20us, 40us and so on for the interval of 10us.
   C. .tran 0.1us 40us is to get the trans analysis from 0.1us to 40us.
   D.The plot command is to get the required outputs, here vin_1 , vin_2 and vout will be displayed 
     in the trans analysis.
14.Now open ngspice.exe from the ngspice folder that was downloaded and run the following command:
   A. cd (write sky_pd_fr file location) 
      and press enter
   B. NOR.cir 
      and press enter
15.Output waveform will be received in the trans anaylsis for NOR gate.
   vout is HIGH i.e 1.8V at 15us, 35us and so on for the time interval of 5us, this is the time
   interval when both the inputs are LOW.
16.Henceforth we can say that it is working as NOR gate.


   

   