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/div/bcm_signal_delay_vec.vhd,v $
00015 --* $Revision: 1.3.2.4 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:45 $ *
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 library work;
00032 use work.main_components.all;
00033
00034 library unisim;
00035
00036 use unisim.vcomponents.all;
00037
00038
00039 entity bcm_signal_delay_vec is
00040 port (
00041 CLK : in ;
00042 SCLR : in ;
00043 delay_setting : in (7 downto 0);
00044 data_input : in (31 downto 0);
00045 data_output : out (31 downto 0)
00046 );
00047 end bcm_signal_delay_vec;
00048
00049
00050 architecture bcm_signal_delay_vec_arc of bcm_signal_delay_vec is
00051
00052 signal we, rde : := '0';
00053 signal addra, addrb, diff : (7 downto 0) := (others => '0');
00054
00055
00056 component shift_reg
00057 port (
00058 addra : in (7 downto 0);
00059 addrb : in (7 downto 0);
00060 clka : in ;
00061 clkb : in ;
00062 dina : in (31 downto 0);
00063 doutb : out (31 downto 0);
00064 ena : in ;
00065 enb : in ;
00066 wea : in );
00067 end component;
00068
00069 begin
00070
00071 we <= not SCLR;
00072 rde <= not SCLR;
00073
00074
00075
00076 wr_addr : process (CLK, SCLR)
00077 begin -- process wr_addr
00078 if SCLR = '1' then -- asynchronous reset (active high)
00079 addra <= (others => '0');
00080 elsif CLK'event and CLK = '1' then -- rising clock edge
00081 addra <= addra + 1;
00082 end if;
00083 end process wr_addr;
00084
00085 diff <= "00000001" when delay_setting = "00000000" else
00086 "11111110" when delay_setting = "11111111" else
00087 delay_setting;
00088
00089 -- purpose: generate cyclic read address with offset
00090 -- type : sequential
00091 rd_addr : process (CLK, SCLR)
00092 begin -- process rd_addr
00093 if SCLR = '1' then -- asynchronous reset (active high)
00094 addrb <= (others => '0');
00095 elsif CLK'event and CLK = '1' then -- rising clock edge
00096 addrb <= addra - diff;
00097 end if;
00098 end process rd_addr;
00099
00100 bram_shift_reg : shift_reg
00101 port map (
00102 addra => addra,
00103 addrb => addrb,
00104 clka => CLK ,
00105 clkb => CLK ,
00106 dina => data_input,
00107 doutb => data_output,
00108 ena => '1' ,
00109 enb => rde ,
00110 wea => we
00111 );
00112
00113 end bcm_signal_delay_vec_arc;