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/Attic/pmdelay.vhd,v $
00015 --* $Revision: 1.1.2.5 $ *
00016 --* $Name: dev $ *
00017 --* $Author: mniegl $ *
00018 --* $Date: 2008/11/03 17:57:45 $ *
00019
00020
00021
00022 --* *
00023 --**************************************************************
00024
00025 library ieee;
00026
00027 use ieee.std_logic_1164.all;
00028
00029 use ieee.std_logic_arith.all;
00030
00031 use ieee.std_logic_unsigned.all;
00032
00033
00034
00035
00036
00037 entity pmdelay is
00038
00039 generic (
00040 LAYOFF : range 0 to 254 := 10);
00041
00042 port (
00043 CLK : in ;
00044 RES : in ;
00045 PM_IN : in ;
00046 ORBIT : in ;
00047 PM_OUT : out
00048 );
00049
00050 end pmdelay;
00051
00052
00053
00054
00055
00056
00057
00058
00059 architecture pmdelay_arc of pmdelay is
00060
00061
00062 component edge
00063 port(
00064 CLK : in ;
00065 A : in ;
00066 PULSE : out
00067 );
00068 end component;
00069
00070 signal pm_i : := '0';
00071 signal orbit_i : := '0';
00072 signal inhib_n : := '1';
00073 signal cnt : range 0 to 255 := 255;
00074
00075 begin -- pmdelay_arc
00076
00077
00078 pulse_1 : edge
00079 port map(
00080 CLK => CLK ,
00081 A => PM_IN ,
00082 PULSE => pm_i
00083 );
00084
00085
00086 pulse_2 : edge
00087 port map(
00088 CLK => CLK ,
00089 A => ORBIT ,
00090 PULSE => orbit_i
00091 );
00092
00093
00094
00095
00096
00097 monoflop : process (CLK, RES)
00098 begin -- process monoflop
00099 if RES = '1' then -- asynchronous reset (active high)
00100 PM_OUT <= '0';
00101 inhib_n <= '1';
00102 cnt <= 255;
00103 elsif CLK'event and CLK = '1' then -- rising clock edge
00104
00105 if (pm_i and inhib_n) = '1' then
00106 cnt <= 0;
00107 inhib_n <= '0';
00108 end if;
00109
00110 if (inhib_n = '0') and (orbit_i = '1') then
00111 cnt <= cnt + 1;
00112 end if;
00113
00114 if cnt = LAYOFF then
00115 PM_OUT <= '1';
00116 inhib_n <= '1';
00117 cnt <= 255;
00118 else
00119 PM_OUT <= '0';
00120 end if;
00121
00122 end if;
00123 end process monoflop;
00124
00125 end pmdelay_arc;