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!

## Synthesis

Showing results for
Do you mean

## synthesis of ieee.math_in Vivado

Visitor
Posts: 14
Registered: ‎01-26-2010

# 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?

Voyager
Posts: 1,732
Registered: ‎06-24-2013

## 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
Explorer
Posts: 199
Registered: ‎04-26-2012

## Re: synthesis of ieee.math_in Vivado

[ Edited ]

@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