VHDL "For" 循环空值范围
VHDL "For" Loop Null Range
我已经被这个问题困了几个小时了,似乎我无法通过搜索找到解决方案,即在这里或 Google.
上都没有找到任何解决方案
这是我的一段代码:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std;
USE work.arrays.ALL;
ENTITY parallel IS
PORT (clk:IN std_logic; text:IN INT_ARRAY(119 DOWNTO 0); result:OUT INT_MATRIX_2D);
END parallel;
ARCHITECTURE arch OF parallel IS
COMPONENT unit_comparator IS
PORT (letter:IN integer; difference:OUT integer);
END COMPONENT;
SIGNAL temp: INT_MATRIX_2D := (others => (others => 0));
SIGNAL temp_differences: INT_ARRAY(119 DOWNTO 0) := (others => 0);
BEGIN
PROCESS(clk)
BEGIN
IF(rising_edge(clk))THEN
FOR index IN 119 TO 1 LOOP
temp(temp_differences(index))(temp_differences(index - 1)) <=
temp(temp_differences(index))(temp_differences(index - 1)) + 1;
END LOOP;
result <= temp;
END IF;
END PROCESS;
wiring_loop: FOR index IN 119 DOWNTO 0 GENERATE
wiring_unit: unit_comparator PORT MAP (text(index), temp_differences(index));
END GENERATE;
END arch;
您看到“FOR index IN 119 TO 1 LOOP”吗?
编译器给出一个“Range 119 to 0 is Null”的警告应该),我似乎理解有问题。如果在循环的每一步都有一个整数分配给 "index",它怎么会变成 null(它说它发生在每一步!)。我需要一个坚定的理解而不是一个简单的解决方案。
(注意:所有使用的模块和包都经过测试并且可以正常工作!)
谢谢!
范围需要与其极限相对应的方向。您想要 119 downto 1
或 1 to 119
。 119 to 1
不是适合迭代的范围。
我已经被这个问题困了几个小时了,似乎我无法通过搜索找到解决方案,即在这里或 Google.
上都没有找到任何解决方案这是我的一段代码:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std;
USE work.arrays.ALL;
ENTITY parallel IS
PORT (clk:IN std_logic; text:IN INT_ARRAY(119 DOWNTO 0); result:OUT INT_MATRIX_2D);
END parallel;
ARCHITECTURE arch OF parallel IS
COMPONENT unit_comparator IS
PORT (letter:IN integer; difference:OUT integer);
END COMPONENT;
SIGNAL temp: INT_MATRIX_2D := (others => (others => 0));
SIGNAL temp_differences: INT_ARRAY(119 DOWNTO 0) := (others => 0);
BEGIN
PROCESS(clk)
BEGIN
IF(rising_edge(clk))THEN
FOR index IN 119 TO 1 LOOP
temp(temp_differences(index))(temp_differences(index - 1)) <=
temp(temp_differences(index))(temp_differences(index - 1)) + 1;
END LOOP;
result <= temp;
END IF;
END PROCESS;
wiring_loop: FOR index IN 119 DOWNTO 0 GENERATE
wiring_unit: unit_comparator PORT MAP (text(index), temp_differences(index));
END GENERATE;
END arch;
您看到“FOR index IN 119 TO 1 LOOP”吗?
编译器给出一个“Range 119 to 0 is Null”的警告应该),我似乎理解有问题。如果在循环的每一步都有一个整数分配给 "index",它怎么会变成 null(它说它发生在每一步!)。我需要一个坚定的理解而不是一个简单的解决方案。 (注意:所有使用的模块和包都经过测试并且可以正常工作!)
谢谢!
范围需要与其极限相对应的方向。您想要 119 downto 1
或 1 to 119
。 119 to 1
不是适合迭代的范围。