A project of CMOS based D latch. The document contains the CIR file for my design of the CMOS based D latch.
The D latch is designed using transmission gates and inverters. Two CMOS transmission gates and two inverters are used for this particular design. The design was constructed using Esim software and implemented using skywater 130nm pdk.

/Steps followed to implement the design

*First the design is constructed in Esim. 
*Then the ports for the input, output and vdd are connected and labelled properly. Electrical rules check are done to check for any error in connections. 
*After that the spice netlist(.CIR file) is generated from the circuit. 
*The spice netlist is then edited in order to add the sky130 models of the mosfets used in the circuit.
*A separate folder is created for the netlist file and the sky130 pdk is kept in the same folder as the netlist.
*After adding the models from the sky130 pdk, the sources for the Input, Enable and Vdd port are given. Transient analysis is done to obtain the waveforms of the latch. 
*The CIR file is then run using Ngspice software and the final input and output waveforms are obtained.

/Problems faced

At the beginning some errors were faced as the sky130 files were not present in the same folder as the netlist. This issue was resolved by placing the sky130 files in the proper location. 

Even after that, on running the spice simulation, it showed an error saying could not find valid modelname. Due to this error the output Q and Q showed zero for all values of input and enable signal. This error was caused due to incorrect values of width and length of the mosfets. On giving the appropriate values of width and length, the issue was resolved.

/How to run the circuit using ngspice

*To run the .cir file download the sky130 pdk from the following link: https://github.com/google/skywater-pdk-libs-sky130_fd_pr
*Also download ngspice software to run the spice simulation of the circuit. Download ngspice from: https://sourceforge.net/projects/ngspice/files/ng-spice-rework/
*Make sure that the sky130_fd_pr folder and the .cir file are present in the same folder before running.
*Now run the .cir using ngspice.
 