Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GHDL and Tristate Busses

758 views
Skip to first unread message

Rob Doyle

unread,
Jan 9, 2012, 11:08:16 PM1/9/12
to

Sorry if this is a stupid question...

I have a simple tristate bus simulation that I can't make work with
GHDL. Attached.

It generates the following error:

error: invalid memory access (dangling accesses or stack size too small)
error: simulation failed

I've tried increasing the stack size but it still fails.

It seems to work with the Xilinx Webpack....

Any clues?

$ ghdl --version
GHDL 0.29.1 (20100301) [Sokcho edition]
Compiled with GNAT Version: GPL 2009 (20090519)
mcode code generator
Written by Tristan Gingold.

Copyright (C) 2003 - 2010 Tristan Gingold.
GHDL is free software, covered by the GNU General Public License. There
is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Rob.

------------ begin test_asdf.vhd ---------------

library ieee;
use ieee.std_logic_1164.all;

entity test_asdf is
end test_asdf;

architecture behav of test_asdf is
signal clk : std_logic := '0';
signal rst : std_logic;
signal data : std_logic;
signal dir : std_logic;
begin

uut : entity work.asdf (rtl) port map (
clk => clk,
rst => rst,
data => data,
dir => dir
);

process
begin
wait for 10 ns;
clk <= not(clk);
end process;

rst <= '1', '0' after 80 ns;
data <= '0' when dir = '0' else 'Z';

end behav;

-------------- end test_asdf.vhd --------


------------- start asdf.vhd --------------

library ieee;
use ieee.std_logic_1164.all;

entity asdf is port (
clk : in std_logic;
rst : in std_logic;
data : inout std_logic;
dir : out std_logic);
end asdf;

architecture rtl of asdf is
signal toggle : std_logic;
begin

process(clk, rst)
begin
if rst = '1' then
toggle <= '0';
elsif rising_edge(clk) then
toggle <= not(toggle);
end if;
end process;

data <= '1' when toggle = '1' else 'Z';
dir <= toggle;

end rtl;

-------------- end asdf.vhd -----------------

Enrik Berkhan

unread,
Jan 10, 2012, 3:07:57 AM1/10/12
to
Hi,

Rob Doyle <radi...@gmail.com> wrote:
> I have a simple tristate bus simulation that I can't make work with
> GHDL. Attached.
>
> It generates the following error:
>
> error: invalid memory access (dangling accesses or stack size too small)
> error: simulation failed
>
> I've tried increasing the stack size but it still fails.
>
> It seems to work with the Xilinx Webpack....
>
> Any clues?

Your testbench will run for ever. Looks like your GHDL version leaks
memory in this case or something. Either make the clock stop after some
time or tell ghdl to stop after some time like this:

$ ./test_asdf --stop-time=1us

On my system (Debian 6.0.3 x86_64, GHDL 0.29 from the distribution), your code
runs without a growing process. Modelsim is happy, too.

Enrik

Rob Doyle

unread,
Jan 10, 2012, 12:06:26 PM1/10/12
to Enrik Berkhan
That's a clue.

I tried to stop it as you suggest and it gives the same error message.

Maybe something is broken in the windoze version...

Rob.


Brian Davis

unread,
Jan 10, 2012, 7:47:03 PM1/10/12
to
Rob Doyle wrote:
>
> I have a simple tristate bus simulation that I can't make work with
> GHDL.  Attached.
<snip>
> error: invalid memory access (dangling accesses or stack size too small)
>

These tristate crashes are a known issue with Windows
versions of GHDL later than 0.25

Version 0.25 does _not_ have this issue:
http://ghdl.free.fr/ghdl-installer-0.25.exe

Or, a handy bundle of GHDL 0.25 + GTKwave with win installer:
http://sourceforge.net/projects/fpgalibre/files/GHDL/0.25_Windows/ghdl-0.25.msi/download

Building the latest 0.29.1 GHDL sources with a stack alignment
of 16 makes this crash go away, but I never figured out why.

see also:
https://mail.gna.org/public/ghdl-discuss/2011-08/msg00007.html
https://mail.gna.org/public/ghdl-discuss/2011-03/msg00023.html
https://mail.gna.org/public/ghdl-discuss/2011-03/msg00005.html

Brian
0 new messages