* Here in lab02 we build * an operational amplifier * using 180nm technology for * production in silicon * FOR 20 dB AMP correct v(inn) to v(in) in measurements .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 vin1 (in 0) dc=0 ac=1 vin2 (inp 0) dc=0 * Feedback resistors * r2 (out inn) r=5meg r1 (inn in) r=0.5meg .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(in) v(out) title "DC negative-input sweep" dc vin1 -1m 1m 0.001m plot v(in) 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(in) 0 cursor c2 right v(in) -0.1m let gain=(v(out)[%c2]-v(out)[%c1])/(v(in)[%c2]-v(in)[%c1]) print gain db(abs(gain)) * Transient analysis: let @vin1[sin]=(0; 0.1m; 1k) tran 0.01m 0.01 plot v(in) 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(in) 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