(to_unsigned) 转换后的 VHDL 不必要值
VHDL unnecessary value after (to_unsigned) conversion
我使用 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。错误是:
Value 3 is out of range 0 to 2.
point := 2 - l ; -- where l is the loop index
我使用 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。错误是:
Value 3 is out of range 0 to 2.
point := 2 - l ; -- where l is the loop index