【问题标题】:VHDL unnecessary value after (to_unsigned) conversion(to_unsigned) 转换后的 VHDL 不必要的值
【发布时间】:2015-11-25 22:42:34
【问题描述】:

我使用 for 循环:

for l in 0 to 2 loop

在里面我想在l=0时有2个,l=1时有1个,l=2时有0个。我怎样才能做到这一点?我用过:

to_integer(unsigned(not(std_logic_vector(to_unsigned(l,2))))) 

[这似乎太复杂了]但模拟时出错。我想是因为最终的整数也可以取值3。错误是:

值 3 超出 0 到 2 的范围。

【问题讨论】:

    标签: for-loop integer vhdl unsigned


    【解决方案1】:
    point := 2 - l ; -- where l is the loop index
    

    【讨论】:

      猜你喜欢
      • 2017-06-25
      • 2011-12-20
      • 1970-01-01
      • 1970-01-01
      • 2010-09-11
      • 1970-01-01
      • 2017-12-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多