Forum: GHDL GHDL Undefined Reference

Posted by Peter LaDow (Guest)
on 2009-02-17 19:06
(Received via mailing list)
I have a module that fails during elaboration with the following 
message:

uart_t0.o: In function 
`work__uart_t0__ARCH__behav__uart_file_con__PROC':
uart_t0.vhd:(.text+0x379c): undefined reference to `__ghdl_value_e8'
collect2: ld returned 1 exit status
ghdl: compilation error

******************** GHDL Bug occured ****************************
Please report this bug on http://gna.org/projects/ghdl
GHDL release: GHDL 0.28dev (20080721) [Sokcho edition]
Compiled with GNAT Version: 4.3.2 20081007 (Red Hat 4.3.2-5)
In directory: /home/pladow/Projects/tools/trunk/tb/uart_t0/
Command line:
ghdl -e --std=02 uart_t0
Exception STORAGE_ERROR raised
Exception information:
Exception name: STORAGE_ERROR
Message: stack overflow (or erroneous memory access)
Call stack traceback locations:
0x80fe74b
******************************************************************

The analysis goes fine.  I'd rather not post all the source code, but
I do not know what is causing the issue.  And I can't seem to create a
test case that exhibits the problem.  I am using protected types,
hence the need for "--std=02".

Any ideas?  Perhaps this can come up before?  A google search of
__ghdl_value_e8 doesn't reveal anything, and I don't know what these
mean.

Thanks,
Pete
--
--
"To love for the sake of being loved is human;  to love for the sake
of loving is Angelic."  -- Alphonse de Lamartine
Posted by Sylvere Teissier (Guest)
on 2009-02-17 22:39
(Received via mailing list)
Peter LaDow wrote:
> I have a module that fails during elaboration with the following message:
>
> uart_t0.o: In function `work__uart_t0__ARCH__behav__uart_file_con__PROC':
> uart_t0.vhd:(.text+0x379c): undefined reference to `__ghdl_value_e8'
> collect2: ld returned 1 exit status
> ghdl: compilation error
>   
It seems your code use a 'value attribute on enumerated type (bit,
std_logic, custom ...)

According to ghdl source code, 'value attribute is only implemented for
integer

There are easy workarounds to not use "value" attribute and I'm curious
of what kind of code use it (it's not synthetizable).
Posted by Peter LaDow (Guest)
on 2009-02-17 23:11
(Received via mailing list)
On Tue, Feb 17, 2009 at 1:38 PM, Sylvere Teissier <st@invia.fr> wrote:
> Peter LaDow wrote:
>> I have a module that fails during elaboration with the following message:
>>
>> uart_t0.o: In function `work__uart_t0__ARCH__behav__uart_file_con__PROC':
>> uart_t0.vhd:(.text+0x379c): undefined reference to `__ghdl_value_e8'
>> collect2: ld returned 1 exit status
>> ghdl: compilation error
>>
> It seems your code use a 'value attribute on enumerated type (bit,
> std_logic, custom ...)

I do use 'value.  I'm using it to convert a string to an enumerated 
type, i.e.:

type enuma ( a, b, c, d );

variable tmp : enuma;

enuma := enuma'value("a");
enuma := enuma'value("b");
enuma := enuma'value("c");
enuma := enuma'value("d");

> According to ghdl source code, 'value attribute is only implemented for
> integer
>
> There are easy workarounds to not use "value" attribute and I'm curious
> of what kind of code use it (it's not synthetizable).

You are right, this is not synthesizable.  It is a testbench module.
I have a command file that looks something like:

wait 10
read 5
wait 3
read 7

I have VHDL to parse the command file and puts each token (whitespace
separated) into a string.  I then run through the command file
executing the commands.  For example:

  type cmds is (read, wait, ...);
  type str_ptr is access string;
  type token_array is array(natural range <>) of str_ptr;
  type token_array_ptr is access token_array;
  type token_list is array (natural range <>) of token_array_ptr;

process
  variable tokens : token_list;
  procedure parse_file(fname : in string) is
  begin
    ...
  end procedure parse_file;

  variable cmdline : token_array_ptr;
begin
  -- Parse the file into the tokens variable
  parse_file(CMD_FILENAME);

  for i in tokens'range loop
    cmdline := tokens(i);
    case cmds'value(cmdline(0).all) is
      when read =>
      when wait =>
    end case;
  end loop;
end process;

Where parse_file() parses into the tokens variable.

Now, I'm sure I can replace the case/end case with an if/elsif/endif
chain, and that would work.  I didn't know that GHDL didn't support
'value for enumerated types.

I admit that I first implemented this in Modelsim, and it works there.
 I'm trying to port these testbench modules over to GHDL.

Thanks,
Pete
--
--
"To love for the sake of being loved is human;  to love for the sake
of loving is Angelic."  -- Alphonse de Lamartine
Posted by Tristan Gingold (Guest)
on 2009-02-19 06:57
(Received via mailing list)
On Tue, Feb 17, 2009 at 10:38:25PM +0100, Sylvere Teissier wrote:
> 
> According to ghdl source code, 'value attribute is only implemented for 
> integer

Humm, right I forgot this.
Shouldn't be very hard to implement it for enumerated types.

Tristan.
This topic is locked and can not be replied to.