Hi, just a few cents...

Le 2013-11-28 07:59, David Koontz a écrit :
On 28 Nov 2013, at 6:38 am, Adrien <[email protected]> wrote:
ghdl1: out of memory allocating 536870912 bytes after a total of
227868672 bytes
ghdl: compilation error

Notice   there's a similar n=1 dimensional others statement at line
2373 in the process sensitive to clock:

                state_cur <= (others => '0');

And in the state transition process at line 289:

            state_next <= (others => '0');

Both of those are array sizes 3945.

There GHDL says it fails to allocate 539MB after 230MB, which does not
seem huge IMHO.

Notice the failure point used memory wise is close between the two
different models, which may speak to other complexities.  It looks
like you simply don't have enough memory.

We can actually look at fsm.vhd because you sent the source.  It has
150,235 signals and signal elements, and it seems the ratio of size
would be hard to imagine if it were only made up of those 539MB/150235
= 5370 bytes per signal.   That seems a bit high so you could wonder
if there were something else going on with others assignment. Perhaps
those others assignments got unfolded from loops to flat.

I have already spent a little time disassembling GHDL generated code
and it does not work exactly like in a C style programming.
it keeps checking bounds, and then checking some more,
so beware when you code with arrays etc.
GHDL will also duplicate large stuff if you're not cautious, like
providing an array as argument to a function (without proper care).
Furthermore, there are 2 stacks : the CPU stack and a made-up stack,
a sort of "heap", that can eat a lot of mallocs and stores stuff
that don't have a place on the stack, like returned arrays.
All the ease of writing that VHDL provides comes at a cost
on the compiler side, execution time and memory usage.
There are many considerations to take into account
while preparing the code, the structures,
when you write it's already too late.

Thanks everybody for this very interesting threads, btw :-)

yg

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to