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/ORBIT_cnt.vhd,v $
00015 --* $Revision: 1.8.2.3 $ *
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
00032
00033
00034
00035 entity ORBIT_cnt is
00036 port (
00037 RESET : in ;
00038 CLK : in ;
00039 ORBIT : in ;
00040 ORBIT_LOAD_EN : in ;
00041 ORBIT_LOAD : in (31 downto 0);
00042 START_RUN : in ;
00043 CNT_ORBIT : out (31 downto 0));
00044 end ORBIT_cnt;
00045
00046
00047
00048
00049
00050 architecture ORBIT_cnt_arc of ORBIT_cnt is
00051
00052 signal cnt_i : (31 downto 0) := (others => '0');
00053 signal orb : := '0';
00054 component edge is
00055 port (CLK : in ;
00056 A : in ;
00057 PULSE : out );
00058 end component;
00059
00060 begin
00061
00062 CNT_ORBIT <= cnt_i;
00063
00064
00065 orb_edge : edge
00066 port map (
00067 CLK => CLK ,
00068 A => ORBIT ,
00069 PULSE => orb
00070 );
00071
00072
00073 cnt : process(CLK)
00074 begin
00075 if CLK'event and CLK = '1' then
00076 if (START_RUN or RESET) = '1' then
00077 cnt_i <= (others => '0');
00078 elsif ORBIT_LOAD_EN = '1' then
00079 cnt_i <= ORBIT_LOAD;
00080 elsif orb = '1' then
00081 cnt_i <= cnt_i + 1;
00082 else
00083 cnt_i <= cnt_i;
00084 end if;
00085 end if;
00086 end process;
00087
00088 end ORBIT_cnt_arc;
00089