Anwesa Roy
Member level 2
We are trying to generate Gaussian noise using vhdl. We have found a code that uses real variables to generate Gaussian noise and hence not synthesizable which is given here:
https://kanyevsky.kpi.ua/fpgadesign/dsp_rab1e.html
. Please post a code so that we can generate Gaussian noise using vhdl that is synthesizable.
The non synthesisable code is givenbelow. You may also mention the portions that we can edit in this program to make it synthesisable.
https://kanyevsky.kpi.ua/fpgadesign/dsp_rab1e.html
. Please post a code so that we can generate Gaussian noise using vhdl that is synthesizable.
The non synthesisable code is givenbelow. You may also mention the portions that we can edit in this program to make it synthesisable.
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.math_real.all;
entity Gauss_Gen is
generic(nn:natural:=1; --power of the binomial distribution <16
m:REAL:=0.0 -- mean output value
);
port(
CLK : in STD_LOGIC;
RST : in STD_LOGIC;
DATA_OUT : out REAL:=0.0
);
end Gauss_Gen;
architecture Model of Gauss_Gen is
type arri is array (0 to 15) of integer;
type arrr is array (0 to 15) of real;
begin
SFR:process(clk,rst)
variable s1:arri:=(3,33,333,3,4,5,6,7,8,9,11,22,33,others=>55);
variable s2:arri:=(5,55,555,50,6,7,8,9,5,6,7,21,33,others=>22);
variable r:arrr:=(others=>0.0);
variable s:real:=0.0;
begin
if rst='1' then
DATA_OUT<=0.0;
elsif clk='1' and clk'event then
s:=0.0;
for i in 0 to nn-1 loop -- nn noise generators
UNIFORM (s1(i),s2(i),r(i));
s:=s+r(i);
end loop;
DATA_OUT <= 2.0*(s/real(nn)-0.5)+ m;
end if;
end process;
end Model;