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

SomeRandomPhysicist picture SomeRandomPhysicist · Jul 21, 2016 · Viewed 13k times · Source

I am having a problem with using GHDL (http://ghdl.readthedocs.io/en/latest/) to simulate my VHDL design. So, when I use the command ghdl -e Averager_tb to compile the test bench with GHDL I get the warning:

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

To compile the test bench for simulation I use the following commands:

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

And the output of my design stays unchanged throughout the testbench, I also find that the print statements inside the Design are not executed.

To execute the compiled test bench simulation I use the command:

ghdl -r Averager_tb

However when I simulate the same testbench on http://www.edaplayground.com using the Aldec Riviera Pro 2015.06 simulator I find that the print statements within the design are executed and the output changes as I would expect.

Why is this and how might I fix it?

Here is the entity declaration in my design

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

Below is the test bench:

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

  ...

Answer

SomeRandomPhysicist picture SomeRandomPhysicist · Jul 21, 2016

Figured it out, it was a stupid mistake, I forgot to compile the design as well as the test bench. The solution was to compile and run like so:

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