otsdaq_prepmodernization
v2_05_02_indev
Return to top level
Main Page
Classes
Files
File List
ethernetFIFO_pkg.vhd
1
--------------------------------------------------------------------------------
2
--
3
-- FIFO Generator Core Demo Testbench
4
--
5
--------------------------------------------------------------------------------
6
--
7
-- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
8
--
9
-- This file contains confidential and proprietary information
10
-- of Xilinx, Inc. and is protected under U.S. and
11
-- international copyright and other intellectual property
12
-- laws.
13
--
14
-- DISCLAIMER
15
-- This disclaimer is not a license and does not grant any
16
-- rights to the materials distributed herewith. Except as
17
-- otherwise provided in a valid license issued to you by
18
-- Xilinx, and to the maximum extent permitted by applicable
19
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
20
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
21
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
22
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
23
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
24
-- (2) Xilinx shall not be liable (whether in contract or tort,
25
-- including negligence, or under any other theory of
26
-- liability) for any loss or damage of any kind or nature
27
-- related to, arising under or in connection with these
28
-- materials, including for any direct, or any indirect,
29
-- special, incidental, or consequential loss or damage
30
-- (including loss of data, profits, goodwill, or any type of
31
-- loss or damage suffered as a result of any action brought
32
-- by a third party) even if such damage or loss was
33
-- reasonably foreseeable or Xilinx had been advised of the
34
-- possibility of the same.
35
--
36
-- CRITICAL APPLICATIONS
37
-- Xilinx products are not designed or intended to be fail-
38
-- safe, or for use in any application requiring fail-safe
39
-- performance, such as life-support or safety devices or
40
-- systems, Class III medical devices, nuclear facilities,
41
-- applications related to the deployment of airbags, or any
42
-- other applications that could lead to death, personal
43
-- injury, or severe property or environmental damage
44
-- (individually and collectively, "Critical
45
-- Applications"). Customer assumes the sole risk and
46
-- liability of any use of Xilinx products in Critical
47
-- Applications, subject only to applicable laws and
48
-- regulations governing limitations on product liability.
49
--
50
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
51
-- PART OF THIS FILE AT ALL TIMES.
52
--------------------------------------------------------------------------------
53
--
54
-- Filename: ethernetFIFO_pkg.vhd
55
--
56
-- Description:
57
-- This is the demo testbench package file for FIFO Generator core.
58
--
59
--------------------------------------------------------------------------------
60
-- Library Declarations
61
--------------------------------------------------------------------------------
62
LIBRARY
IEEE
;
63
USE
IEEE.STD_LOGIC_1164.
ALL
;
64
USE
ieee.std_logic_arith.
ALL
;
65
USE
IEEE.STD_LOGIC_UNSIGNED.
ALL
;
66
67
PACKAGE
ethernetFIFO_pkg
IS
68
69
FUNCTION
divroundup (
70
data_value :
INTEGER
;
71
divisor :
INTEGER
)
72
RETURN
INTEGER
;
73
------------------------
74
FUNCTION
if_then_else (
75
condition :
BOOLEAN
;
76
true_case :
INTEGER
;
77
false_case :
INTEGER
)
78
RETURN
INTEGER
;
79
------------------------
80
FUNCTION
if_then_else (
81
condition :
BOOLEAN
;
82
true_case :
STD_LOGIC
;
83
false_case :
STD_LOGIC
)
84
RETURN
STD_LOGIC
;
85
------------------------
86
FUNCTION
if_then_else (
87
condition :
BOOLEAN
;
88
true_case :
TIME
;
89
false_case :
TIME
)
90
RETURN
TIME
;
91
------------------------
92
FUNCTION
log2roundup (
93
data_value :
INTEGER
)
94
RETURN
INTEGER
;
95
------------------------
96
FUNCTION
hexstr_to_std_logic_vec(
97
arg1 :
string
;
98
size :
integer
)
99
RETURN
std_logic_vector
;
100
------------------------
101
COMPONENT
ethernetFIFO_rng
IS
102
GENERIC
(WIDTH :
integer
:=
8
;
103
SEED :
integer
:=
3
);
104
PORT
(
105
CLK :
IN
STD_LOGIC
;
106
RESET :
IN
STD_LOGIC
;
107
ENABLE :
IN
STD_LOGIC
;
108
RANDOM_NUM :
OUT
STD_LOGIC_VECTOR
(WIDTH
-
1
DOWNTO
0
)
109
);
110
END
COMPONENT
;
111
------------------------
112
113
COMPONENT
ethernetFIFO_dgen
IS
114
GENERIC
(
115
C_DIN_WIDTH :
INTEGER
:=
32
;
116
C_DOUT_WIDTH :
INTEGER
:=
32
;
117
C_CH_TYPE :
INTEGER
:=
0
;
118
TB_SEED :
INTEGER
:=
2
119
);
120
PORT
(
121
RESET :
IN
STD_LOGIC
;
122
WR_CLK :
IN
STD_LOGIC
;
123
PRC_WR_EN :
IN
STD_LOGIC
;
124
FULL :
IN
STD_LOGIC
;
125
WR_EN :
OUT
STD_LOGIC
;
126
WR_DATA :
OUT
STD_LOGIC_VECTOR
(C_DIN_WIDTH
-
1
DOWNTO
0
)
127
);
128
END
COMPONENT
;
129
------------------------
130
131
COMPONENT
ethernetFIFO_dverif
IS
132
GENERIC
(
133
C_DIN_WIDTH :
INTEGER
:=
0
;
134
C_DOUT_WIDTH :
INTEGER
:=
0
;
135
C_USE_EMBEDDED_REG :
INTEGER
:=
0
;
136
C_CH_TYPE :
INTEGER
:=
0
;
137
TB_SEED :
INTEGER
:=
2
138
);
139
PORT
(
140
RESET :
IN
STD_LOGIC
;
141
RD_CLK :
IN
STD_LOGIC
;
142
PRC_RD_EN :
IN
STD_LOGIC
;
143
EMPTY :
IN
STD_LOGIC
;
144
DATA_OUT :
IN
STD_LOGIC_VECTOR
(C_DOUT_WIDTH
-
1
DOWNTO
0
);
145
RD_EN :
OUT
STD_LOGIC
;
146
DOUT_CHK :
OUT
STD_LOGIC
147
);
148
END
COMPONENT
;
149
------------------------
150
151
COMPONENT
ethernetFIFO_pctrl
IS
152
GENERIC
(
153
AXI_CHANNEL :
STRING
:=
"NONE"
;
154
C_APPLICATION_TYPE :
INTEGER
:=
0
;
155
C_DIN_WIDTH :
INTEGER
:=
0
;
156
C_DOUT_WIDTH :
INTEGER
:=
0
;
157
C_WR_PNTR_WIDTH :
INTEGER
:=
0
;
158
C_RD_PNTR_WIDTH :
INTEGER
:=
0
;
159
C_CH_TYPE :
INTEGER
:=
0
;
160
FREEZEON_ERROR :
INTEGER
:=
0
;
161
TB_STOP_CNT :
INTEGER
:=
2
;
162
TB_SEED :
INTEGER
:=
2
163
);
164
PORT
(
165
RESET_WR :
IN
STD_LOGIC
;
166
RESET_RD :
IN
STD_LOGIC
;
167
WR_CLK :
IN
STD_LOGIC
;
168
RD_CLK :
IN
STD_LOGIC
;
169
FULL :
IN
STD_LOGIC
;
170
EMPTY :
IN
STD_LOGIC
;
171
ALMOST_FULL :
IN
STD_LOGIC
;
172
ALMOST_EMPTY :
IN
STD_LOGIC
;
173
DATA_IN :
IN
STD_LOGIC_VECTOR
(C_DIN_WIDTH
-
1
DOWNTO
0
);
174
DATA_OUT :
IN
STD_LOGIC_VECTOR
(C_DOUT_WIDTH
-
1
DOWNTO
0
);
175
DOUT_CHK :
IN
STD_LOGIC
;
176
PRC_WR_EN :
OUT
STD_LOGIC
;
177
PRC_RD_EN :
OUT
STD_LOGIC
;
178
RESET_EN :
OUT
STD_LOGIC
;
179
SIM_DONE :
OUT
STD_LOGIC
;
180
STATUS :
OUT
STD_LOGIC_VECTOR
(
7
DOWNTO
0
)
181
);
182
END
COMPONENT
;
183
------------------------
184
COMPONENT
ethernetFIFO_synth
IS
185
GENERIC
(
186
FREEZEON_ERROR :
INTEGER
:=
0
;
187
TB_STOP_CNT :
INTEGER
:=
0
;
188
TB_SEED :
INTEGER
:=
1
189
);
190
PORT
(
191
WR_CLK :
IN
STD_LOGIC
;
192
RD_CLK :
IN
STD_LOGIC
;
193
RESET :
IN
STD_LOGIC
;
194
SIM_DONE :
OUT
STD_LOGIC
;
195
STATUS :
OUT
STD_LOGIC_VECTOR
(
7
DOWNTO
0
)
196
);
197
END
COMPONENT
;
198
------------------------
199
COMPONENT
ethernetFIFO_exdes
IS
200
PORT
(
201
WR_CLK :
IN
std_logic
;
202
RD_CLK :
IN
std_logic
;
203
RST :
IN
std_logic
;
204
PROG_EMPTY :
OUT
std_logic
;
205
WR_EN :
IN
std_logic
;
206
RD_EN :
IN
std_logic
;
207
DIN :
IN
std_logic_vector
(
32-1
DOWNTO
0
);
208
DOUT :
OUT
std_logic_vector
(
128-1
DOWNTO
0
);
209
FULL :
OUT
std_logic
;
210
EMPTY :
OUT
std_logic
);
211
212
END
COMPONENT
;
213
------------------------
214
215
216
END
ethernetFIFO_pkg
;
217
218
219
220
PACKAGE
BODY
_ethernetFIFO_pkg
IS
221
222
FUNCTION
divroundup (
223
data_value :
INTEGER
;
224
divisor :
INTEGER
)
225
RETURN
INTEGER
IS
226
VARIABLE
div :
INTEGER
;
227
BEGIN
228
div := data_value/divisor;
229
IF
(
(
data_value
MOD
divisor
)
/=
0
)
THEN
230
div := div+
1
;
231
END
IF
;
232
RETURN
div;
233
END
divroundup;
234
---------------------------------
235
FUNCTION
if_then_else (
236
condition :
BOOLEAN
;
237
true_case :
INTEGER
;
238
false_case :
INTEGER
)
239
RETURN
INTEGER
IS
240
VARIABLE
retval :
INTEGER
:=
0
;
241
BEGIN
242
IF
condition=false
THEN
243
retval:=false_case;
244
ELSE
245
retval:=true_case;
246
END
IF
;
247
RETURN
retval;
248
END
if_then_else;
249
---------------------------------
250
FUNCTION
if_then_else (
251
condition :
BOOLEAN
;
252
true_case :
STD_LOGIC
;
253
false_case :
STD_LOGIC
)
254
RETURN
STD_LOGIC
IS
255
VARIABLE
retval :
STD_LOGIC
:= '
0
';
256
BEGIN
257
IF
condition=false
THEN
258
retval:=false_case;
259
ELSE
260
retval:=true_case;
261
END
IF
;
262
RETURN
retval;
263
END
if_then_else;
264
---------------------------------
265
FUNCTION
if_then_else (
266
condition :
BOOLEAN
;
267
true_case :
TIME
;
268
false_case :
TIME
)
269
RETURN
TIME
IS
270
VARIABLE
retval :
TIME
:=
0
ps;
271
BEGIN
272
IF
condition=false
THEN
273
retval:=false_case;
274
ELSE
275
retval:=true_case;
276
END
IF
;
277
RETURN
retval;
278
END
if_then_else;
279
-------------------------------
280
FUNCTION
log2roundup (
281
data_value :
INTEGER
)
282
RETURN
INTEGER
IS
283
284
VARIABLE
width :
INTEGER
:=
0
;
285
VARIABLE
cnt :
INTEGER
:=
1
;
286
BEGIN
287
IF
(
data_value <=
1
)
THEN
288
width :=
1
;
289
ELSE
290
WHILE
(
cnt < data_value
)
LOOP
291
width := width +
1
;
292
cnt := cnt *
2
;
293
END
LOOP
;
294
END
IF
;
295
296
RETURN
width;
297
END
log2roundup;
298
------------------------------------------------------------------------------
299
-- hexstr_to_std_logic_vec
300
-- This function converts a hex string to a std_logic_vector
301
------------------------------------------------------------------------------
302
FUNCTION
hexstr_to_std_logic_vec(
303
arg1 :
string
;
304
size :
integer
)
305
RETURN
std_logic_vector
IS
306
VARIABLE
result :
std_logic_vector
(
size-
1
DOWNTO
0
)
:=
(
OTHERS
=> '
0
'
)
;
307
VARIABLE
bin :
std_logic_vector
(
3
DOWNTO
0
)
;
308
VARIABLE
index :
integer
:=
0
;
309
BEGIN
310
FOR
i
IN
arg1'reverse_range
LOOP
311
CASE
arg1
(
i
)
IS
312
WHEN
'
0
' => bin :=
(
OTHERS
=> '
0
'
)
;
313
WHEN
'
1
' => bin :=
(
0
=> '
1
',
OTHERS
=> '
0
'
)
;
314
WHEN
'
2
' => bin :=
(
1
=> '
1
',
OTHERS
=> '
0
'
)
;
315
WHEN
'
3
' => bin :=
(
0
=> '
1
',
1
=> '
1
',
OTHERS
=> '
0
'
)
;
316
WHEN
'
4
' => bin :=
(
2
=> '
1
',
OTHERS
=> '
0
'
)
;
317
WHEN
'
5
' => bin :=
(
0
=> '
1
',
2
=> '
1
',
OTHERS
=> '
0
'
)
;
318
WHEN
'
6
' => bin :=
(
1
=> '
1
',
2
=> '
1
',
OTHERS
=> '
0
'
)
;
319
WHEN
'
7
' => bin :=
(
3
=> '
0
',
OTHERS
=> '
1
'
)
;
320
WHEN
'
8
' => bin :=
(
3
=> '
1
',
OTHERS
=> '
0
'
)
;
321
WHEN
'
9
' => bin :=
(
0
=> '
1
',
3
=> '
1
',
OTHERS
=> '
0
'
)
;
322
WHEN
'A' => bin :=
(
0
=> '
0
',
2
=> '
0
',
OTHERS
=> '
1
'
)
;
323
WHEN
'a' => bin :=
(
0
=> '
0
',
2
=> '
0
',
OTHERS
=> '
1
'
)
;
324
WHEN
'B' => bin :=
(
2
=> '
0
',
OTHERS
=> '
1
'
)
;
325
WHEN
'b' => bin :=
(
2
=> '
0
',
OTHERS
=> '
1
'
)
;
326
WHEN
'C' => bin :=
(
0
=> '
0
',
1
=> '
0
',
OTHERS
=> '
1
'
)
;
327
WHEN
'c' => bin :=
(
0
=> '
0
',
1
=> '
0
',
OTHERS
=> '
1
'
)
;
328
WHEN
'D' => bin :=
(
1
=> '
0
',
OTHERS
=> '
1
'
)
;
329
WHEN
'd' => bin :=
(
1
=> '
0
',
OTHERS
=> '
1
'
)
;
330
WHEN
'E' => bin :=
(
0
=> '
0
',
OTHERS
=> '
1
'
)
;
331
WHEN
'e' => bin :=
(
0
=> '
0
',
OTHERS
=> '
1
'
)
;
332
WHEN
'F' => bin :=
(
OTHERS
=> '
1
'
)
;
333
WHEN
'f' => bin :=
(
OTHERS
=> '
1
'
)
;
334
WHEN
OTHERS
=>
335
FOR
j
IN
0
TO
3
LOOP
336
bin
(
j
)
:= 'X';
337
END
LOOP
;
338
END
CASE
;
339
FOR
j
IN
0
TO
3
LOOP
340
IF
(
index*
4
)
+j < size
THEN
341
result
(
(
index*
4
)
+j
)
:= bin
(
j
)
;
342
END
IF
;
343
END
LOOP
;
344
index := index +
1
;
345
END
LOOP
;
346
RETURN
result;
347
END
hexstr_to_std_logic_vec;
348
349
END
ethernetFIFO_pkg
;
ethernetFIFO_pctrl
Definition:
ethernetFIFO_pctrl.vhd:72
ethernetFIFO_rng
Definition:
ethernetFIFO_rng.vhd:68
ethernetFIFO_dgen
Definition:
ethernetFIFO_dgen.vhd:71
ethernetFIFO_synth
Definition:
ethernetFIFO_synth.vhd:80
ethernetFIFO_dverif
Definition:
ethernetFIFO_dverif.vhd:71
ethernetFIFO_exdes
Definition:
ethernetFIFO_exdes.vhd:74
otsdaq_prepmodernization
firmware
g-2
KickerControllerFirmware
GEL_CAPTAN
ipcore_dir
ethernetFIFO
simulation
ethernetFIFO_pkg.vhd
Generated on Wed Apr 29 2020 18:41:41 for otsdaq_prepmodernization by
1.8.5