VerilogA 代码 实现滞回比较器 求指导
时间:10-02
整理:3721RD
点击:
这是我写的代码,目的功能是 实现5%迟滞区间的迟滞比较器 但是 现在仿真的结果出不来请高手指点下 问题出在哪里~O(∩_∩)O谢谢
`include "constants.vams"
`include "disciplines.vams"
module comp_over5percent(OUT, GND, VDD, Vneg, Vpos);
output OUT;
electrical OUT;
input GND;
electrical GND;
input VDD;
electrical VDD;
input Vneg;
electrical Vneg;
input Vpos;
electrical Vpos;
parameter real offset=0;
real hyst ;
real thrlo;
real thrhi;
parameter real Out_high=5;
parameter real Out_low =0;
integer X;
analog begin
hyst=0.05*V(Vneg);
thrlo=offset-0.5*hyst;
thrhi=offset+0.5*hyst;
@(initial_step("dc"))
begin
if (V(Vpos,Vneg)>=offset) X=1;
else X=0;
end
@(cross(V(Vpos,Vneg)-thrhi,+1))
X=1;
@(cross(V(Vpos,Vneg)-thrlo,-1))
X=0;
V(OUT)<+transition(X?Out_high:Out_low,20p,10p);
end
endmodule
`include "constants.vams"
`include "disciplines.vams"
module comp_over5percent(OUT, GND, VDD, Vneg, Vpos);
output OUT;
electrical OUT;
input GND;
electrical GND;
input VDD;
electrical VDD;
input Vneg;
electrical Vneg;
input Vpos;
electrical Vpos;
parameter real offset=0;
real hyst ;
real thrlo;
real thrhi;
parameter real Out_high=5;
parameter real Out_low =0;
integer X;
analog begin
hyst=0.05*V(Vneg);
thrlo=offset-0.5*hyst;
thrhi=offset+0.5*hyst;
@(initial_step("dc"))
begin
if (V(Vpos,Vneg)>=offset) X=1;
else X=0;
end
@(cross(V(Vpos,Vneg)-thrhi,+1))
X=1;
@(cross(V(Vpos,Vneg)-thrlo,-1))
X=0;
V(OUT)<+transition(X?Out_high:Out_low,20p,10p);
end
endmodule
5%迟滞区间是什么意思?是什么的5%?
参考电压的5%,比如说标准电压时1.25V,那么滞回区间的宽度就是1.25*5%。