otsdaq_prepmodernization
v2_05_02_indev
Return to top level
Main Page
Classes
Files
File List
ethernet_FIFO_dverif.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: ethernet_FIFO_dverif.vhd
55
--
56
-- Description:
57
-- Used for FIFO read interface stimulus generation and data checking
58
--
59
--------------------------------------------------------------------------------
60
-- Library Declarations
61
--------------------------------------------------------------------------------
62
LIBRARY
ieee
;
63
USE
ieee.std_logic_1164.
ALL
;
64
USE
ieee.std_logic_unsigned.
all
;
65
USE
IEEE.std_logic_arith.
all
;
66
USE
IEEE.std_logic_misc.
all
;
67
68
LIBRARY
work
;
69
USE
work.ethernet_FIFO_pkg.
ALL
;
70
71
ENTITY
ethernet_FIFO_dverif
IS
72
GENERIC
(
73
C_DIN_WIDTH
:
INTEGER
:=
0
;
74
C_DOUT_WIDTH
:
INTEGER
:=
0
;
75
C_USE_EMBEDDED_REG
:
INTEGER
:=
0
;
76
C_CH_TYPE
:
INTEGER
:=
0
;
77
TB_SEED
:
INTEGER
:=
2
78
)
;
79
PORT
(
80
RESET
:
IN
STD_LOGIC
;
81
RD_CLK
:
IN
STD_LOGIC
;
82
PRC_RD_EN
:
IN
STD_LOGIC
;
83
EMPTY
:
IN
STD_LOGIC
;
84
DATA_OUT
:
IN
STD_LOGIC_VECTOR
(
C_DOUT_WIDTH
-
1
DOWNTO
0
)
;
85
RD_EN
:
OUT
STD_LOGIC
;
86
DOUT_CHK
:
OUT
STD_LOGIC
87
)
;
88
END
ENTITY
;
89
90
91
ARCHITECTURE
fg_dv_arch
OF
ethernet_FIFO_dverif
IS
92
93
CONSTANT
C_DATA_WIDTH
:
INTEGER
:=
if_then_else
(
C_DIN_WIDTH
>
C_DOUT_WIDTH
,
C_DIN_WIDTH
,
C_DOUT_WIDTH
)
;
94
CONSTANT
EXTRA_WIDTH
:
INTEGER
:=
if_then_else
(
C_CH_TYPE
=
2
,
1
,
0
)
;
95
CONSTANT
LOOP_COUNT
:
INTEGER
:=
divroundup
(
C_DATA_WIDTH
+
EXTRA_WIDTH
,
8
)
;
96
97
SIGNAL
expected_dout
:
STD_LOGIC_VECTOR
(
C_DOUT_WIDTH
-
1
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
98
SIGNAL
data_chk
:
STD_LOGIC
:=
'
1
'
;
99
SIGNAL
rand_num
:
STD_LOGIC_VECTOR
(
8
*
LOOP_COUNT
-
1
downto
0
)
;
100
SIGNAL
rd_en_i
:
STD_LOGIC
:=
'
0
'
;
101
SIGNAL
pr_r_en
:
STD_LOGIC
:=
'
0
'
;
102
SIGNAL
rd_en_d1
:
STD_LOGIC
:=
'
0
'
;
103
BEGIN
104
105
106
DOUT_CHK
<=
data_chk
;
107
RD_EN
<=
rd_en_i
;
108
rd_en_i
<=
PRC_RD_EN
;
109
110
111
data_fifo_chk
:
IF
(
C_CH_TYPE
/=
2
)
GENERATE
112
-------------------------------------------------------
113
-- Expected data generation and checking for data_fifo
114
-------------------------------------------------------
115
PROCESS
(RD_CLK,RESET)
116
BEGIN
117
IF
(
RESET
=
'
1
'
)
THEN
118
rd_en_d1
<=
'
0
'
;
119
ELSIF
(
RD_CLK
'
event
AND
RD_CLK
=
'
1
'
)
THEN
120
IF
(
EMPTY
=
'
0
'
AND
rd_en_i
=
'
1
'
AND
rd_en_d1
=
'
0
'
)
THEN
121
rd_en_d1
<=
'
1
'
;
122
END
IF
;
123
END
IF
;
124
END
PROCESS
;
125
126
pr_r_en
<=
rd_en_i
AND
NOT
EMPTY
AND
rd_en_d1
;
127
expected_dout
<=
rand_num
(
C_DOUT_WIDTH
-
1
DOWNTO
0
)
;
128
129
gen_num
:
FOR
N
IN
LOOP_COUNT
-
1
DOWNTO
0
GENERATE
130
rd_gen_inst2:
ethernet_FIFO_rng
131
GENERIC
MAP
(
132
WIDTH =>
8
,
133
SEED => TB_SEED+N
134
)
135
PORT
MAP
(
136
CLK => RD_CLK,
137
RESET => RESET,
138
RANDOM_NUM => rand_num
(
8*
(
N+1
)
-
1
downto
8*N
)
,
139
ENABLE => pr_r_en
140
)
;
141
END
GENERATE
;
142
143
PROCESS
(RD_CLK,RESET)
144
BEGIN
145
IF
(
RESET
=
'
1
'
)
THEN
146
data_chk
<=
'
0
'
;
147
ELSIF
(
RD_CLK
'
event
AND
RD_CLK
=
'
1
'
)
THEN
148
IF
(
(
EMPTY
=
'
0
'
)
AND
(
rd_en_i
=
'
1
'
AND
rd_en_d1
=
'
1
'
)
)
THEN
149
IF
(
DATA_OUT
=
expected_dout
)
THEN
150
data_chk
<=
'
0
'
;
151
ELSE
152
data_chk
<=
'
1
'
;
153
END
IF
;
154
END
IF
;
155
END
IF
;
156
END
PROCESS
;
157
END
GENERATE
data_fifo_chk
;
158
159
END
ARCHITECTURE
;
ethernet_FIFO_dverif
Definition:
ethernet_FIFO_dverif.vhd:71
ethernet_FIFO_rng
Definition:
ethernet_FIFO_rng.vhd:68
otsdaq_prepmodernization
firmware
g-2
KickerControllerFirmware
GEL_CAPTAN
ipcore_dir
ethernet_FIFO
simulation
ethernet_FIFO_dverif.vhd
Generated on Wed Apr 29 2020 18:41:41 for otsdaq_prepmodernization by
1.8.5