I'm using GHDL 0.29 for Windows.
The following program prints "Hello world!"
use std.textio.all;
entity hello_world is
end hello_world;
architecture behaviour of hello_world is
begin
process
variable l : line;
begin
write (l, String'("Hello world!"));
writeline (output, l);
wait;
end process;
end behaviour;
The following program hangs and doesn't print anything.
use std.textio.all;
entity hello_world is
end hello_world;
architecture behaviour of hello_world is
begin
process
variable l : line;
begin
assert false report "Foo" severity note;
write (l, String'("Hello world!"));
writeline (output, l);
wait;
end process;
end behaviour;
The following program outputs the two assertions and then the "Hello world!" message.
use std.textio.all;
entity hello_world is
end hello_world;
architecture behaviour of hello_world is
begin
process
variable l : line;
begin
assert false report "Foo" severity note;
assert false report "bar" severity note;
write (l, String'("Hello world!"));
writeline (output, l);
wait;
end process;
end behaviour;
I tried increasing the number of assertions and I discovered that when I have an odd number of assertions, the simulation hangs. It doesn't even matter where they are located. The following hangs:
assert false report "Foo" severity note;
assert false report "bar" severity note;
assert false report "zoz" severity note;
assert false report "lol" severity note;
assert false report "mok" severity note;
assert false report "antidisestablishmentarianism" severity note;
write (l, String'("Hello world!"));
writeline (output, l);
wait;
assert false report "asd" severity note;
The following prints everything up to the "antidisestablishmentarianism" assert:
assert false report "Foo" severity note;
assert false report "bar" severity note;
assert false report "zoz" severity note;
assert false report "lol" severity note;
assert false report "mok" severity note;
assert false report "antidisestablishmentarianism" severity note;
write (l, String'("Hello world!"));
writeline (output, l);
wait;
assert false report "asd" severity note;
assert false report "gneeek" severity note;
Edit
The problem is more general, and seems to be related with the number of statements within a process being odd or even. The following prints "Hello world!Hello moon!" repeatedly:
-- Hello world program.
use std.textio.all; -- Imports the standard textio package.
-- Defines a design entity, without any ports.
entity hello_world is
end hello_world;
architecture behaviour of hello_world is
begin
process
variable l : line;
begin
write (l, String'("Hello world!"));
write (l, String'("Hello moon!"));
writeline (output, l);
end process;
end behaviour;
While the following doesn't print anything and hangs:
-- Hello world program.
use std.textio.all; -- Imports the standard textio package.
-- Defines a design entity, without any ports.
entity hello_world is
end hello_world;
architecture behaviour of hello_world is
begin
process
variable l : line;
begin
write (l, String'("Hello world!"));
writeline (output, l);
end process;
end behaviour;
Edit (this may save you some time)
The weird behavior described above doesn't occur under Linux. Clearly, one of the two versions of GHDL is seriously flawed, and I strongly suspect that it is the Windows one. I'll file a bug report. I'm still interested in why the behavior is different.
Edit (I also tried with version 0.25)
With version 0.25 for Windows I get this error:
C:\Users\AjejeBrazorf\Documents\Programming\GHDL\Example>ghdl -a 1.vhdl
1.vhdl:1:10: file textio.v93 has changed and must be reanalysed
The ghdl.exe is the one packaged with the GTKWave bundle (https://stackoverflow.com/a/16629872/415727).
I've seen similar problems with the Windows GHDL 0.29.x builds.
Your example runs OK using either GHDL 0.25 or a patched 0.29.1.
EDIT: note, the following bundled installer seems to have VHDL library timestamp issues