00001 --**************************************************************
00002 --* *
00003 --* The source code for the ATLAS BCM "AAA" FPGA is made *
00004 --* available via the GNU General Public License (GPL) *
00005 --* unless otherwise stated below. *
00006 --* *
00007 --* In case of problems/questions/bug reports etc. please *
00008 --* contact michael.niegl@cern.ch *
00009 --* *
00010 --**************************************************************
00011
00012 --**************************************************************
00013 --* *
00014 --* $Source: /local/reps/bcmfpga/bcm_aaa/bcm_aaa/eth/ddr_eth_buf.vhd,v $ *
00015 --* $Revision: 2.2.2.4 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:46 $ *
00019
00020
00021 --* *
00022 --**************************************************************
00023
00024 library ieee;
00025
00026 use ieee.std_logic_1164.all;
00027
00028 use ieee.std_logic_arith.all;
00029
00030 use ieee.std_logic_unsigned.all;
00031
00032 use ieee.numeric_std.all;
00033
00034 library unisim;
00035
00036 use unisim.vcomponents.all;
00037
00038
00039
00040 entity ddr_eth_buf is
00041 port (
00042 CLK_WR : in ;
00043 CLK_RD : in ;
00044 RES : in ;
00045 RD : in ;
00046 WR : in ;
00047 DATA_IN : in (63 downto 0);
00048 DATA_OUT : out (7 downto 0)
00049 );
00050 end ddr_eth_buf;
00051
00052
00053
00054 architecture ddr_eth_buf_arc of ddr_eth_buf is
00055
00056 signal a_i : (8 downto 0) := (others => '0');
00057 signal b_i : (5 downto 0) := (others => '0');
00058
00059
00060 component ddreth_buf
00061 port (
00062 addra : in (8 downto 0);
00063 addrb : in (5 downto 0);
00064 clka : in ;
00065 clkb : in ;
00066 dinb : in (63 downto 0);
00067 douta : out (7 downto 0);
00068 ena : in ;
00069 enb : in ;
00070 web : in );
00071 end component;
00072
00073 begin
00074
00075
00076 wr_addr : process(CLK_WR)
00077 begin
00078 if CLK_WR'event and CLK_WR = '1' then
00079 if RES = '1' then
00080 b_i <= conv_std_logic_vector(24, 6);
00081 else
00082 if WR = '1' then
00083 if b_i = 47 then
00084 b_i <= (others => '0');
00085 else
00086 b_i <= b_i + 1;
00087 end if;
00088 else
00089 b_i <= b_i;
00090 end if;
00091 end if;
00092 end if;
00093 end process wr_addr;
00094
00095
00096 rd_addr : process(CLK_RD)
00097 begin
00098 if CLK_RD'event and CLK_RD = '1' then
00099 if RES = '1' then
00100 a_i <= (others => '0');
00101 else
00102 if RD = '1' then
00103 if a_i = 383 then
00104 a_i <= (others => '0');
00105 else
00106 a_i <= a_i + 1;
00107 end if;
00108 else
00109 a_i <= a_i;
00110 end if;
00111 end if;
00112 end if;
00113 end process rd_addr;
00114
00115
00116 bram_buf : ddreth_buf
00117 port map (
00118 addra => a_i ,
00119 addrb => b_i ,
00120 clka => CLK_RD,
00121 clkb => CLK_WR,
00122 dinb => DATA_IN,
00123 douta => DATA_OUT,
00124 ena => RD ,
00125 enb => '1' ,
00126 web => WR
00127 );
00128
00129 end ddr_eth_buf_arc;
00130