*LAB2 Static Load Inverters * * Power supplies * v_vcc vcc 0 vccr v_vss vss 0 vssr .global vcc vss * * Circuit Stimulus * V_in is a voltage source connected between the nodes 'in' and 'vss' V_in in vss dc 0 * * Corner information * .include '/ecad/local/cadence/cysrc/t/2.0/hp14tb/models/trtc.cor' .include '/ecad/local/cadence/cysrc/t/2.0/hp14tb/models/tt.cor' .temp 27 .param vssr=0 vccr=3.3 vbbr=0 * * Options information * .options nomod post scale=1e-6 * * Extra devices * * Defines another power supply needed for the subcircuit X2 V_vcc2 vcc2 vss vccr * *Defines a dependent voltage source Ein2 Ein2 in2 vss vol='v(in)+0.1' *The above line defines the dependent voltage source *the value of Ein2 is the value of v(in) + 0.1v *Note that for using Ein2 in this way, we should have *first defined the primary source v(in). *Another dependent voltage source to *measure the slope Eslope slope vss vol='(v(out2) - v(out))/0.1' *Defining a subcircuit *replace subckt_name with any name of your choice *replace spiceckt_name with the name of spice circuit file .subckt subckt_name vcc vss in out .inc 'spice_cktname.sp' .ends subckt_name *Instantiating a subcircuit *Element name for subckt instantiation must begin with an 'X' X2 vcc2 vss in2 out2 subckt_name *To measure the resistance across the load element *i(v_vcc) gives the current that is coming *out of the supply v_vcc *This current is the drain-source current in the load device Eres res vss vol='(vccr-v(out))/i(v_vcc)' * * Analysis information * *This performs a dc sweep from 0 to vccr in *steps of 0.01 .dc V_in 0 vccr 0.01 *put .measure statement for finding switching point here .MEASURE dc lowest_output FIND v(out) when v(in) = vccr * for the inverter the output is at its lowest when input is maximum *of vccr *put .measure statement for highest_output here *note that the output will be highest when the input is lowest ie vssr .MEASURE dc voh FIND v(out) WHEN v(slope) = -1.0 *similarly write out the .measure statement for vil .MEASURE dc vih FIND v(in) WHEN v(slope) =-1.0 cross=2 *similarly write out the .measure statement for vol *note that on your tranfer char. there are 2 points *at which the slope is -1. cross = 2 indicates the *second point at which the slope is -1. *The gain of the inverter is dVoutput/dVinput = slope *The slope is negative *So the gain is max. when slope is min. .MEASURE dc max_gain MIN v(slope) *To compute the noise margin *once you have voh and vih .MEASURE dc nm_h param='(voh - vih)' *Similarly obtain the nm_l parameter from vol and vil *to include your ckt file add the ckt file name to the next line .include 'spiceckt_name.sp' .end