inverter layout and post-layout simulationcreating the inverter layout1. start electric
4. to layout the inverter we need the following components:
5. select the pMOS component
6. select the nMOS component
7. use polysilicon to connect the gates of the two transistors 8. add a Metal-1-Polysilicon-1-Con to create the input port of the inverter
9. keep the layout as compact as possible
10. add a Metal-1-P-Active-Con (pAct) to the drain of the pMOS
11. add a Metal-1-N-Active-Con (nAct) to the drain of the nMOS
12. use metal to connect the drain of the pMOS and the drain of the nMOS 13. add a Metal-pin on the metal connection and create the output port of the inverter
14. connect the p-well and the source of nMOS transistor to gnd
15. connect the n-well and the source of the pMOS transistor to vdd 16. at this point the layout is complete
post-layout simulation
inverter_sim_sch.spi
*** SPICE deck for cell inverter_sim{sch} from library C5_CMOSLIB *** Created on Fri Nov 19, 2021 00:37:00 *** Last revised on Wed Nov 24, 2021 15:20:24 *** Written on Wed Nov 24, 2021 15:56:38 by Electric VLSI Design System, version 9.07 *** Layout tech: mocmos, foundry MOSIS *** UC SPICE *** , MIN_RESIST 4.0, MIN_CAPAC 0.1FF *** SUBCIRCUIT C5_CMOSLIB__inv_20_10 FROM CELL inv_20_10{sch} .SUBCKT C5_CMOSLIB__inv_20_10 in out ** GLOBAL gnd ** GLOBAL vdd Mnmos@2 out in gnd gnd NMOS L=0.6U W=3U Mpmos@0 vdd in out vdd PMOS L=0.6U W=6U .ENDS C5_CMOSLIB__inv_20_10 .global gnd vdd *** TOP LEVEL CELL: inverter_sim{sch} Xinv_20_1@2 in out C5_CMOSLIB__inv_20_10 * Spice Code nodes in cell cell 'inverter_sim{sch}' .include ../../class/models/C5_models_bsim3.mod vdd vdd 0 dc 5 vin in 0 pulse (0 5 0 1n 1n 4n 10n) .tran 100p 30n .plot tran v(out) v(in) .END
2. create a new cell to simulate the inverter layout - inverter_sim{lay}
inverter_sim_lay.spi
*** SPICE deck for cell inverter_sim{lay} from library C5_CMOSLIB *** Created on Fri Nov 19, 2021 01:03:23 *** Last revised on Wed Nov 24, 2021 15:54:32 *** Written on Wed Nov 24, 2021 15:56:12 by Electric VLSI Design System, version 9.07 *** Layout tech: mocmos, foundry MOSIS *** UC SPICE *** , MIN_RESIST 4.0, MIN_CAPAC 0.1FF *** SUBCIRCUIT C5_CMOSLIB__inv_20_10 FROM CELL inv_20_10{lay} .SUBCKT C5_CMOSLIB__inv_20_10 gnd in out vdd Mnmos@1 out in gnd gnd NMOS L=0.6U W=3U AS=15.75P AD=7.425P PS=24.9U PD=12.3U Mpmos@1 out in vdd vdd PMOS L=0.6U W=6U AS=20.7P AD=7.425P PS=30.9U PD=12.3U .ENDS C5_CMOSLIB__inv_20_10 *** TOP LEVEL CELL: inverter_sim{lay} Xinv_20_1@4 gnd in out vdd C5_CMOSLIB__inv_20_10 * Spice Code nodes in cell cell 'inverter_sim{lay}' .include ../../class/models/C5_models_bsim3.mod vdd vdd 0 dc 5 vin in 0 pulse (0 5 0 1n 1n 4n 10n) .tran 100p 30n .plot tran v(out) v(in) .END
3. run ngspice on both netlists and write the results in ./spiceout/inverter_sim_sch.raw and ./spiceout/inverter_sim_lay.raw
Pyinverter_sim.py
# Pyinverter_sim.py from PyLTSpice.LTSpice_RawRead import RawRead as RawRead import matplotlib.pyplot as plt import numpy as np LTR = RawRead("./spiceout/inverter_sim_sch.raw") print(LTR.get_trace_names()) print("\n") print(LTR.get_raw_property()) print("\n") steps = LTR.get_steps() num_steps = len(steps) print('number of sweeps in the simulation (sch):', num_steps) # objects containing the data t = LTR.get_trace('time') Vo = LTR.get_trace('v(out)') Vi = LTR.get_trace('v(in)') # extract the data from the objects if num_steps == 1: time_sch = t.get_time_axis(0) Vout_sch = Vo.get_wave(0) Vin_sch = Vi.get_wave(0) LTR = RawRead("./spiceout/inverter_sim_lay.raw") print(LTR.get_trace_names()) print("\n") print(LTR.get_raw_property()) print("\n") steps = LTR.get_steps() num_steps = len(steps) print('number of sweeps in the simulation (lay):', num_steps) # objects containing the data t = LTR.get_trace('time') Vo = LTR.get_trace('v(out)') Vi = LTR.get_trace('v(in)') # extract the data from the objects if num_steps == 1: time_lay = t.get_time_axis(0) Vout_lay = Vo.get_wave(0) Vin_lay = Vi.get_wave(0) fig1 = plt.figure() plt.title("C5 CMOS inverter: transient analysis of schematic vs. layout" ) plt.ylabel("voltage (V)") plt.xlabel("time (ns)") plt.xlim([4,7]) str1 = "rise time" plt.annotate(str1, xy=(4.5,3.0), ha='left', va='top', color='black', fontsize=11, weight='bold') # plt.plot(time_sch*1e9,Vin_sch, label="v$_{in}$(t)") plt.plot(time_sch*1e9,Vout_sch, label="v$_{out}$(t) - $\it{schematic}$") plt.plot(time_lay*1e9,Vout_lay, label="v$_{out}$(t) - $\it{layout}$") plt.legend(loc="lower right",frameon=True,fontsize=10) plt.tight_layout(); fig2 = plt.figure() plt.title("C5 CMOS inverter: transient analysis of schematic vs. layout" ) plt.ylabel("voltage (V)") plt.xlabel("time (ns)") plt.xlim([9,12]) str2 = "fall time" plt.annotate(str2, xy=(9.5,3.0), ha='left', va='top', color='black', fontsize=11, weight='bold') # plt.plot(time_sch*1e9,Vin_sch, label="v$_{in}$(t)") plt.plot(time_sch*1e9,Vout_sch, label="v$_{out}$(t) - $\it{schematic}$") plt.plot(time_lay*1e9,Vout_lay, label="v$_{out}$(t) - $\it{layout}$") plt.legend(loc="upper right",frameon=True,fontsize=10) plt.tight_layout(); plt.show() |