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

Back to eFEX documentation
clk_closs_pulse_fsm.vhd
Go to the documentation of this file.
1 
9 
10 library IEEE;
11 use IEEE.STD_LOGIC_1164.ALL;
12 
14  Port (
15  clk_src: in std_logic;
16  rst_src: in std_logic;
17  pulse_src: in std_logic;
18  --
19  clk_dest: in std_logic;
20  pulse_dest: out std_logic
21  );
23 
24 architecture Behavioral of clk_closs_pulse_fsm is
25 
26  signal last_pulse_src: std_logic := '0'; -- signal to ensure pulse only on rising edge of incoming pulse_src
27  signal tff_src: std_logic := '0'; -- signal from source that crosses the clock domains
28  signal last_pulse_dest, true_pulse_dest: std_logic := '0'; -- signals to ensure single tick pulse on outgoing pulse_dest
29  signal tff_dest: std_logic_vector(2 downto 0) := (Others => '0'); -- async register to capture in destination
30 
31  attribute ASYNC_REG: string;
32  attribute ASYNC_REG of tff_src: signal is "TRUE";
33  attribute ASYNC_REG of tff_dest: signal is "TRUE";
34 
35 begin
36 
37 
38 u0_tff_clk_src: process(clk_src)
39  begin
40  if rising_edge(clk_src) then
41  -- infer toggle flip flop in source domain
42  if rst_src = '1' then
43  tff_src <= '0';
44  else
45  tff_src <= tff_src xor (pulse_src and not last_pulse_src);
46  end if;
47  last_pulse_src <= pulse_src;
48  end if;
49  end process u0_tff_clk_src;
50 
51 u1_tff_clk_dest: process(clk_dest)
52  begin
53  if rising_edge(clk_dest) then
54  -- pick up tff from source domain
55  tff_dest <= tff_dest(1 downto 0) & tff_src;
56  end if;
57  end process u1_tff_clk_dest;
58 
59 u2_pulse_clk_dest: process(clk_dest)
60  begin
61  if rising_edge(clk_dest) then
62  -- pulse on the toggle
63  true_pulse_dest <= (tff_dest(2) xor tff_dest(1)) and not last_pulse_dest;
64  last_pulse_dest <= true_pulse_dest;
65  end if;
66  end process u2_pulse_clk_dest;
67 
68 pulse_dest <= true_pulse_dest;
69 
70 end Behavioral;