ROD firmware
1.0.5
ATLAS l1-calo - ROD_eFEX and ROD_jFEX firmware for the L1Calo ROD board
Back to ROD documentation
ROD
packet_processor
hdl
self_reset.vhd
1
----------------------------------------------------------------------------------
2
-- Company:
3
-- Engineer:
4
--
5
-- Create Date: 18.01.2019 16:38:54
6
-- Design Name:
7
-- Module Name: self_reset - 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
use
IEEE.STD_LOGIC_UNSIGNED.
ALL
;
25
26
27
-- Uncomment the following library declaration if using
28
-- arithmetic functions with Signed or Unsigned values
29
--use IEEE.NUMERIC_STD.ALL;
30
31
-- Uncomment the following library declaration if instantiating
32
-- any Xilinx leaf cells in this code.
33
--library UNISIM;
34
--use UNISIM.VComponents.all;
35
41
45
46
47
entity
self_reset
is
48
generic
49
(
50
GAP_WIDTH
:
integer
:=
17
;
-- width of gap counter ex; 5 makes gap of 32 cycles
51
jfex
:
integer
:=
0
52
)
;
53
Port
(
54
clock
:
in
STD_LOGIC
;
55
channel_up
:
in
STD_LOGIC
;
56
reset_in
:
in
STD_LOGIC
;
--must be the OR of other reset sources
57
aurora_reset
:
in
STD_LOGIC
;
58
error_counter_reset
:
in
STD_LOGIC
;
59
channel_down_auto_reset_disable
:
in
STD_LOGIC
;
60
reset_out
:
out
std_logic
;
61
reset_count
:
out
std_logic_vector
(
31
downto
0
)
;
62
chan_up_time
:
out
std_logic_vector
(
31
downto
0
)
63
)
;
64
end
self_reset
;
65
66
architecture
RTL
of
self_reset
is
67
68
69
70
71
COMPONENT
ila_self_reset
72
73
PORT
(
74
clk :
IN
STD_LOGIC
;
75
probe0 :
IN
STD_LOGIC_VECTOR
(
0
DOWNTO
0
);
76
probe1 :
IN
STD_LOGIC_VECTOR
(
0
DOWNTO
0
);
77
probe2 :
IN
STD_LOGIC_VECTOR
(
0
DOWNTO
0
);
78
probe3 :
IN
STD_LOGIC_VECTOR
(
0
DOWNTO
0
);
79
probe4 :
IN
STD_LOGIC_VECTOR
(
0
DOWNTO
0
);
80
probe5 :
IN
STD_LOGIC_VECTOR
(
19
DOWNTO
0
)
81
);
82
END
COMPONENT
;
83
84
85
signal
channel_up_delay
:
std_logic
;
86
--signal start_waiting : std_logic;
87
signal
reset_pulse
:
std_logic
:=
'
0
'
;
88
signal
gap_count
:
STD_LOGIC_VECTOR
(
GAP_WIDTH
-
1
downto
0
)
:=
(
others
=
>
'
0
'
)
;
89
signal
gap_limit
:
STD_LOGIC_VECTOR
(
GAP_WIDTH
-
1
downto
0
)
:=
(
others
=
>
'
1
'
)
;
90
signal
reset_pulse2
:
std_logic
:=
'
0
'
;
91
signal
reset_pulse3
:
std_logic
:=
'
0
'
;
92
signal
reset_count_i
:
STD_LOGIC_VECTOR
(
31
downto
0
)
;
93
signal
chan_up_timer
:
STD_LOGIC_VECTOR
(
31
downto
0
)
;
94
95
begin
96
97
98
gap_limit
<=
(
others
=
>
'
1
'
)
;
99
100
--detect falling channel_up link goes down
101
-- when detected, start waiting is a pulse that starts the delay timer.
102
103
process
(clock)
begin
104
if
rising_edge
(
clock
)
then
105
if
(
channel_down_auto_reset_disable
=
'
0
'
)
and
(
(
channel_up_delay
=
'
1
'
and
channel_up
=
'
0
'
)
or
(
channel_up
=
'
0
'
and
(
gap_count
=
gap_limit
)
)
)
then
106
reset_pulse
<=
'
1
'
;
107
elsif
reset_pulse
=
'
1
'
or
reset_in
=
'
1
'
then
108
reset_pulse
<=
'
0
'
;
109
else
110
reset_pulse
<=
reset_pulse
;
111
end
if
;
112
end
if
;
113
end
process
;
114
115
process
(clock)
begin
116
if
rising_edge
(
clock
)
then
117
reset_pulse2
<=
reset_pulse
;
118
reset_pulse3
<=
reset_pulse2
;
119
end
if
;
120
121
end
process
;
122
123
124
125
126
127
process
(clock)
begin
128
if
rising_edge
(
clock
)
then
129
channel_up_delay
<=
channel_up
;
130
end
if
;
131
end
process
;
132
133
134
135
--gap count
136
process
(clock)
begin
137
if
rising_edge
(
clock
)
then
138
if
(
reset_in
=
'
1
'
)
or
(
aurora_reset
=
'
1
'
)
or
(
channel_up
=
'
1
'
)
then
139
gap_count
<=
(
others
=
>
'
0
'
)
;
140
elsif
(
reset_in
=
'
0
'
)
and
(
channel_up
=
'
0
'
)
and
(
aurora_reset
=
'
0
'
)
then
141
gap_count
<=
gap_count
+
1
;
142
else
gap_count
<=
gap_count
;
143
end
if
;
144
end
if
;
145
end
process
;
146
147
148
--count the number of Aurora Resets
149
process
(clock)
begin
150
if
rising_edge
(
clock
)
then
151
if
(
reset_in
=
'
1
'
)
or
(
error_counter_reset
=
'
1
'
)
then
152
reset_count_i
<=
(
others
=
>
'
0
'
)
;
153
elsif
(
reset_pulse2
=
'
1
'
)
then
154
reset_count_i
<=
(
reset_count_i
+
1
)
;
155
else
156
reset_count_i
<=
reset_count_i
;
157
end
if
;
158
end
if
;
159
end
process
;
160
161
reset_count
<=
reset_count_i
;
162
163
------measure aurora reset time: reset falling to channel_up rising (this is for checking jfex)
164
165
process
(clock)
begin
166
if
rising_edge
(
clock
)
then
167
if
(
aurora_reset
=
'
1
'
)
then
168
chan_up_timer
<=
(
others
=
>
'
0
'
)
;
169
elsif
(
channel_up
=
'
1
'
)
then
170
chan_up_timer
<=
chan_up_timer
;
171
else
172
chan_up_timer
<=
chan_up_timer
+
1
;
173
end
if
;
174
end
if
;
175
end
process
;
176
chan_up_time
<=
chan_up_timer
;
177
178
179
--temporarily disable auto reset --------------------
180
--now re-enabled 25/01/2021
181
182
--kill_rst: if jfex =1 generate
183
-- reset_out <= reset_in;
184
--end generate kill_rst;
185
186
--slf_rst: if jfex =0 generate
187
reset_out
<=
reset_pulse2
or
reset_pulse3
or
reset_in
;
188
--end generate slf_rst;
189
190
191
--ila_self_rst: ila_self_reset
192
--port map (
193
-- clk => clock,
194
-- probe0(0) => channel_up,
195
-- probe1(0) => aurora_reset,
196
-- probe2(0) => reset_pulse2,
197
-- probe3(0) => reset_pulse3,
198
-- probe4(0) => reset_in,
199
---- probe5(19 downto 17) => "000",
200
-- probe5(19 downto 0) => gap_count
201
--);
202
203
204
205
end
RTL;
self_reset.RTL
Definition:
self_reset.vhd:66
self_reset
The clock input is connected to the 125MHz ethernet clock. A Gap width of 17-bits therefore equates t...
Definition:
self_reset.vhd:47
Generated on Sat Dec 14 2024 13:33:14 for ROD firmware by
1.9.1