|  | 
 
| 
请大神们能否给我解答一下我的这个问题,我主要是用VerilogA搭一个pipeline ADC的模型,目前其中使用的是何乐年《模拟集成电路设计与仿真》书中的运放代码,但是我在仿真时出现问题,经调试是这个运放代码有问题,请大神们能够告诉我一下代码哪里错了(我把vsoft=0.5改成了vsoft=0.0,其他没有修改)。代码如下:`include "discipline.h"
×
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册  `include "constants.h"
 
 module diff_opamp(vout_p,vout_n,vref,vin_p,vin_n,vsupply_p,vsupply_n);
 input vref,vsupply_p,vsupply_n;
 inout vout_p,vout_n,vin_p,vin_n;
 parameter real gain= 835e4;
 parameter  real
 freq_unitygain=1.0e6;
 parameter  real
 rin=1e6;
 parameter  real
 ibias=0.0;
 parameter  real
 rout=80;
 parameter  real iin_max=100e-6;
 parameter  real slew_rate=0.5e6;
 parameter  real
 vin_offset=0.0;
 parameter  real
 vsoft=0.5;
 real  gm_nom;
 real  vmax_in;
 real  vin_val,c1,r1;
 electrical vout_p,vout_n,vref,vin_p,vin_n,vsupply_n,vsupply_p;
 electrical cout_n,cout_p;
 
 analog begin
 @(initial_step or initial_step("dc"))begin
 c1=iin_max/slew_rate;
 gm_nom=2*3.14*freq_unitygain*c1;
 r1=gain/gm_nom;
 vmax_in=iin_max/gm_nom;
 end
 
 vin_val=V(vin_p,vin_n)/2+vin_offset;
 //
 //input stage
 //
 I(vin_p,vin_n)<+V(vin_p,vin_n)/r_in+vin_offset/r_in;
 I(vref,vin_n)<+i_bias;
 I(vref,vin_p)<+i_bias;
 
 //
 //GM stage with slew rating
 //
 I(vref,cout_p)<+ V(vref,cout_p)/100e6;
 I(vref,cout_n)<+ V(vref,cout_n)/100e6;
 if(vin_al>vmax_in)begin
 I(vref,cout_p)<+ iin_max;
 I(vref,cout_n)<+ -iin_max;
 end
 else if(vin_al<-vmax_in)begin
 I(vref,cout_p)<+ -iin_max;
 I(vref,cout_n)<+  iin_max;
 end
 else begin
 I(vref,cout_p)<+0.5*gm_nom*vin_val;
 I(vref,cout_n)<+ -0.5*gm_nom*vin_val;
 end
 //
 //dominate pole
 //
 I(cout_p,vref)<+ ddt(c1*V(cout_p,vref));
 I(cout_p,vref)<+ V(cout_p,vref)/r1;
 I(cout_n,vref)<+ ddt(c1*V(cout_n,vref));
 I(cout_n,vref)<+ V(cout_n,vref)/r1;
 
 //
 //output stage
 //
 I(vref,vout_p)<+ V(cout_p,vref)/rout;
 I(vout_p,vref)<+ V(vout_p,vref)/rout;
 I(vref,vout_n)<+ V(cout_p,vref)/rout;
 I(vout_n,vref)<+ V(vout_n,vref)/rout;
 
 
 //
 //soft output limiting
 //
 if(V(vout_p)>(V(vsupply_p)-vsoft))begin
 I(cout_p,vref)<+gm_nom*(V(vout_p,vsupply_p)+vsoft);
 end
 else if(V(vout_p)<(V(vsupply_n)+vsoft))begin
 I(cout_p,vref)<+gm_nom*(V(vout_p,vsupply_n)-vsoft);
 end
 if(V(vout_n)>(V(vsupply_p)-vsoft))begin
 I(cout_n,vref)<+gm_nom*(V(vout_n,vsupply_p)+vsoft);
 end
 else if(V(vout_n)<(V(vsupply_n)+vsoft))begin
 I(cout_n,vref)<+gm_nom*(V(vout_n,vsupply_n)-vsoft);
 end
 end
 endmodule
 | 
 |