ROD firmware  1.0.5
ATLAS l1-calo - ROD_eFEX and ROD_jFEX firmware for the L1Calo ROD board

Back to ROD documentation
channel_init.vhd
1 ----------------------------------------------------------------------------------
2 -- Company:
3 -- Engineer:
4 --
5 -- Create Date: 17.01.2019 18:20:31
6 -- Design Name:
7 -- Module Name: channel_init - RTL
8 -- Project Name:
9 -- Target Devices:
10 -- Tool Versions:
11 -- Description:
12 --
13 -- Dependencies:
14 --
15 -- Revision:
16 -- Revision 0.01 - File Created
17 -- Additional Comments:
18 --
19 ----------------------------------------------------------------------------------
20 
21 
22 library IEEE;
23 use IEEE.STD_LOGIC_1164.ALL;
24 
25 -- Uncomment the following library declaration if using
26 -- arithmetic functions with Signed or Unsigned values
27 --use IEEE.NUMERIC_STD.ALL;
28 
29 -- Uncomment the following library declaration if instantiating
30 -- any Xilinx leaf cells in this code.
31 --library UNISIM;
32 --use UNISIM.VComponents.all;
33 
34 entity channel_init is
35  generic (
36  jfex : integer := 0
37  );
38  Port (
39  init_clk : in STD_LOGIC;
40  chan_reg_reset : in STD_LOGIC;
41  bp_reg_reset : in STD_LOGIC;
42  master_reset : in STD_LOGIC;
43  channel_up : in STD_LOGIC;
44  error_counter_reset : in STD_LOGIC;
45  aurora_reset_out : out STD_LOGIC;
46  GT_reset : out STD_LOGIC;
47  fex_reset : out STD_LOGIC;
48  self_reset_count : out std_logic_vector(31 downto 0);
49  chan_up_time : out std_logic_vector(31 downto 0);
50  channel_down_auto_reset_disable : in std_logic
51  );
52 
53 
54 end channel_init;
55 
56 architecture RTL of channel_init is
57 
58 component aurora_reset
59 -- Port ( );
60  Port ( init_clk : in STD_LOGIC;
61  BTN0 : in STD_LOGIC;
62  rst_sw : in STD_LOGIC;
63  tx_reset : out STD_LOGIC;
64  tx_GTReset : out STD_LOGIC := '0';
65  rx_reset : out STD_LOGIC;
66  rx_GTReset : out STD_LOGIC := '0');
67 end component;
68 
69 component self_reset
70  generic
71  (
72  GAP_WIDTH : integer := 17;
73  -- width of gap counter ex; 5 makes gap of 32 cycles
74  jfex : integer := 0
75  );
76  Port (
77  clock : in STD_LOGIC;
78  channel_up : in STD_LOGIC;
79  reset_in : in STD_LOGIC; --must be the OR of other reset sources
80  aurora_reset : in STD_LOGIC;
81  error_counter_reset: in STD_LOGIC;
82  channel_down_auto_reset_disable : in STD_LOGIC;
83  reset_out : out std_logic;
84  reset_count : out std_logic_vector(31 downto 0);
85  chan_up_time : out std_logic_vector(31 downto 0)
86  );
87 end component;
88 
89 component pulse_stretch
90  generic (
91  COUNTER_WIDTH : integer := 5
92  );
93  Port (
94  clock : in STD_LOGIC;
95  reset : in STD_LOGIC;
96  pulse_in : in STD_LOGIC;
97  pulse_out : out STD_LOGIC
98 
99  );
100 end component;
101 
102 
103 signal start_seq : STD_LOGIC;
104 signal chan_good : STD_LOGIC := '0';
105 signal rx_reset : STD_LOGIC;
106 signal chan_down : STD_LOGIC := '0';
107 signal reset_in : std_logic;
108 signal reg_pulse : std_logic;
109 signal stretch_pulse : std_logic;
110 
111 begin
112 
113 reg_pulse <= chan_reg_reset or bp_reg_reset;
114 
115 stretcher : pulse_stretch
116  generic map (
117  COUNTER_WIDTH => 5
118  )
119  port map (
120  clock => init_clk,
121  reset => master_reset,
122  pulse_in => reg_pulse,
123  pulse_out => stretch_pulse
124  );
125 
126 
127 
128 --reset_in <= master_reset or chan_reg_reset or bp_reg_reset;
129 reset_in <= master_reset or stretch_pulse;
130 
131 reset_timer : aurora_reset
132  PORT MAP (
133  init_clk => init_clk,
134  BTN0 => start_seq, --'0',
135  rst_sw => '0', --start_seq,
136  tx_reset => open,
137  tx_GTReset => open,
138  rx_reset => rx_reset,
139  rx_GTReset => GT_reset
140  );
141 
142 
143 self_reset_inst : self_reset
144  Generic Map (
145  GAP_WIDTH => 20, -- width of gap counter ex; 5 makes gap of 32 cycles
146  jfex => jfex
147  )
148  PORT MAP (
149  clock => init_clk,
150  channel_up => channel_up,
151  reset_in => reset_in,
152  aurora_reset => rx_reset,
153  error_counter_reset => error_counter_reset,
154  channel_down_auto_reset_disable => channel_down_auto_reset_disable,
155  reset_out => start_seq,
156  reset_count => self_reset_count,
157  chan_up_time => chan_up_time
158  );
159 
160 
161  aurora_reset_out <= rx_reset;
162  fex_reset <= start_seq;
163 
164 
165 
166 
167 
168 -- start_seq <= chan_down or reg_reset;
169 
170 process (init_clk) begin
171  if rising_edge (init_clk) then
172  if channel_up = '1' and rx_reset = '0' then
173  chan_good <= '1';
174 -- elsif chan_good = '1' and channel_up = '0' then
175  elsif rx_reset = '0' and channel_up = '0' then
176  chan_down <= '1';
177  chan_good <= '0';
178  elsif chan_down = '1' then
179  chan_down <= '0';
180  end if;
181  end if;
182  end process;
183 
184 
185 
186 
187 end RTL;
The clock input is connected to the 125MHz ethernet clock. A Gap width of 17-bits therefore equates t...
Definition: self_reset.vhd:47