我正在尝试在XIlinx ISE 14.7中模拟以下VHDL模块,但生成的VHDL测试平台文件假定所有输入和输出端口都是std_logic和std_logic_vector类型 .
package newtype is
type row_t is array(0 to 2) of integer;
end newtype;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use work.newtype.all;
entity mymodule is
port (indata : in row_t;
sum : out integer);
end mymodule;
architecture Behavioral of mymodule is
begin
process (indata)
begin
sum <= indata(0) + indata(1) + indata(2);
end process;
end Behavioral;
我用我的类型修改了生成的代码替换std_logic_vector,但这次它给了我语法错误 . 您能否告诉我在使用整数类型时编写文本替换文件的正确方法是什么?
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
use work.newtype.all;
ENTITY mymodule_test IS
END mymodule_test;
ARCHITECTURE behavior OF mymodule_test IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT mymodule
PORT(
indata : IN row_t;
sum : OUT integer
);
END COMPONENT;
--Inputs
signal indata : row_t := (0,0,0);
--Outputs
signal sum : integer;
-- No clocks detected in port list. Replace <clock> below with
-- appropriate port name
constant <clock>_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: mymodule PORT MAP (
indata => indata,
sum => sum
);
-- Clock process definitions
<clock>_process :process
begin
<clock> <= '0';
wait for <clock>_period/2;
<clock> <= '1';
wait for <clock>_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
wait for <clock>_period*10;
-- insert stimulus here
wait;
end process;
END;
1 回答
您尚未发布遇到的语法错误 . 但是,如果我在Xilix ISE 14.7中创建一个新项目并只添加上面的代码,我会收到这些语法错误:
所有这些行都包含标识符或前缀
<clock>
,它是Xilinx测试平台生成器的模板参数 . 如果这样,发生器检测到您在向导中选择的设计中的时钟(此处为mymodule
),则<clock>
将替换为时钟信号的实际名称 . 测试平台生成器未在您的设计中找到时钟信号,因此它只插入了普通模板代码 . 这些语法错误与测试平台中integer
类型的用法无关 .您的设计不依赖于时钟信号,因此您可以安全地删除与时钟信号关联的所有测试平台代码: