cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Scholar
Scholar
340 Views
Registered: ‎08-01-2012

[BUG VIVIVADO 2019.2] Invalid operator for type of expression

I have the following simple VHDL 2008 code.

 

library ieee;
use ieee.std_logic_1164.all;

entity str_test is
port (
  op    : out std_logic
);
end entity;

architecture rtl of str_test is
  constant EN : boolean := true;
begin

  op <= '1' when to_string(EN) = "true" else '0';
  
end architecture;

 No bugs are highlighted in the code window, but when trying to synthesise or open the elaborated design, you get the following eroneous error:

 

[Synth 8-5883] invalid operator type for expression ["D:/playarea/str_test.vhd":14]

It is a perfectly valid operator. In addition, there should be no problem with the string compare as it evaluates to a constant.

 

 

 

5 Replies
Highlighted
Scholar
Scholar
332 Views
Registered: ‎08-01-2012

Re: [BUG VIVIVADO 2019.2] Invalid operator for type of expression

This is extra silly, because the compiler clearly can clearly see the "to_string" function, as otherwise it would complain about it not being declared (like you get when you switch to VHDL 93).

Even more fun, this code works fine:

library ieee;
use ieee.std_logic_1164.all;

entity str_test is
port (
  op    : out std_logic
);
end entity;

architecture rtl of str_test is
  constant EN : boolean := false;
  
  function to_string(b : boolean) return string is
  begin
    if b then return "true";
    else      return "false";
    end if;
  end function;
begin

  op <= '1' when to_string(EN) = "true" else '0';
  
end architecture; 

 

0 Kudos
Highlighted
Scholar
Scholar
275 Views
Registered: ‎04-26-2012

Re: [BUG VIVIVADO 2019.2] Invalid operator for type of expression

@richardhead  "when trying to synthesise or open the elaborated design, you get the following eroneous error"

I've griped to Xilinx previously about their poor VHDL-2008 support for to_string(), but to no avail.

Although my gripe was in the context of wanting synthesis assertions using  to_string(real,format) to enable the troubleshooting of synthesis bugs within elaboration time computations using reals (e.g. sin lookup tables, filter coefficients, etc.).

-Brian

0 Kudos
Highlighted
Scholar
Scholar
248 Views
Registered: ‎08-01-2012

Re: [BUG VIVIVADO 2019.2] Invalid operator for type of expression

@brimdavis 

I also find it strange given that vivado finally has most VHDL 2008 features supported that are useful for synthesis, namely generic packages, generic types and functions as generics. But yet they still cannot support to_string(). It just feels odd that a custom to_string function works just fine!

0 Kudos
Highlighted
Scholar
Scholar
195 Views
Registered: ‎08-01-2012

Re: [BUG VIVIVADO 2019.2] Invalid operator for type of expression

Can someone confirm they have raised a Defect Report for this?

0 Kudos
Highlighted
Xilinx Employee
Xilinx Employee
129 Views
Registered: ‎02-16-2014

Re: [BUG VIVIVADO 2019.2] Invalid operator for type of expression

Hi @richardhead 

 

Reported this issue.

 

Thanks,

Manusha

0 Kudos