name:  Last, First
* Edit the line above so that 'Last' is your last name
* and 'First' is your first name.  
* You should edit this file to include your spice circuit elements.
* Note that lines beginning with an asterisk are comment lines
* and are ignored when running spice.
***************************
* POWER SUPPLY
vdd      100      0        4.5
****************************
* INPUTS
vip      1        101      sin      (0       1      1meg)
ein      2        101      1        101      -1
vcm      101      0        2
***************************
* INPUT BIAS CURRENT
ibias    200    0     200u
***************************
* LOAD
rload    3      4     15k
cload    3      4     8p
***************************
* MODELS
* 0.4um CMOS process models (model data from many sources)

.MODEL CMOSN NMOS LEVEL=3
+ TOX=0.8000E-08 XJ=0.150000U TPG=1 PHI=0.600000
+ DELTA=2.1370E-01 LD=9.0003E-08 VTO=0.60 GAMMA=0.5947
+ UO=450.  THETA=1.9240E-01 RSH=1.7260E+01 KP=1.96E-04
+ NSUB=1.2706E+17 NFS=6.0410E+11 VMAX=1.8610E+05 ETA=2.1370E-02
+ KAPPA=8.4220E-02 CGDO=3.5E-10 CGSO=3.5E-10
+ CGBO=3.0251E-10 CJ=5.2E-04  MJ=0.59 CJSW=1.2E-10
+ MJSW=0.31 PB=0.98
+ ACM=3 HDIF=0.4u

.MODEL CMOSP PMOS LEVEL=3
+ TOX=0.8000E-08 XJ=0.150000U TPG=-1 PHI=0.600000
+ DELTA=2.0729E-01 LD=9.0000E-08 VTO=-0.80 GAMMA=0.5200
+ UO=137.3 THETA=1.6710E-01 RSH=3.6310E+00 KP=6.6E-05
+ NSUB=9.7132E+16 NFS=5.9890E+11 VMAX=3.0560E+05 ETA=1.8760E-02
+ KAPPA=5.9230E+00 CGDO=3.5E-10 CGSO=3.5E-10
+ CGBO=3.1661E-10 CJ=9.1191E-04 MJ=0.49 CJSW=1.2E-10
+ MJSW=0.201 PB=0.96
+ ACM=3 HDIF=0.4u

*********

* USEFUL STUFF
*Specify the l, w, ad, as, pd, and ps for your transistors as shown below.
*m1       1        2        3        4        cmosp l  w ad as pd ps  m=8
*Then all these parameters for all transistors can be linked through
*the following parameter statements.
.param   w=100u       l=1u  
.param  ad='1.0e-6*w' as='1.0e-6*w' pd='w+2.0e-6' ps='w+2.0e-6'
*Note that you need not pick your unit devices to be 100um/1um.
*This is just an example.
*The area/perimeter statement causes ad, as, pd, and ps
*to automatically track changes in w.
*Note that the parameter "m" specifies the number of parallel transitors
*and simplifies the use of unit devices. (So m=2 means two parallel
*transistors, each with the dimensions given.)
*Statements such as these should be included in your circuit below.
****************************
* Enter Your Circuit Here:
*
 
 
*
*
****************************
*ANALYSIS COMMANDS 
*
.options nomod ingold=2 acout=0
.global  100
****************************
*GAIN AND OUTPUT RESISTANCE ANALYSIS
*Use .tf to find gain and output resistance
.tf      v(3)     vip
****************************
*THD ANALYSIS
.tr      5n       2u
.four    1meg     v(3, 4)
****************************
*STEP RESPONSE ANALYSIS AND POWER DISSIPATION
*The "alter" command will allow you
*to run a separate simulation to find the step response and power
*dissipation inside the same input file that runs the other simulations.
*Otherwise, you may need to use more than one input file to find
*all the buffer characteristics.  In either case, you only
*need to turn in one file.  
*
.alter
  vip      1        101      pulse    (0 1 0n 1n 1n 10u 20u)
*First, find the final value and power dissipation
.dc      vip      1        0        -1
.measure dc       vod_fin  find     v(3, 4)     at=1
.measure dc       ivdd     find     i(vdd)      at=1
.measure power    param='-4.5*ivdd'

*Next, find the maximum vod and the overshoot.
*The transient analysis here uses the step input.
.tr      1n       200n
.measure tran     vod_max  max      v(3, 4)     from     0   to   200n
.measure os       param='vod_max/vod_fin'

.end
