# VHDL: Infinite loop for constant, but no problem with literal

I wrote a Testbench for a simple architecture. When I use the literal "1 ms" instead of the constant ct: time := 1 ms everything works. But otherwise GHDL stucks in an infinite loop.

Can you see an error in the code or is this a bug of GHDL?

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity s is
port
(
a: in std_logic;
b: out std_logic
);
end s;

architecture v1 of s is
begin
b <= not a;
end v1;


library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity testbench IS
END testbench;

architecture v1 of testbench is
component s
port
(
a: in std_logic;
b: out std_logic;
);
end component;

signal a: std_logic := '0';
signal b: std_logic := '0';
constant ct: time := 1 ms;
begin

a <= not a after ct; --constants not working?
-- but no problem with a <= not a after 1 ms;

dut: s
port map
(
a => a,
b => b,
);
end architecture;

• Is this the exact same code you use for simulation? First thing I would delete that superfluous comma in the port map of the DUT after b => b. Besides that, everything looks like correct VHDL syntax. – damage Jun 21 '13 at 1:37

Which version of GHDL? I have just tried the example (fixing two typos mentioned by "damage"), and both forms appear to do the same thing.

By the way, +1 for a nice simple testcase.

I am using the following:

uname -a
Linux Gannet 3.2.0-4-amd64 #1 SMP Debian 3.2.39-2 x86_64 GNU/Linux

ghdl --version
GHDL 0.30dev (20100112) [Sokcho edition]
Compiled with GNAT Version: 4.7.2

gtkwave --version
GTKWave Analyzer v3.3.46 (w)1999-2012 BSI


and the commands:

ghdl -a s.vhd
ghdl -a v1.vhd
ghdl -e testbench
./testbench --vcd=test --stop-time=50ms
gtkwave test


The result looks like this:

Now this version of GHDL is currently only available as an experimental package for Debian (Ubuntu etc) - for other distributions and OSes it is only available by building from source : see "instructions" section in message 4 at this GHDL bugreport page for details. However it is my belief that GHDL 0.29 should also work in your case; earlier versions may not.

UPDATE: this has also been the first test of GHDL built with gcc4.8 ... looks OK so far!