* Here in lab02 we build * an operational amplifier * using 180nm technology for * production in silicon .include 'mosamp.cir' * Introduce a physical instance of mosamp here: x1 (inp inn out vdd vss) mosamp * Power sources: * vdd (vdd 0) dc=1.8 vss (vss 0) dc=-1.8 * Load capacitor: * cl (out 0) c=1p * Signal sources: * vin1 (inn 0) dc=0 ac=1 vin2 (inp 0) dc=0 .control echo "Initial OP analysis:" op print v(out) echo "DC sweep of Vin1 (inverting input)" * dc source start stop step dc vin1 -1.8 1.8 0.001 plot v(inn) v(out) title "DC negative-input sweep" dc vin1 -1m 1m 0.001m *plot v(inn) v(out) title "DC negative-input sweep CENTRAL DETAIL" echo 'DC gain measurement' let c1=0 let c2=0 * _another word for index of a vector * / _index where... * / / _in_this_direction... * / / / _this_vector... * / / / / _reaches this value */ / / / / cursor c1 right v(inn,inp) 0 cursor c2 right v(inn,inp) -0.1m let gain=(v(out)[%c2]-v(out)[%c1])/(v(inn,inp)[%c2]-v(inn,inp)[%c1]) print gain db(abs(gain)) * Transient analysis: let @vin1[sin]=(0; 0.1m; 1k) tran 0.01m 0.01 plot v(inn) v(out) let @vin1[sin]=(0; 0.001m; 1k) tran 0.01m 0.01 *plot v(inn) v(out) let @vin1[sin]=(0; 100m; 1k) tran 0.01m 0.01 *plot v(inn) v(out) let @vin1[sin]=(0; 0.2m; 1k) tran 0.01m 0.01 *plot v(inn) v(out) let @vin1[sin]=(0; 0.2m; 100) tran 0.001m 0.05 plot v(inn) v(out) ***************************** * AC analysis -> freq sweep * _frequency_unit_(decade) * / _points_per_freq_unit * / / _start_freq * / / / _stop_freq ac dec 10 1 1G let h=v(out)/v(inn,inp) let hmag=db(h) let hphase=unwrap(ph(h)) plot hmag xlabel 'f [Hz]' ylabel 'abs(H) [dB]' title 'AC amplitude plot' *plot hphase xlabel 'f [Hz]' ylabel 'ph(H) [deg]' title 'AC phase plot' * low freq gain is: echo "AC measured low freq gain" let gain=hmag[0] print gain * Measure -3dB point on acmag echo "-3dB point" let gainm3db = gain-3 let c = 0 cursor c right hmag gainm3db * show bandwidth: let bw = abs(frequency)[%c] print bw * bw is roughly 200 hz * NOISE * * _output_voltage_of_interest * / _independent_voltage/current_source * / / * |-------| | |---> same as for AC analysis noise v(out) vin1 dec 10 0.1 100G 1 setplot previous plot sqrt(onoise_spectrum) ylog xlabel 'f [Hz]' ylabel 'N [v/sqrt(Hz)]' title 'Output noise' .endc .end