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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1304|回复: 3

[求助] 模拟仿真如何高效配置数控位?

[复制链接]
发表于 2021-5-26 11:35:52 | 显示全部楼层 |阅读模式

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

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

x
对于一个4位数控开关,在仿真时候如何通过设置十进制数来实现自动二进制转换?


比如对于分频器,想设置一个64分频,想在ADE里直接输入64,而不是手动挨个设置控制电位1000000  太累了


各位前辈们通常都是怎么做的?


另,对于使用ahdl里面的 8bit_adc_ideal,参数该如何设置?
感激不尽!!!
发表于 2021-5-26 12:13:40 | 显示全部楼层

`include "constants.vams"
`include "disciplines.vams"

module va_dec_to_4b(dec_in, bin_out);

input dec_in;
output        [3:0] bin_out;
electrical dec_in;
electrical [3:0] bin_out;
parameter vp = 0.8;

//-- Analog Portion ---------
analog begin
        @(initial_step) begin
        end
        V(bin_out[3])                 <+  vp* ((V(dec_in) % 16) >= 8 && (V(dec_in) % 16) < 16);
        V(bin_out[2])                 <+  vp* ((V(dec_in) % 8) >= 4 && (V(dec_in) % 8) < 8);
        V(bin_out[1])                 <+  vp* ((V(dec_in) % 4) >= 2 && (V(dec_in) % 4) < 4);
        V(bin_out[0])                 <+  vp* ((V(dec_in) % 2) >= 1 && (V(dec_in) % 2) < 2);

end
endmodule
 楼主| 发表于 2021-5-26 14:31:39 | 显示全部楼层


xart 发表于 2021-5-26 12:13
`include "constants.vams"
`include "disciplines.vams"


非常感谢!
 楼主| 发表于 2021-5-26 15:10:34 | 显示全部楼层
除了vams和adc,各位前辈们还有别的好方法嘛?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2025-2-25 12:21 , Processed in 0.022966 second(s), 7 queries , Gzip On, Redis On.

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