Belle II KLM Scint Firmware
1
tx_ll_datapath.vhd
1
-- (c) Copyright 2008 Xilinx, Inc. All rights reserved.
2
--
3
-- This file contains confidential and proprietary information
4
-- of Xilinx, Inc. and is protected under U.S. and
5
-- international copyright and other intellectual property
6
-- laws.
7
--
8
-- DISCLAIMER
9
-- This disclaimer is not a license and does not grant any
10
-- rights to the materials distributed herewith. Except as
11
-- otherwise provided in a valid license issued to you by
12
-- Xilinx, and to the maximum extent permitted by applicable
13
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
14
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
15
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
16
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
17
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
18
-- (2) Xilinx shall not be liable (whether in contract or tort,
19
-- including negligence, or under any other theory of
20
-- liability) for any loss or damage of any kind or nature
21
-- related to, arising under or in connection with these
22
-- materials, including for any direct, or any indirect,
23
-- special, incidental, or consequential loss or damage
24
-- (including loss of data, profits, goodwill, or any type of
25
-- loss or damage suffered as a result of any action brought
26
-- by a third party) even if such damage or loss was
27
-- reasonably foreseeable or Xilinx had been advised of the
28
-- possibility of the same.
29
--
30
-- CRITICAL APPLICATIONS
31
-- Xilinx products are not designed or intended to be fail-
32
-- safe, or for use in any application requiring fail-safe
33
-- performance, such as life-support or safety devices or
34
-- systems, Class III medical devices, nuclear facilities,
35
-- applications related to the deployment of airbags, or any
36
-- other applications that could lead to death, personal
37
-- injury, or severe property or environmental damage
38
-- (individually and collectively, "Critical
39
-- Applications"). Customer assumes the sole risk and
40
-- liability of any use of Xilinx products in Critical
41
-- Applications, subject only to applicable laws and
42
-- regulations governing limitations on product liability.
43
--
44
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
45
-- PART OF THIS FILE AT ALL TIMES.
46
--
47
--
48
49
--
50
-- TX_LL_DATAPATH
51
--
52
--
53
-- Description: This module pipelines the data path while handling the PAD
54
-- character placement and valid data flags.
55
--
56
-- This module supports 1 2-byte lane designs
57
--
58
59
library
IEEE
;
60
use
IEEE.STD_LOGIC_1164.
all
;
61
62
entity
TX_LL_DATAPATH
is
63
port
(
64
-- LocalLink PDU Interface
65
TX_D
:
in
std_logic_vector
(
0
to
15
)
;
66
TX_REM
:
in
std_logic
;
67
TX_SRC_RDY_N
:
in
std_logic
;
68
TX_SOF_N
:
in
std_logic
;
69
TX_EOF_N
:
in
std_logic
;
70
-- Aurora Lane Interface
71
TX_PE_DATA_V
:
out
std_logic
;
72
GEN_PAD
:
out
std_logic
;
73
TX_PE_DATA
:
out
std_logic_vector
(
0
to
15
)
;
74
-- TX_LL Control Module Interface
75
HALT_C
:
in
std_logic
;
76
TX_DST_RDY_N
:
in
std_logic
;
77
-- System Interface
78
CHANNEL_UP
:
in
std_logic
;
79
USER_CLK
:
in
std_logic
)
;
80
end
TX_LL_DATAPATH
;
81
82
architecture
RTL
of
TX_LL_DATAPATH
is
83
84
-- Parameter Declarations --
85
86
constant
DLY
:
time
:=
1
ns
;
87
88
-- External Register Declarations --
89
90
signal
TX_PE_DATA_V_Buffer
:
std_logic
;
91
signal
GEN_PAD_Buffer
:
std_logic
;
92
signal
TX_PE_DATA_Buffer
:
std_logic_vector
(
0
to
15
)
;
93
94
-- Internal Register Declarations --
95
96
signal
in_frame_r
:
std_logic
;
97
signal
storage_r
:
std_logic_vector
(
0
to
15
)
;
98
signal
storage_v_r
:
std_logic
;
99
signal
storage_pad_r
:
std_logic
;
100
signal
tx_pe_data_r
:
std_logic_vector
(
0
to
15
)
;
101
signal
valid_c
:
std_logic
;
102
signal
tx_pe_data_v_r
:
std_logic
;
103
signal
gen_pad_c
:
std_logic
;
104
signal
gen_pad_r
:
std_logic
;
105
106
-- Internal Wire Declarations --
107
108
signal
ll_valid_c
:
std_logic
;
109
signal
in_frame_c
:
std_logic
;
110
111
begin
112
113
TX_PE_DATA_V
<=
TX_PE_DATA_V_Buffer
;
114
GEN_PAD
<=
GEN_PAD_Buffer
;
115
TX_PE_DATA
<=
TX_PE_DATA_Buffer
;
116
117
-- Main Body of Code --
118
119
120
121
-- LocalLink input is only valid when TX_SRC_RDY_N and TX_DST_RDY_N are both asserted
122
ll_valid_c
<=
not
TX_SRC_RDY_N
and
not
TX_DST_RDY_N
;
123
124
125
-- Data must only be read if it is within a frame. If a frame will last multiple cycles
126
-- we assert in_frame_r as long as the frame is open.
127
process
(USER_CLK)
128
begin
129
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
130
if
(
CHANNEL_UP
=
'
0
'
)
then
131
in_frame_r
<=
'
0
'
after
DLY
;
132
elsif
(
ll_valid_c
=
'
1
'
)
then
133
if
(
(
TX_SOF_N
=
'
0
'
)
and
(
TX_EOF_N
=
'
1
'
)
)
then
134
in_frame_r
<=
'
1
'
after
DLY
;
135
elsif
(
TX_EOF_N
=
'
0
'
)
then
136
in_frame_r
<=
'
0
'
after
DLY
;
137
end
if
;
138
end
if
;
139
end
if
;
140
end
process
;
141
142
143
in_frame_c
<=
ll_valid_c
and
(
in_frame_r
or
not
TX_SOF_N
)
;
144
145
146
147
148
149
-- The data from the LocalLink interface must be delayed one cycle to
150
-- make room for the SCP code group in the channel.
151
152
process
(USER_CLK)
153
154
begin
155
156
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
157
158
if
(
HALT_C
=
'
0
'
)
then
159
160
storage_r
<=
TX_D
after
DLY
;
161
162
end
if
;
163
164
end
if
;
165
166
end
process
;
167
168
169
-- This pipeline register aligns the data with the control path.
170
171
process
(USER_CLK)
172
173
begin
174
175
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
176
177
if
(
HALT_C
=
'
0
'
)
then
178
179
tx_pe_data_r
<=
storage_r
after
DLY
;
180
181
end
if
;
182
183
end
if
;
184
185
end
process
;
186
187
188
-- We generate the valid_c signal based on the REM signal and the EOF signal.
189
190
process
(TX_EOF_N, TX_REM)
191
192
begin
193
194
if
(
TX_EOF_N
=
'
1
'
)
then
195
196
valid_c
<=
'
1
'
;
197
198
else
199
200
case
TX_REM
is
201
202
when
'
0
'
=
>
valid_c
<=
'
1
'
;
203
when
'
1
'
=
>
valid_c
<=
'
1
'
;
204
when
others
=
>
valid_c
<=
'
1
'
;
205
206
end
case
;
207
208
end
if
;
209
210
end
process
;
211
212
213
-- If the word is valid, it is placed in the storage register and storage_v_r is
214
-- asserted to indicate the data is valid. Note that data is only moved to storage
215
-- if the PDU datapath is not halted, the data is valid and both TX_SRC_RDY_N and
216
-- TX_DST_RDY_N are asserted.
217
218
process
(USER_CLK)
219
220
begin
221
222
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
223
224
if
(
HALT_C
=
'
0
'
)
then
225
226
storage_v_r
<=
valid_c
and
in_frame_c
after
DLY
;
227
228
end
if
;
229
230
end
if
;
231
232
end
process
;
233
234
235
-- Register the tx_pe_data_valid signal. All data is moved from the storage register
236
-- to the tx_pe_data register for transmission when the datapath is not halted. If the
237
-- storage register contains valid PDU data, the tx_pe_data register is marked as
238
-- containing valid PDU data
239
240
process
(USER_CLK)
241
242
begin
243
244
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
245
246
if
(
HALT_C
=
'
0
'
)
then
247
248
tx_pe_data_v_r
<=
storage_v_r
after
DLY
;
249
250
end
if
;
251
252
end
if
;
253
254
end
process
;
255
256
257
-- We generate the gen_pad_c signal based on the REM signal and the EOF signal.
258
259
process
(TX_EOF_N, TX_REM)
260
261
begin
262
263
if
(
TX_EOF_N
=
'
1
'
)
then
264
265
gen_pad_c
<=
'
0
'
;
266
267
else
268
269
case
TX_REM
is
270
271
when
'
0
'
=
>
gen_pad_c
<=
'
1
'
;
272
when
'
1
'
=
>
gen_pad_c
<=
'
0
'
;
273
when
others
=
>
gen_pad_c
<=
'
0
'
;
274
275
end
case
;
276
277
end
if
;
278
279
end
process
;
280
281
282
-- Store padded data when padded and TX_SRC_RDY_N and TX_DST_RDY_N are both asserted.
283
284
process
(USER_CLK)
285
286
begin
287
288
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
289
290
if
(
HALT_C
=
'
0
'
)
then
291
292
storage_pad_r
<=
gen_pad_c
and
in_frame_c
after
DLY
;
293
294
end
if
;
295
296
end
if
;
297
298
end
process
;
299
300
301
-- Register the gen_pad signal.
302
303
process
(USER_CLK)
304
305
begin
306
307
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
308
309
if
(
HALT_C
=
'
0
'
)
then
310
311
gen_pad_r
<=
storage_pad_r
after
DLY
;
312
313
end
if
;
314
315
end
if
;
316
317
end
process
;
318
319
320
-- Implement the data out register.
321
322
process
(USER_CLK)
323
324
begin
325
326
if
(
USER_CLK
'
event
and
USER_CLK
=
'
1
'
)
then
327
328
TX_PE_DATA_Buffer
<=
tx_pe_data_r
after
DLY
;
329
TX_PE_DATA_V_Buffer
<=
tx_pe_data_v_r
and
not
HALT_C
after
DLY
;
330
GEN_PAD_Buffer
<=
gen_pad_r
and
not
HALT_C
after
DLY
;
331
332
end
if
;
333
334
end
process
;
335
336
337
end
RTL
;
TX_LL_DATAPATH
Definition:
tx_ll_datapath.vhd:62
klm_aurora
source
tx_ll_datapath.vhd
Generated by
1.8.13