【发布时间】:2014-03-17 12:33:20
【问题描述】:
正在处理一个需要自检测试台的项目,我之前编写过该测试台并且没有任何问题。
但是,这个错误在我看来甚至不存在。 错误就在底部,我写了一个箭头指示它在哪里。 如果有人能发现我显然不能非常感激的错误并且知道下次要寻找什么。
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
ENTITY TestBenchAutomated IS
generic (m: integer := 3; n: integer := 5; h: integer := 4; DATA_SIZE: integer :=5);
END TestBenchAutomated;
ARCHITECTURE behavior OF TestBenchAutomated IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT TopLevelM_M
generic (m: integer := 3; n: integer := 5; h: integer := 4; DATA_SIZE: integer :=5);
PORT(
clk : IN std_logic;
next_in : IN std_logic;
rst_in : IN std_logic;
LEDs : OUT SIGNED((DATA_SIZE+DATA_SIZE)+(m-1)-1 downto 0)
);
END COMPONENT;
--Inputs
signal clk : std_logic := '0';
signal next_in : std_logic := '0';
signal rst_in : std_logic := '0';
--Outputs
signal LEDs : SIGNED((DATA_SIZE+DATA_SIZE)+(m-1)-1 downto 0);
-- Clock period definitions
constant clk_period : time := 10 ns;
type Vector is record
LEDs : SIGNED((DATA_SIZE+DATA_SIZE)+(m-1)-1 downto 0);
end record;
type VectorArray is array
(natural range <> ) of Vector;
constant Vectors : VectorArray := (
-- LEDs,
(X"30"), --48
(X"f6"),--246
(X"108"),--264
(X"FFFFFFD3"),-- -45
(X"FFFFFF4C"), -- -180
(X"FFFFFFCF"),-- -49
(X"ab"), -- 171
(X"13"), -- 19
(X"1B"), -- -27
(X"45"), -- -69
(X"45"), -- -69
(X"2d"), -- 45
(X"122"), -- -290
(X"56"), -- 86
(X"f2"), -- 242
(X"7d"), -- 125
(X"FFFFFFC9"), -- -55
(X"115"), -- 277
(X"FFFFFFE3"), -- -29
(X"FFFFFF7D")); -- -131
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: TopLevelM_M PORT MAP (
clk => clk,
next_in => next_in,
rst_in => rst_in,
LEDs => LEDs
);
-- Clock process definitions
clk_process :process
variable i : integer;
begin
for i in Vectors'range loop
LEDs <= Vectors(i).Test_LEDs;
wait for clk_period*1;
wait for 100 ns;
rst_in <= '1';
wait for clk_period*3;
rst_in <= '0';
for i in 0 to 50 loop --Loops through enough times to cover matrix and more to test what happens
next_in <= '1';
wait for clk_period*5;
next_in <= '0';
wait for clk_period*1;
assert LEDs = Vectors(i).Test_LEDs
report "The answers wrong mate" & integer'image(i)
severity error;
end loop;
wait;
end process; <------ SAYS THE ERROR IS HERE?!?
END;
感谢您的帮助。
【问题讨论】:
-
我重新缩进了你的代码以使错误更清楚...
-
顺便说一下,当编译器在一个简单的行上指出一个在语法上显然正确的假设错误时,它通常是该行之前的东西,通常是未闭合的循环、块等,或者丢失分号什么的。
-
另一件事:您不需要在第 81 行声明变量 i。for 循环是一个隐式声明,并且 i 在 for 循环中表现为一个常量。此外,如果您在两个嵌套循环中重用名称 i ,可能会使人类读者感到困惑。最好写
for i...for j...