eFEX firmware  1.7.3
ATLAS l1-calo - electron and tau feature extraction firmware for eFEX boards

Back to eFEX documentation
local_bcn_counter.vhd
1 library IEEE;
2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_arith.all;
4 
5 entity local_bcn_counter is
6  port (
7  clk : in std_logic;
8  reset : in std_logic;
9  bcr : in std_logic;
10  orbit_length :in std_logic_vector ( 11 downto 0);
11  bcmux_value_sync:in std_logic_vector ( 11 downto 0);
12  bcn_cntr : out std_logic_vector ( 11 downto 0)
13  );
15 architecture Behavioral of local_bcn_counter is
16 signal counter, orbit_length_i:unsigned (11 downto 0);
17 
18 begin
19 orbit_length_i <= unsigned(orbit_length);
20 
21  bcn_counter: process (clk)
22 
23  begin
24  if clk'event AND clk = '1' then
25  if reset = '1' then -- this is a synchronous reset
26  counter <= (others => '0') ;
27  else
28  if bcr ='1' then
29  counter <= unsigned( bcmux_value_sync);
30  else
31  counter <= counter +1;
32  if counter = orbit_length_i-1 then
33  counter <= (others => '0');
34  end if;
35  end if;
36  end if ;
37  end if ;
38  end process bcn_counter;
39  bcn_cntr <= std_logic_vector( counter);
40 
41 end Behavioral;
42