Actually in some part of my project I need to have random numbers in exponential distribution, therefore I produce uniform random numbers using Fibonacci LFSRs and then convert it to exponential distribution by look-up table.
I need this big ROM to implement look-up table and I have to use it in the process :
random_gen : process(CLK)
variable qout_s : std_logic_vector(14 downto 0);
variable tend1 :std_logic_vector(14 downto 0);
variable tmp1 : std_logic;
variable tmp2 : std_logic;
variable tmp3 : std_logic;
begin
if (rst = '1') then
qout_s := (others=>'1');
elsif (clk'event and clk = '1') then
L1 : for j in 1 to 10 loop
tmp1 := qout_s(2) xor qout_s(0);
tmp2 := tmp1 xor qout_s(3);
tmp3:= tmp2 xor qout_s(5);
L2 :for i in 1 to 14 loop -- shift to right
qout_s(i-1) := qout_s(i);
end loop L2;
qout_s(14) := tmp3;
t1 : trans ( qout_s, inrand(j));
ttfs(j)<= inrand(j);
end loop L1;
end if;
if (clk'event and clk = '0') then -- by falling edge outputs generated
benchmark_2 (inrand ,clk, tsys_f );
end if;
end process;
--//////////////////////////////////////////////////////////////////////////////////////////////////////
procedure trans ( addr :in std_logic_vector(14 downto 0); signal outdata: out bit_vector(15 downto 0)) is
type rom is array(0 to 32767) of bit_vector(15 downto 0);
constant mem :rom :=(
"0000000101001011", --0
"0000000101101000", --1
"0000000110101011", --2
"0000101100110000", --3
"0000010001010100", --4
"0000000110001110", --5
…
"0000110010001011", --32765
"0000000110000010", --32766
"0000000010011011" --32767
);
begin
outdata <= mem(conv_integer(addr));
end trans;
--///////////////////////////////////////////////////////
It is so nice for me to use *.mif or *.hex files instead of listing data’s in the vhdl codes!!!