用verilog—A编写DAC,仿真Vout为啥振幅只有Vin的一般,求租大神
时间:10-02
整理:3721RD
点击:
自己现在参考cadence库里的DAC,改了一下,变成一个10bit的DAC,但是仿真的时候我ADC输入的波形为0-3.3V,但从DAC输出的只有0-1.65,求解这个是怎么回事
下面是我的DAC代码
’include ”discipline.h”
'include "constance.h"
module dac_10bit(vd9, vd8, vd7, vd6, vd5, vd4,vd3, vd2, vd1,vd0,vout);
electrical vd9, vd8, vd7, vd6, vd5, vd4, vd3, vd2,vd1, vd0,vout;
parameter real vref=3.3 from [0:inf);
parameter real trise=1p from [0:inf);
parameter real tfall=1p from [0:inf);
parameter real tdel=3.3 from [0:inf);
parameter real vtrans=1;
real out_scaled;
analog begin
out_scaled=0;
out_scaled= out_scaled +((V(vd9) > vtrans) ? 512:0);
out_scaled= out_scaled +((V(vd9) > vtrans) ? 256:0);
.
.
.
out_scaled= out_scaled +((V(vd9) > vtrans) ?1:0);
V(vout)<+transition(vref*outscaled/1024, tdel,trise,tfall);
end
endmodule
下面是我的DAC代码
’include ”discipline.h”
'include "constance.h"
module dac_10bit(vd9, vd8, vd7, vd6, vd5, vd4,vd3, vd2, vd1,vd0,vout);
electrical vd9, vd8, vd7, vd6, vd5, vd4, vd3, vd2,vd1, vd0,vout;
parameter real vref=3.3 from [0:inf);
parameter real trise=1p from [0:inf);
parameter real tfall=1p from [0:inf);
parameter real tdel=3.3 from [0:inf);
parameter real vtrans=1;
real out_scaled;
analog begin
out_scaled=0;
out_scaled= out_scaled +((V(vd9) > vtrans) ? 512:0);
out_scaled= out_scaled +((V(vd9) > vtrans) ? 256:0);
.
.
.
out_scaled= out_scaled +((V(vd9) > vtrans) ?1:0);
V(vout)<+transition(vref*outscaled/1024, tdel,trise,tfall);
end
endmodule
tdel=3.3 改为0试试