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!

cancel
Showing results for
Search instead for
Did you mean:
Visitor
2,189 Views

synthesis of ieee.math_in Vivado

I use a function to calculate some sinus values into the RAM for filter coefficients. THese are static values.

Vivado miss the ieee.math_real library. I have read the satic use is possible.

How can I set up correctly?

2 Replies
Voyager
2,179 Views

Re: synthesis of ieee.math_in Vivado

Hey @doss,

Something like this should do the trick:

```library IEEE;
use IEEE.std_logic_1164.ALL;
use IEEE.numeric_std.ALL;
use IEEE.math_real.ALL;

...
constant AWIDTH : integer := 8;
constant DWIDTH : integer := 32;

constant MDEPTH : integer := 2**AWIDTH;

type mem_t is array (0 to MDEPTH-1) of
signed(DWIDTH-1 downto 0);

function init_mem
return mem_t is
constant SCALE : real := 2**(real(DWIDTH-2));
constant STEP  : real := 1.0/real(MDEPTH);
variable mem : mem_t;
begin
for I in 0 to MDEPTH-1 loop
mem(I) := to_signed(integer(                cos(2.0*MATH_PI*real(I)*STEP)*SCALE), DWIDTH);
end loop;
return mem;
end;

constant sin : mem_t := init_mem;
```

Hope this helps,

Herbert

-------------- Yes, I do this for fun!
Highlighted
Voyager
2,124 Views

Re: synthesis of ieee.math_in Vivado

@doss "Vivado miss the ieee.math_real library."

Vivado synthesis *DOES* suppport ieee.math_real for elaboration-time calculations, but unfortunately:

- the online syntax checker in the VIvado editor mistakenly flags ieee.math_real as an error

- some Xilinx documentation mistakenly claims ieee.math_real is unsupported

See these posts for more info and documentation links:

-Brian