UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply

ieee.math_real support with Vivado

Accepted Solution Solved
Adventurer
Posts: 51
Registered: ‎05-14-2015
Accepted Solution

ieee.math_real support with Vivado

Hello, it is noticed that IEEE library "math_real" is not supported in Vivado. Is there an alternative way for it? 


Accepted Solutions
Scholar
Posts: 2,097
Registered: ‎04-26-2015

Re: ieee.math_real support with Vivado

The suggestion here is to write your own log2 function; it doesn't have to be efficient because it'll never be implemented. That seems like a reasonable approach.

View solution in original post


All Replies
Scholar
Posts: 2,097
Registered: ‎04-26-2015

Re: ieee.math_real support with Vivado

There's no "nice" way to do it. The math_real library isn't supported because those floating-point operations are hard - and often not practical to run in a combinational way.

 

Vivado does include the Floating Point IP core, which can do the required maths. However, it'll require a lot of cycles to run and interfacing is not trivial (you can't just use "+" anywhere in your code, you actually have to send the operands and the operation off to the IP core to be added).

Adventurer
Posts: 51
Registered: ‎05-14-2015

Re: ieee.math_real support with Vivado

@u4223374 Thank you for the reply. 

Actually, what i want is to add a function to calculate the bit width of the bus which is not required to be synthesized into logic. In this function, ceil and log2 function inside ieee.math_real are used. Is there an alternative for ceil and log2? 

function f_Bits(nr : integer) return natural is
        variable v_i : integer;
    begin
        if nr < 2 then
            v_i := 1;
        else
            v_i := integer(ceil(log2(real(nr))));
        end if;
        return v_i;
    end f_Bits;
Scholar
Posts: 2,097
Registered: ‎04-26-2015

Re: ieee.math_real support with Vivado

The suggestion here is to write your own log2 function; it doesn't have to be efficient because it'll never be implemented. That seems like a reasonable approach.

Moderator
Posts: 5,300
Registered: ‎08-01-2008

Re: ieee.math_real support with Vivado

Currently, the Vivado Synthesis tool does not support IEEE MATH_REAL and IEEE PROPOSED package libraries.

This was published in this ARs
https://www.xilinx.com/support/answers/52304.html
Thanks and Regards
Balkrishan
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.
Highlighted
Explorer
Posts: 199
Registered: ‎04-26-2012

Re: ieee.math_real support with Vivado

[ Edited ]

@softwind555 "ceil and log2 function inside ieee.math_real are used. "

 

Vivado synthesis DOES support math_real for elaboration-time static calculations such as bit width. See this thread for documentation links:

https://forums.xilinx.com/t5/Synthesis/what-is-the-replacement-of-math-real-library-in-vivado/m-p/729458

 

@balkris @achutha "Currently, the Vivado Synthesis tool does not support IEEE MATH_REAL and IEEE PROPOSED package libraries. <snip> https://www.xilinx.com/support/answers/52304.html"

 

I've been asking Xilinx to fix that badly outdated AR52304 since 2013, e.g. :

https://forums.xilinx.com/t5/Synthesis/CR-Request-Update-UG901-Vivado-Synthesis-User-Guide-to-document/m-p/560689#M13344

 

How many years and requests does it take to get Xilinx to fix bad documentation that continues to confuse both Xilinx users and synthesis forum moderators?

 

-Brian

 

Adventurer
Posts: 51
Registered: ‎05-14-2015

Re: ieee.math_real support with Vivado

@brimdavis Thanks a lot for your input.  

But, It's found it's still not supported in the latest Vivado 2016.4. I can still get error report. See picture below for error info. 

 

error.png

Explorer
Posts: 199
Registered: ‎04-26-2012

Re: ieee.math_real support with Vivado

@softwind555 "But, It's found it's still not supported in the latest Vivado 2016.4."

 

 It is supported by the synthesizer- have you actually tried running synthesis and looking at the synthesis report?

 

 All you should need is a use ieee.math_real.all at the top of your file.

 

"See picture below for error info."

 

 Xilinx's buggy syntax checker within the editor is best turned off, as it reports bogus errors like this for legal VHDL constructs.

 

-Brian

Adventurer
Posts: 51
Registered: ‎05-14-2015

Re: ieee.math_real support with Vivado

@brimdavis, Thanks a lot! Indeed, synthesis doesn't report any error for this.