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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2357|回复: 5

[求助] 用verilog-A写一个电流源

[复制链接]
发表于 2021-3-10 11:00:07 | 显示全部楼层 |阅读模式
500资产
本帖最后由 萧sin_sang 于 2021-3-11 18:33 编辑

  刚接触verilogA,遇到困难。想设计一个脉冲电流源,其周期固定,幅度从0开始增长到一个值。有大佬写过类似的代码吗?有明白的指点小弟一番,万分感激~

最佳答案

查看完整内容

参考程序,楼主可以试一下,主要是要用电流源和for循环结合。 // Verilog-A for osc `include "constants.vams" `include "disciplines.vams" module osc(en,in,out); input en , in ; output out ; electrical en , in , out ; parameter real period = 667n from (0:inf) ; parameter real ref1 = 2.4 from (0:inf) ; parameter real ref2 = 1.5 from (0:inf) ; integer x ; real y ; analog begin if (V(in) < ref ...
发表于 2021-3-10 11:00:08 | 显示全部楼层
参考程序,楼主可以试一下,主要是要用电流源和for循环结合。
// Verilog-A for osc
`include "constants.vams"
`include "disciplines.vams"
module osc(en,in,out);
input en , in ;
output out ;
electrical en , in , out ;
parameter real period = 667n from (0:inf) ;
parameter real ref1 = 2.4 from (0:inf) ;
parameter real ref2 = 1.5 from (0:inf) ;
integer x ;
real y ;
analog begin
if (V(in) < ref1) begin
x = -1 ;
end
else begin
   if(V(en) < ref2) begin
     x = -1 ;

end
   else begin
   @(initial_step) x = 1 ;
   @(timer(0, period)) begin
     x = 1 ;
   end
   @(timer(period/2,period)) begin
     x = -1 ;
     end
   end
end
y = (x>0) ? V(in) : 0 ;
V(out) <+ transition(y, 0, 2n, 2n) ;
end
endmodule
发表于 2021-3-10 14:38:10 | 显示全部楼层
不是很熟,估计要用到timer()触发周期,transition()设置边沿,仅供参考。详细请查看相关书籍,论坛里有:http://bbs.eetop.cn/thread-136401-1-1.html
 楼主| 发表于 2021-3-10 21:04:03 | 显示全部楼层


jmf 发表于 2021-3-10 14:38
不是很熟,估计要用到timer()触发周期,transition()设置边沿,仅供参考。详细请查看相关书籍,论坛里有:h ...


好的,谢谢大佬,我去看看这个链接
发表于 2021-3-17 10:58:32 | 显示全部楼层
说错了,该段程序主要是应用 timer 语句,在设定的时间点对变量进行赋值,周期性的赋值,形成了周期变化的输出方波信号。参数 period 设定了信号的周期。同时,程序设置了两个控制端,分别为 VCC 和 VEN,两个控制信号同时有效时,输出才有效。
 楼主| 发表于 2021-3-17 11:01:53 | 显示全部楼层


dylan_yjs 发表于 2021-3-10 11:00
参考程序,楼主可以试一下,主要是要用电流源和for循环结合。
// Verilog-A for osc
`include "constants. ...


很有帮助!谢谢大佬!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

×

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

GMT+8, 2024-5-26 05:15 , Processed in 0.026121 second(s), 7 queries , Gzip On, Redis On.

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