在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 3000|回复: 6

[求助] AD DA 如何透过hspice FFT 算ENOB ??

[复制链接]
发表于 2018-11-22 07:11:12 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

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 (-infut_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
发表于 2018-11-22 08:19:57 | 显示全部楼层
回复 1# peterlin2010

可以把波形保存成csv文件(默认精度好像只有四位,需要改高), 然后用下面这个Matlab程序处理:https://secure.engr.oregonstate.edu/wiki/ams/index.php/Matlab/PrettyFFT
 楼主| 发表于 2018-11-22 20:54:12 | 显示全部楼层



hspice   波形保存成csv文件 ??

   
hspice fft 要如何直接算? spiceExplorer ADCtool 到底如何用?

不靠  matlab 方式
发表于 2018-11-23 02:43:44 | 显示全部楼层
回复 2# iamshuang2013

看错了,Hspice没用过,不知道能不能导出数据。如果能导出的话,感觉用Matlab处理跟灵活一些,网上有很多函数可以调用。
 楼主| 发表于 2018-11-24 11:38:44 | 显示全部楼层


回复  iamshuang2013

看错了,Hspice没用过,不知道能不能导出数据。如果能导出的话,感觉用Matlab处理 ...
iamshuang2013 发表于 2018-11-23 02:43




    用.meas的指令将读到的数值丢给mathlab去执行,
记得要把时间去掉

chip123
可以  xxx(:,1)=[ ];   
=>  读取时就会清掉第一行时间

load my_xy.dat;     %  read data into the my_xy matrix
x = my_xy(:,1);     %  copy first column of my_xy into x
y = my_xy(:,2);     %  and second column into y

或可以连时间一起复制没有关系,只要丢入matlab内存成矩阵,
再打开存好的矩阵把你的电压那列整列复制,再存成另一个矩阵,就可以只分析电压罗!

fft 发现 eetop
http://bbs.eetop.cn/viewthread.php?tid=702851

edaboard find
np*Tck=Tsig*N
N =odd   np=2^n  

.option  fft_accurate

.param N=99
.param np=1024
.param fck=125E6
.param Tck=1/fck
.param starttime=100n
.param stoptime='starttime+np*Tck'
.fft v(out) np=1024 from=starttime to=stoptime
发表于 2018-11-25 10:05:05 | 显示全部楼层
回复 5# peterlin2010

Cool!
 楼主| 发表于 2018-11-25 11:08:16 | 显示全部楼层


回复  peterlin2010

Cool!
iamshuang2013 发表于 2018-11-25 10:05




    customwave  adcTool 有没有人会使用 ?   

如果 能直接用HSPICE  + FFT  就不须要 matlab
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-2-11 15:49 , Processed in 0.022615 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表