5
\$\begingroup\$

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;
asked Jun 20, 2013 at 11:25
\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jun 21, 2013 at 1:37

1 Answer 1

1
\$\begingroup\$

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: enter image description here

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!

answered Jun 21, 2013 at 10:08
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.