On Tue, Feb 17, 2009 at 1:38 PM, Sylvere Teissier <[email protected]> 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

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

Reply via email to