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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2510|回复: 1

[求助] VCO的理想VerilogA模型

[复制链接]
发表于 2016-1-4 10:52:30 | 显示全部楼层 |阅读模式

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

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

x




  1. module vco1 (out, in);

  2. input in; voltage in;                                // input terminal
  3. output out; voltage out;                        // output terminal
  4. parameter real vmin=0;                                // input voltage that corresponds to minimum output frequency
  5. parameter real vmax=vmin+1 from (vmin:inf);        // input voltage that corresponds to maximum output frequency
  6. parameter real fmin=1 from (0:inf);                // minimum output frequency
  7. parameter real fmax=2*fmin from (fmin:inf);        // maximum output frequency
  8. parameter real vl=-1;                                // high output voltage
  9. parameter real vh=1;                                // low output voltage
  10. parameter real tt=0.01/fmax from (0:inf);        // output transition time
  11. parameter real ttol=1u/fmax from (0:1/fmax);        // time tolerance
  12. real freq, phase;
  13. integer n;

  14. Analog begin
  15.     // compute the freq from the input voltage
  16.     freq = (V(in) - vmin)*(fmax - fmin) / (vmax - vmin) + fmin;

  17.     // bound the frequency (this is optional)
  18.     if (freq > fmax) freq = fmax;
  19.     if (freq < fmin) freq = fmin;

  20.     // bound the time step to assure no cycles are skipped
  21.     $bound_step(0.6/freq);

  22.     // phase is the integral of the freq modulo 2p
  23.     phase = 2*`M_PI*idtmod(freq, 0.0, 1.0, -0.5);

  24.     // identify the point where switching occurs
  25.     @(cross(phase + `M_PI/2, +1, ttol) or cross(phase - `M_PI/2, +1, ttol))
  26.         n = (phase >= -`M_PI/2) && (phase < `M_PI/2);

  27.     // generate the output
  28.     V(out) <+ transition(n ? vh : vl, 0, tt);
  29. end
  30. endmodule


复制代码


为什么输入信号为vpwl,t:0到10us,v:0到1V,输出一直保持为0呢?
发表于 2018-5-29 14:38:22 | 显示全部楼层
回复 1# guyi1990


   请问作者 这个问题 解决了吗?我也遇到同样的问题了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

×

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

GMT+8, 2024-4-27 21:34 , Processed in 0.025645 second(s), 8 queries , Gzip On, Redis On.

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