|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
如何透过FFT 算AD ENOB ??
一般说 fs/N = fin M . N = fft取多少点至少 2^N , M 奇数周期
fs =4M
sin -> ideal ADC -> ideal DAC
adc use 10bit , hspice simulation
对 dac out 对输入FIN 做 fft , 输出会 1.5v 上下 sine
但使用 sandwork waveform tool ADCtoolbox 要如何算出 ENOB ?
thank you .
==
`define adc_size 10
`include "discipline.h"
`include "constants.h"
module ideal_adc(in,clk,out);
input in,clk;
output [0:`adc_size-1] out;
voltage in,clk,out;
// parameter integer adc_size = 3 from [1:inf);
parameter real fullscale = 3.3;
parameter real delay_ = 0, trise = 10n, tfall = 10n;
parameter real clk_vth = 1.5;
parameter real out_high = 1, out_low = 0 from (-inf ut_high);
real sample,thresh;
real result[0:`adc_size-1];
integer i;
analog
begin
@(cross(V(clk)-clk_vth, +1))
begin
sample = V(in);
thresh = fullscale/2;
for(i=adc_size-1;i>=0;i=i-1)
begin
if (sample > thresh)
begin
result[i] = out_high;
sample = sample - thresh;
end
else result[i] = out_low;
sample = 2*sample;
end
end
for(i=`adc_size-1;i>=0;i=i-1)
V(out) <+ transition(result,delay_,trise,tfall);
end
endmodule
`define dac_size 10
`include "constants.h"
`include "discipline.h"
module ideal_dac(in,out);
input [0:`dac_size-1] in;
output out;
voltage in,out;
parameter real dac_size = 2 from (1:inf);
parameter vth = 2.5;
parameter real trise = 0 from [0:inf);
parameter real tfall = 0 from [0:inf);
real code;
integer pow2 [0:`dac_size];
analog
begin
@(initial_step)
for (i=0;i<=`dac_size;i=i+1)
pow2[i] = pow(2,i);
code = 0;
for (i=0;i<`dac_size;i=i+1)
code = code + (V(in[i]) > vth) ? pow2[i] : 0;
V(out) <+ transition(code/pow2[`dac_size],0,trise,tfall);
end
endmodule |
|