For loop 转换(到无符号)后的VHDL不必要值
我使用for循环:For loop 转换(到无符号)后的VHDL不必要值,for-loop,integer,vhdl,unsigned,For Loop,Integer,Vhdl,Unsigned,我使用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的范围 point := 2 - l ; -- where l is the loop index
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的范围
point := 2 - l ; -- where l is the loop index