【发布时间】:2018-05-15 11:48:42
【问题描述】:
我的 VHDL 程序(有限状态机)的综合有问题;错误是:
[Synth 8-97] 数组索引 'number' 超出范围
但我很确定我的索引永远不会达到那个“数字”(正好是 255)。此外,行为模拟也有效。
这是我的一些代码(发生错误的地方):
K := 0;
while (K < var_col) loop --var_col is set to 24
if (array_col(K) = '1') then --the error is here
tot_col := tot_col + 1 + num_zero;
num_zero := 0;
else
tot_rows := tot_rows;
if (tot_col > 0) then
num_zero := num_zero + 1;
else
num_zero := 0;
end if;
end if;
K := K + 1;
end loop
我是这样声明数组的
architecture Behavioral of A is
subtype my_array is std_logic;
type my_array0 is array (0 to 254) of my_array;
--other signals declaration
begin
state_comb: process(sensitivity list)
variable array_col : my_array0 := (others => '0');
我该如何解决我的问题?
我使用 Vivado 2017.3
【问题讨论】:
-
var_col是如何分配的? -
合成while循环是......勇敢。如果您可以将其转换为具有恒定边界的 for 循环,则更多合成器工具可能会正确支持它。如需更多帮助,请将此示例设为minimal reproducible example,它至少会显示上述内容是否属于同步过程(可能正常)或其他(可能不正常)。
-
你为什么不用
for K in 0 to var_col loop? -
最好不要使用变量。您应该改用信号。
-
@JHBonarius 这对综合没有帮助,但如果它发生在模拟中,它应该会捕获错误。这提醒了我:Xilinx ISE 模拟器(Vivado 之前的版本)在默认情况下关闭边界检查/溢出检查;你必须去“高级选项”才能打开它。疯狂但真实。是否值得检查他们是否有机会在 Vivado 中修复该问题?