LIBRARY unisim;
USE unisim.vcomponents.ALL;

--------------------------------------------------------------------------------
-- bram_elaborate.vhd
--------------------------------------------------------------------------------
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;

-- synthesis translate_off
LIBRARY UNISIM;
USE UNISIM.VCOMPONENTS.ALL;
-- synthesis translate_on

ENTITY bram_elaborate IS
GENERIC (
	C_MEMSIZE : INTEGER := 16384;
	C_PORT_DWIDTH : INTEGER := 64;
	C_PORT_AWIDTH : INTEGER := 32;
	C_NUM_WE : INTEGER := 8;
	C_FAMILY : STRING := "virtex2p");
PORT (
	-- instance GLOBAL
	BRAM_Addr_B : IN STD_LOGIC_VECTOR(0 TO 31);
	BRAM_EN_A : IN STD_LOGIC;
	BRAM_Dout_A : IN STD_LOGIC_VECTOR(0 TO 63);
	BRAM_EN_B : IN STD_LOGIC;
	BRAM_Dout_B : IN STD_LOGIC_VECTOR(0 TO 63);
	BRAM_Din_A : OUT STD_LOGIC_VECTOR(0 TO 63);
	BRAM_Din_B : OUT STD_LOGIC_VECTOR(0 TO 63);
	BRAM_WEN_A : IN STD_LOGIC_VECTOR(0 TO 7);
	BRAM_Clk_A : IN STD_LOGIC;
	BRAM_WEN_B : IN STD_LOGIC_VECTOR(0 TO 7);
	BRAM_Clk_B : IN STD_LOGIC;
	BRAM_Rst_A : IN STD_LOGIC;
	BRAM_Rst_B : IN STD_LOGIC;
	BRAM_Addr_A : IN STD_LOGIC_VECTOR(0 TO 31));
END bram_elaborate;

ARCHITECTURE IMP OF bram_elaborate IS

--------------------------------------------------------------------------------
COMPONENT RAMB16_S9_S9 IS
PORT (
	DIA : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
	DIB : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
	DOPA : OUT STD_LOGIC_VECTOR(0 DOWNTO 0);
	DOPB : OUT STD_LOGIC_VECTOR(0 DOWNTO 0);
	CLKA : IN STD_LOGIC;
	ADDRA : IN STD_LOGIC_VECTOR(10 DOWNTO 0);
	CLKB : IN STD_LOGIC;
	DOA : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
	ADDRB : IN STD_LOGIC_VECTOR(10 DOWNTO 0);
	ENA : IN STD_LOGIC;
	DOB : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
	ENB : IN STD_LOGIC;
	SSRA : IN STD_LOGIC;
	SSRB : IN STD_LOGIC;
	DIPA : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
	DIPB : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
	WEA : IN STD_LOGIC;
	WEB : IN STD_LOGIC);
END COMPONENT;

--------------------------------------------------------------------------------
-- internal signals
--------------------------------------------------------------------------------

	SIGNAL dina : STD_LOGIC_VECTOR(63 DOWNTO 0);

	SIGNAL dinb : STD_LOGIC_VECTOR(63 DOWNTO 0);

	SIGNAL douta : STD_LOGIC_VECTOR(63 DOWNTO 0);

	SIGNAL doutb : STD_LOGIC_VECTOR(63 DOWNTO 0);

	SIGNAL net_gnd0 : STD_LOGIC;

	SIGNAL net_gnd1 : STD_LOGIC_VECTOR(0 TO 0);

BEGIN

--------------------------------------------------------------------------------
-- Power assignments
net_gnd0 <= '0';
net_gnd1 <= "0";
--------------------------------------------------------------------------------
-- Constant assignments
--------------------------------------------------------------------------------
-- Top-level port assignments
dina <= BRAM_Dout_A;
dinb <= BRAM_Dout_B;
BRAM_Din_A <= douta;
BRAM_Din_B <= doutb;
--------------------------------------------------------------------------------
-- Lower-level assignments

--------------------------------------------------------------------------------
ramb16_s9_s9_0 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(63 DOWNTO 56),
	DIB => dinb(63 DOWNTO 56),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(63 DOWNTO 56),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(63 DOWNTO 56),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(0),
	WEB => BRAM_WEN_B(0));

--------------------------------------------------------------------------------
ramb16_s9_s9_1 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(55 DOWNTO 48),
	DIB => dinb(55 DOWNTO 48),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(55 DOWNTO 48),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(55 DOWNTO 48),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(1),
	WEB => BRAM_WEN_B(1));

--------------------------------------------------------------------------------
ramb16_s9_s9_2 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(47 DOWNTO 40),
	DIB => dinb(47 DOWNTO 40),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(47 DOWNTO 40),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(47 DOWNTO 40),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(2),
	WEB => BRAM_WEN_B(2));

--------------------------------------------------------------------------------
ramb16_s9_s9_3 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(39 DOWNTO 32),
	DIB => dinb(39 DOWNTO 32),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(39 DOWNTO 32),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(39 DOWNTO 32),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(3),
	WEB => BRAM_WEN_B(3));

--------------------------------------------------------------------------------
ramb16_s9_s9_4 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(31 DOWNTO 24),
	DIB => dinb(31 DOWNTO 24),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(31 DOWNTO 24),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(31 DOWNTO 24),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(4),
	WEB => BRAM_WEN_B(4));

--------------------------------------------------------------------------------
ramb16_s9_s9_5 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(23 DOWNTO 16),
	DIB => dinb(23 DOWNTO 16),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(23 DOWNTO 16),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(23 DOWNTO 16),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(5),
	WEB => BRAM_WEN_B(5));

--------------------------------------------------------------------------------
ramb16_s9_s9_6 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(15 DOWNTO 8),
	DIB => dinb(15 DOWNTO 8),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(15 DOWNTO 8),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(15 DOWNTO 8),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(6),
	WEB => BRAM_WEN_B(6));

--------------------------------------------------------------------------------
ramb16_s9_s9_7 : RAMB16_S9_S9
PORT MAP (
	DIA => dina(7 DOWNTO 0),
	DIB => dinb(7 DOWNTO 0),
	DOPA => open,
	DOPB => open,
	CLKA => BRAM_Clk_A,
	ADDRA => BRAM_Addr_A(18 TO 28),
	CLKB => BRAM_Clk_B,
	DOA => douta(7 DOWNTO 0),
	ADDRB => BRAM_Addr_B(18 TO 28),
	ENA => BRAM_EN_A,
	DOB => doutb(7 DOWNTO 0),
	ENB => BRAM_EN_B,
	SSRA => net_gnd0,
	SSRB => net_gnd0,
	DIPA => net_gnd1,
	DIPB => net_gnd1,
	WEA => BRAM_WEN_A(7),
	WEB => BRAM_WEN_B(7));

END ARCHITECTURE IMP;
