Belle II KLM Scint Firmware
1
rx_ll_pdu_datapath.vhd
1
-------------------------------------------------------------------------------
2
-- (c) Copyright 2008 Xilinx, Inc. All rights reserved.
3
--
4
-- This file contains confidential and proprietary information
5
-- of Xilinx, Inc. and is protected under U.S. and
6
-- international copyright and other intellectual property
7
-- laws.
8
--
9
-- DISCLAIMER
10
-- This disclaimer is not a license and does not grant any
11
-- rights to the materials distributed herewith. Except as
12
-- otherwise provided in a valid license issued to you by
13
-- Xilinx, and to the maximum extent permitted by applicable
14
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
15
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
16
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
17
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
18
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
19
-- (2) Xilinx shall not be liable (whether in contract or tort,
20
-- including negligence, or under any other theory of
21
-- liability) for any loss or damage of any kind or nature
22
-- related to, arising under or in connection with these
23
-- materials, including for any direct, or any indirect,
24
-- special, incidental, or consequential loss or damage
25
-- (including loss of data, profits, goodwill, or any type of
26
-- loss or damage suffered as a result of any action brought
27
-- by a third party) even if such damage or loss was
28
-- reasonably foreseeable or Xilinx had been advised of the
29
-- possibility of the same.
30
--
31
-- CRITICAL APPLICATIONS
32
-- Xilinx products are not designed or intended to be fail-
33
-- safe, or for use in any application requiring fail-safe
34
-- performance, such as life-support or safety devices or
35
-- systems, Class III medical devices, nuclear facilities,
36
-- applications related to the deployment of airbags, or any
37
-- other applications that could lead to death, personal
38
-- injury, or severe property or environmental damage
39
-- (individually and collectively, "Critical
40
-- Applications"). Customer assumes the sole risk and
41
-- liability of any use of Xilinx products in Critical
42
-- Applications, subject only to applicable laws and
43
-- regulations governing limitations on product liability.
44
--
45
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
46
-- PART OF THIS FILE AT ALL TIMES.
47
--
48
--
49
-------------------------------------------------------------------------------
50
--
51
-- RX_LL_PDU_DATAPATH
52
--
53
--
54
-- Description: the RX_LL_PDU_DATAPATH module takes regular PDU data in Aurora format
55
-- and transforms it to LocalLink formatted data
56
--
57
-- This module supports 1 2-byte lane designs
58
--
59
--
60
61
library
IEEE
;
62
use
IEEE.STD_LOGIC_1164.
all
;
63
use
IEEE.STD_LOGIC_ARITH.
all
;
64
use
IEEE.STD_LOGIC_UNSIGNED.
all
;
65
use
WORK.
AURORA_PKG
.
all
;
66
67
entity
RX_LL_PDU_DATAPATH
is
68
port
(
69
-- Traffic Separator Interface
70
PDU_DATA
:
in
std_logic_vector
(
0
to
15
)
;
71
PDU_DATA_V
:
in
std_logic
;
72
PDU_PAD
:
in
std_logic
;
73
PDU_SCP
:
in
std_logic
;
74
PDU_ECP
:
in
std_logic
;
75
-- LocalLink PDU Interface
76
RX_D
:
out
std_logic_vector
(
0
to
15
)
;
77
RX_REM
:
out
std_logic
;
78
RX_SRC_RDY_N
:
out
std_logic
;
79
RX_SOF_N
:
out
std_logic
;
80
RX_EOF_N
:
out
std_logic
;
81
-- Error Interface
82
FRAME_ERR
:
out
std_logic
;
83
-- System Interface
84
USER_CLK
:
in
std_logic
;
85
RESET
:
in
std_logic
)
;
86
end
RX_LL_PDU_DATAPATH
;
87
88
89
architecture
RTL
of
RX_LL_PDU_DATAPATH
is
90
91
--****************************Parameter Declarations**************************
92
93
constant
DLY
:
time
:=
1
ns
;
94
95
96
--****************************External Register Declarations**************************
97
98
signal
RX_D_Buffer
:
std_logic_vector
(
0
to
15
)
;
99
signal
RX_REM_Buffer
:
std_logic
;
100
signal
RX_SRC_RDY_N_Buffer
:
std_logic
;
101
signal
RX_SOF_N_Buffer
:
std_logic
;
102
signal
RX_EOF_N_Buffer
:
std_logic
;
103
signal
FRAME_ERR_Buffer
:
std_logic
;
104
105
106
--****************************Internal Register Declarations**************************
107
signal
storage_r
:
std_logic_vector
(
0
to
15
)
;
108
signal
storage_v_r
:
std_logic
;
109
signal
in_frame_r
:
std_logic
;
110
signal
sof_in_storage_r
:
std_logic
;
111
signal
pad_in_storage_r
:
std_logic
;
112
113
114
115
116
--*********************************Wire Declarations**********************************
117
signal
src_rdy_n_c
:
std_logic
;
118
signal
storage_ce_c
:
std_logic
;
119
120
121
122
begin
123
124
--*********************************Main Body of Code**********************************
125
126
-- VHDL Helper Logic
127
RX_D
<=
RX_D_Buffer
;
128
RX_REM
<=
RX_REM_Buffer
;
129
RX_SRC_RDY_N
<=
RX_SRC_RDY_N_Buffer
;
130
RX_SOF_N
<=
RX_SOF_N_Buffer
;
131
RX_EOF_N
<=
RX_EOF_N_Buffer
;
132
FRAME_ERR
<=
FRAME_ERR_Buffer
;
133
134
135
136
137
--All input goes into a storage register before it is sent on to the output
138
process
(USER_CLK)
139
begin
140
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
141
if
(
storage_ce_c
=
'
1
'
)
then
142
storage_r
<=
PDU_DATA
after
DLY
;
143
end
if
;
144
end
if
;
145
end
process
;
146
147
148
--Keep track of whether or not there is data in storage
149
process
(USER_CLK)
150
begin
151
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
152
if
(
RESET
=
'
1
'
)
then
153
storage_v_r
<=
'
0
'
after
DLY
;
154
elsif
(
storage_ce_c
=
'
1
'
)
then
155
storage_v_r
<=
'
1
'
after
DLY
;
156
elsif
(
storage_v_r
=
'
1
'
)
then
157
storage_v_r
<=
src_rdy_n_c
after
DLY
;
158
end
if
;
159
end
if
;
160
end
process
;
161
162
163
--Output data is registered
164
process
(USER_CLK)
165
begin
166
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
167
RX_D_Buffer
<=
storage_r
after
DLY
;
168
end
if
;
169
end
process
;
170
171
172
--Assert the SRC_RDY_N signal when there is data in storage and incomiming data or the
173
-- end of a frame
174
src_rdy_n_c
<=
not
(
storage_v_r
and
(
storage_ce_c
or
PDU_ECP
)
)
;
175
176
177
--Register the SRC_RDY_N signal
178
process
(USER_CLK)
179
begin
180
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
181
if
(
RESET
=
'
1
'
)
then
182
RX_SRC_RDY_N_Buffer
<=
'
1
'
after
DLY
;
183
else
184
RX_SRC_RDY_N_Buffer
<=
src_rdy_n_c
after
DLY
;
185
end
if
;
186
end
if
;
187
end
process
;
188
189
190
--Load data into storage when there is valid incoming data
191
storage_ce_c
<=
in_frame_r
and
PDU_DATA_V
;
192
193
194
--Data is in a frame when it is preceded by an SOF followed by any number of non-ecp characters
195
process
(USER_CLK)
196
begin
197
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
198
if
(
RESET
=
'
1
'
)
then
199
in_frame_r
<=
'
0
'
after
DLY
;
200
elsif
(
PDU_SCP
=
'
1
'
)
then
201
in_frame_r
<=
'
1
'
after
DLY
;
202
elsif
(
PDU_ECP
=
'
1
'
)
then
203
in_frame_r
<=
'
0
'
after
DLY
;
204
end
if
;
205
end
if
;
206
end
process
;
207
208
209
--Hold start of frame until it can be asserted with data
210
process
(USER_CLK)
211
begin
212
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
213
if
(
PDU_SCP
=
'
1
'
)
then
214
sof_in_storage_r
<=
'
1
'
after
DLY
;
215
elsif
(
sof_in_storage_r
=
'
1
'
)
then
216
sof_in_storage_r
<=
src_rdy_n_c
after
DLY
;
217
end
if
;
218
end
if
;
219
end
process
;
220
221
222
--Register sof_in_storage for use on the LocalLink Interface
223
process
(USER_CLK)
224
begin
225
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
226
RX_SOF_N_Buffer
<=
not
sof_in_storage_r
after
DLY
;
227
end
if
;
228
end
process
;
229
230
231
--Register eof for use on the LocalLink Interface
232
process
(USER_CLK)
233
begin
234
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
235
RX_EOF_N_Buffer
<=
not
PDU_ECP
after
DLY
;
236
end
if
;
237
end
process
;
238
239
240
241
--Store the pad signal for any data that gets moved into storage
242
process
(USER_CLK)
243
begin
244
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
245
if
(
storage_ce_c
=
'
1
'
)
then
246
pad_in_storage_r
<=
PDU_PAD
after
DLY
;
247
end
if
;
248
end
if
;
249
end
process
;
250
251
252
--Register the pad signal for use on the LocalLink inteface
253
process
(USER_CLK)
254
begin
255
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
256
RX_REM_Buffer
<=
not
pad_in_storage_r
after
DLY
;
257
end
if
;
258
end
process
;
259
260
261
--Indicate a frame error when a start arrives inframe, and end arrives out
262
-- of frame, or an end arrives with no data in storage, indicating an empty
263
-- frame
264
process
(USER_CLK)
265
begin
266
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
267
FRAME_ERR_Buffer
<=
(
PDU_SCP
and
in_frame_r
)
or
268
(
PDU_ECP
and
not
in_frame_r
)
or
269
(
PDU_ECP
and
not
storage_v_r
)
after
DLY
;
270
end
if
;
271
end
process
;
272
273
274
275
276
end
RTL
;
277
278
RX_LL_PDU_DATAPATH
Definition:
rx_ll_pdu_datapath.vhd:67
AURORA_PKG
Definition:
aurora_pkg.vhd:60
klm_aurora
source
rx_ll_pdu_datapath.vhd
Generated by
1.8.13