我在使用硬件描述语言(http://ghdl.readthedocs.io/en/latest/)来模拟我的VHDL设计时遇到了问题。所以,当我使用GHDL命令ghdl -e Averager_tb编译测试平台时,我得到了警告:
Averager_tb.VHD:33:3:warning: component instance "uut" is not bound
Averager_tb.VHD:11:14:warning: (in default configuration of averager_tb(behaviour))为了编译用于模拟的测试平台,我使用以下命令:
ghdl -a Averager_tb.VHD # the test bench file is Averager_tb.VHD
ghdl -e Averager_tb # the entity for the test bench is Averager_tb并且我的设计的输出在整个测试平台中保持不变,我还发现design中的print语句没有执行。
要执行编译后的测试台模拟,我使用以下命令:
ghdl -r Averager_tb但是,当我使用Aldec Riviera Pro 2015.06模拟器在http://www.edaplayground.com上模拟相同的测试平台时,我发现设计中的打印语句被执行了,并且输出如我预期的那样发生了变化。
为什么会这样?我该如何修复它?
下面是我的设计中的实体声明
-- Entity Declaration in Design
entity Averager is
port (
clk : in std_logic;
ClockEnable : in std_logic;
Averager_In : in std_logic_vector(7 downto 0);
Averager_Out : out std_logic_vector(7 downto 0)
);
end Averager;下面是测试平台:
-- TEST BENCH
architecture behaviour of Averager_tb is
signal X : real := 0.0; -- a real math variable initialized to 0
signal sine : real := 0.0; -- a real math variable initialized to 0
component Averager
port(
clk : in std_logic;
ClockEnable : in std_logic;
Averager_In : in std_logic_vector(7 downto 0);
Averager_Out : out std_logic_vector(7 downto 0)
);
end component;
signal clk : std_logic := '0';
signal ADC_clk : std_logic := '0';
signal Input : std_logic_vector(7 downto 0);
signal FPGAOutput : std_logic_vector(7 downto 0);
signal int_sine : integer;
constant clk_period : time := 5 ns;
begin
-- Instantiate the Unit Under Test (UUT)
UUT : Averager
port map (
clk => clk,
ClockEnable => ADC_clk,
Averager_In => Input,
Averager_Out => FPGAOutput
);
...发布于 2016-07-21 19:49:00
弄清楚了,这是一个愚蠢的错误,我忘了编译设计和测试台。解决方案是像这样编译和运行:
ghdl -a Averager_Bettertb.VHD
ghdl -a Averager.VHD
ghdl -e Averager_tb
ghdl -r Averager_tb #--stop-time=10ushttps://stackoverflow.com/questions/38502857
复制相似问题