---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
--
|
--
|
-- Title : blockram
|
-- Title : blockram
|
-- Design : cfft
|
-- Design : cfft
|
-- Author : MENG Lin
|
-- Author : MENG Lin
|
-- email :
|
-- email :
|
--
|
--
|
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
--
|
--
|
-- File : blockram.vhd
|
-- File : blockram.vhd
|
-- Generated : unknown
|
-- Generated : unknown
|
--
|
--
|
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
--
|
--
|
-- Description : Dual port ram
|
-- Description : Dual port ram
|
--
|
--
|
---------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
library synplify;
|
library synplify;
|
use synplify.attributes.all;
|
use synplify.attributes.all;
|
|
|
entity blockdram is
|
entity blockdram is
|
generic(
|
generic(
|
depth: integer;
|
depth: integer;
|
Dwidth: integer;
|
Dwidth: integer;
|
Awidth: integer
|
Awidth: integer
|
);
|
);
|
port(
|
port(
|
addra: IN std_logic_VECTOR(Awidth-1 downto 0);
|
addra: IN std_logic_VECTOR(Awidth-1 downto 0);
|
clka: IN std_logic;
|
clka: IN std_logic;
|
addrb: IN std_logic_VECTOR(Awidth-1 downto 0);
|
addrb: IN std_logic_VECTOR(Awidth-1 downto 0);
|
clkb: IN std_logic;
|
clkb: IN std_logic;
|
dia: IN std_logic_VECTOR(Dwidth-1 downto 0);
|
dia: IN std_logic_VECTOR(Dwidth-1 downto 0);
|
wea: IN std_logic;
|
wea: IN std_logic;
|
dob: OUT std_logic_VECTOR(Dwidth-1 downto 0));
|
dob: OUT std_logic_VECTOR(Dwidth-1 downto 0));
|
end blockdram;
|
end blockdram;
|
|
|
architecture arch_blockdram of blockdram is
|
architecture arch_blockdram of blockdram is
|
|
|
type ram_memtype is array (depth-1 downto 0) of std_logic_vector
|
type ram_memtype is array (depth-1 downto 0) of std_logic_vector
|
(Dwidth-1 downto 0);
|
(Dwidth-1 downto 0);
|
signal mem : ram_memtype := (others => (others => '0'));
|
signal mem : ram_memtype := (others => (others => '0'));
|
attribute syn_ramstyle of mem : signal is "block_ram";
|
attribute syn_ramstyle of mem : signal is "block_ram";
|
|
|
signal addrb_reg: std_logic_vector(Awidth-1 downto 0);
|
signal addrb_reg: std_logic_vector(Awidth-1 downto 0);
|
|
|
begin
|
begin
|
wr: process( clka )
|
wr: process( clka )
|
begin
|
begin
|
if rising_edge(clka) then
|
if rising_edge(clka) then
|
if wea = '1' then
|
if wea = '1' then
|
mem(conv_integer(addra)) <= dia;
|
mem(conv_integer(addra)) <= dia;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process wr;
|
end process wr;
|
|
|
rd: process( clkb )
|
rd: process( clkb )
|
begin
|
begin
|
if rising_edge(clkb) then
|
if rising_edge(clkb) then
|
addrb_reg <= addrb;
|
addrb_reg <= addrb;
|
end if;
|
end if;
|
end process rd;
|
end process rd;
|
dob <= mem(conv_integer(addrb_reg));
|
dob <= mem(conv_integer(addrb_reg));
|
end arch_blockdram;
|
end arch_blockdram;
|
|
|
|
|