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

Back to eFEX documentation
tac_sm.vhd
Go to the documentation of this file.
1 
8 
9 library IEEE;
10 use IEEE.STD_LOGIC_1164.ALL;
11 USE ieee.std_logic_arith.all;
12 LIBRARY xil_defaultlib;
13 
15 entity tac_sm is
16  Port (
18  clk_280M : IN std_logic;
20  reset : IN std_logic;
22  TTC_CLK_edge : IN std_logic;
24  MGT_Commadet : IN std_logic;
26  Start : IN std_logic;
27  --rx reset done
28  rx_resetdone : IN std_logic;
30  Reg_enable : OUT std_logic;
32  Mux_Value :OUT std_logic_vector (3 DOWNTO 0)
33 
34  );
35 end tac_sm;
37 ARCHITECTURE fsm OF tac_sm IS
38 
39 signal delay_count:unsigned (3 downto 0);
40 
41  TYPE STATE_TYPE IS (
42  idle, wt_rstdone, wt_comma, wt_ttc_redge
43  );
44 
45  SIGNAL current_state : STATE_TYPE;
46 
47 
48 BEGIN
49 
50  -----------------------------------------------------------------
51  clocked_proc : PROCESS (
52  clk_280M
53  )
54  -----------------------------------------------------------------
55  BEGIN
56  IF (clk_280M'EVENT AND clk_280M = '1') THEN
57  IF (reset = '1') THEN
58  current_state <= idle;
59  -- Default Reset Values
60  mux_value <= (others => '0');
61  reg_enable <= '0';
62  delay_count <= (others => '0');
63  ELSE
64  -- Default Assignment To Internals and Outputs
65  delay_count <= (others => '0');
66  mux_value <= (others => '0');
67  reg_enable <= '0';
68 
69  -- Combined Actions
70  CASE current_state IS
71  WHEN idle =>
72  IF (start ='1') THEN
73  current_state <= wt_rstdone;
74  ELSE
75  current_state <= idle;
76  END IF;
77  WHEN wt_rstdone =>
78  IF (rx_resetdone ='1') THEN
79  current_state <= wt_comma;
80  ELSE
81  current_state <= wt_rstdone;
82  END IF;
83  WHEN wt_comma =>
84  IF (TTC_CLK_edge = '1' and MGT_Commadet ='1') THEN
85  delay_count <= (others=>'0');
86  reg_enable <= '1';
87  current_state <= idle;
88  ELSIF (MGT_Commadet ='1') THEN
89  delay_count <= delay_count+1;
90  current_state <= wt_ttc_redge;
91  ELSE
92  current_state <= wt_comma;
93  END IF;
94  WHEN wt_ttc_redge =>
95  delay_count <= delay_count+1;
96  IF (TTC_CLK_edge ='1') THEN
97  delay_count <= (others =>'0');
98  mux_value <= std_logic_vector(delay_count);
99  reg_enable <= '1';
100  current_state <= idle;
101  ELSE
102  current_state <= wt_ttc_redge;
103  END IF;
104  WHEN OTHERS =>
105  current_state <= idle;
106  END CASE;
107  END IF;
108  END IF;
109  END PROCESS clocked_proc;
110 
111 
112 END fsm;
First Stage state machine.
Definition: tac_sm.vhd:37
First Stage state machine.
Definition: tac_sm.vhd:15
in reset std_logic
reset
Definition: tac_sm.vhd:20
out Mux_Value std_logic_vector( 3 DOWNTO 0)
delay count
Definition: tac_sm.vhd:34
in MGT_Commadet std_logic
MGT commadet.
Definition: tac_sm.vhd:24
out Reg_enable std_logic
enable
Definition: tac_sm.vhd:30
in TTC_CLK_edge std_logic
raising edge of TTC clock of 40NHz
Definition: tac_sm.vhd:22
in clk_280M std_logic
MGT rx clock of 280MHz for process and 160MHz for control.
Definition: tac_sm.vhd:18
in Start std_logic
start of synchronisation
Definition: tac_sm.vhd:26