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/ddr2/ddr2_data_buffer.vhd,v $
00015 --* $Revision: 1.3.2.4 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:44 $ *
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 entity ddr2_data_buffer is
00040 port (
00041 CLKA : in ;
00042 CLKB : in ;
00043 RESET : in ;
00044 WEN : in ;
00045 REN : in ;
00046 EMPTY : out ;
00047 DATA_IN : in (255 downto 0);
00048 DATA_OUT : out (127 downto 0)
00049 );
00050 end ddr2_data_buffer;
00051
00052
00053 architecture ddr2_data_buffer_arc of ddr2_data_buffer is
00054 ----------------------------- signals -----------------------------
00055 signal addr_a : (6 downto 0) := (others => '0');
00056 signal addr_b : (5 downto 0) := (others => '0');
00057
00058 ---------------------------- components -----------------------------
00059
00060 component raw_buffer
00061 port (
00062 addra : in (6 downto 0);
00063 addrb : in (5 downto 0);
00064 clka : in ;
00065 clkb : in ;
00066 dinb : in (255 downto 0);
00067 douta : out (127 downto 0);
00068 ena : in ;
00069 enb : in ;
00070 web : in );
00071 end component;
00072
00073 ---------------------------- main code ----------------------------
00074 begin
00075
00076
00077 raw_data_buffer : raw_buffer
00078 port map (
00079 addra => addr_a,
00080 addrb => addr_b,
00081 clka => CLKA,
00082 clkb => CLKB,
00083 dinb => DATA_IN,
00084 douta => DATA_OUT,
00085 ena => REN ,
00086 enb => '1' ,
00087 web => WEN
00088 );
00089
00090
00091 wr_addr_gen : process(CLKB)
00092 begin
00093 if CLKB'event and CLKB = '1' then
00094 if RESET = '1' then
00095 addr_b <= (others => '0');
00096 elsif WEN = '1' then
00097 addr_b <= addr_b + 1;
00098 else
00099 addr_b <= addr_b;
00100 end if;
00101 end if;
00102 end process wr_addr_gen;
00103
00104
00105
00106
00107 rd_addr_gen : process(CLKA)
00108 variable diff_stack_point : := 0;
00109 begin
00110 if CLKA'event and CLKA = '1' then
00111 if RESET = '1' then
00112 addr_a <= (others => '0');
00113 elsif REN = '1' then
00114 addr_a <= addr_a + 1;
00115 else
00116 addr_a <= addr_a;
00117 if addr_b >= addr_a then
00118 diff_stack_point := conv_integer(addr_b - addr_a);
00119 if diff_stack_point > 10 then
00120 EMPTY <= '0';
00121 else
00122 EMPTY <= '1';
00123 end if;
00124 else
00125 EMPTY <= '0';
00126 end if;
00127 end if;
00128 end if;
00129 end process rd_addr_gen;
00130
00131 end ddr2_data_buffer_arc;
00132