"component instance "用GHDL模拟器模拟测试台时uut“未绑定”

"component instance "uut" is not bound" when simulating test bench with GHDL simulator

我在使用 GHDL (http://ghdl.readthedocs.io/en/latest/) 模拟我的 VHDL 设计时遇到问题。因此,当我使用命令 ghdl -e Averager_tb 使用 GHDL 编译测试台时,我收到警告:

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

并且我的设计的输出在整个测试台中保持不变,我还发现设计中的打印语句没有被执行。

要执行已编译的测试平台模拟,我使用命令:

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
  );

  ...

想通了,这是一个愚蠢的错误,我忘了编译设计和测试平台。解决方案是像这样编译和运行:

ghdl -a Averager_Bettertb.VHD
ghdl -a Averager.VHD
ghdl -e Averager_tb
ghdl -r Averager_tb #--stop-time=10us