otsdaq_prepmodernization
v2_05_02_indev
Return to top level
Main Page
Classes
Files
File List
bmg_stim_gen.vhd
1
2
3
4
--------------------------------------------------------------------------------
5
--
6
-- BLK MEM GEN v7_3 Core - Stimulus Generator For Simple Dual Port RAM
7
--
8
--------------------------------------------------------------------------------
9
--
10
-- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved.
11
--
12
-- This file contains confidential and proprietary information
13
-- of Xilinx, Inc. and is protected under U.S. and
14
-- international copyright and other intellectual property
15
-- laws.
16
--
17
-- DISCLAIMER
18
-- This disclaimer is not a license and does not grant any
19
-- rights to the materials distributed herewith. Except as
20
-- otherwise provided in a valid license issued to you by
21
-- Xilinx, and to the maximum extent permitted by applicable
22
-- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
23
-- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
24
-- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
25
-- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
26
-- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
27
-- (2) Xilinx shall not be liable (whether in contract or tort,
28
-- including negligence, or under any other theory of
29
-- liability) for any loss or damage of any kind or nature
30
-- related to, arising under or in connection with these
31
-- materials, including for any direct, or any indirect,
32
-- special, incidental, or consequential loss or damage
33
-- (including loss of data, profits, goodwill, or any type of
34
-- loss or damage suffered as a result of any action brought
35
-- by a third party) even if such damage or loss was
36
-- reasonably foreseeable or Xilinx had been advised of the
37
-- possibility of the same.
38
--
39
-- CRITICAL APPLICATIONS
40
-- Xilinx products are not designed or intended to be fail-
41
-- safe, or for use in any application requiring fail-safe
42
-- performance, such as life-support or safety devices or
43
-- systems, Class III medical devices, nuclear facilities,
44
-- applications related to the deployment of airbags, or any
45
-- other applications that could lead to death, personal
46
-- injury, or severe property or environmental damage
47
-- (individually and collectively, "Critical
48
-- Applications"). Customer assumes the sole risk and
49
-- liability of any use of Xilinx products in Critical
50
-- Applications, subject only to applicable laws and
51
-- regulations governing limitations on product liability.
52
--
53
-- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
54
-- PART OF THIS FILE AT ALL TIMES.
55
56
--------------------------------------------------------------------------------
57
--
58
-- Filename: bmg_stim_gen.vhd
59
--
60
-- Description:
61
-- Stimulus Generation For SDP Configuration
62
-- 100 Writes and 100 Reads will be performed in a repeatitive loop till the
63
-- simulation ends
64
--
65
--------------------------------------------------------------------------------
66
-- Author: IP Solutions Division
67
--
68
-- History: Sep 12, 2011 - First Release
69
--------------------------------------------------------------------------------
70
--
71
--------------------------------------------------------------------------------
72
-- Library Declarations
73
--------------------------------------------------------------------------------
74
LIBRARY
IEEE
;
75
USE
IEEE.STD_LOGIC_1164.
ALL
;
76
USE
IEEE.STD_LOGIC_ARITH.
ALL
;
77
USE
IEEE.STD_LOGIC_UNSIGNED.
ALL
;
78
USE
IEEE.STD_LOGIC_MISC.
ALL
;
79
80
LIBRARY
work
;
81
USE
work.ALL
;
82
USE
work.BMG_TB_PKG.
ALL
;
83
84
85
ENTITY
REGISTER_LOGIC
IS
86
PORT
(
87
Q
:
OUT
STD_LOGIC
;
88
CLK
:
IN
STD_LOGIC
;
89
RST
:
IN
STD_LOGIC
;
90
D
:
IN
STD_LOGIC
91
)
;
92
END
REGISTER_LOGIC
;
93
94
ARCHITECTURE
REGISTER_ARCH
OF
REGISTER_LOGIC
IS
95
SIGNAL
Q_O
:
STD_LOGIC
:=
'
0
'
;
96
BEGIN
97
Q
<=
Q_O
;
98
FF_BEH:
PROCESS
(CLK)
99
BEGIN
100
IF
(
RISING_EDGE
(
CLK
)
)
THEN
101
IF
(
RST
=
'
1
'
)
THEN
102
Q_O
<=
'
0
'
;
103
ELSE
104
Q_O
<=
D
;
105
END
IF
;
106
END
IF
;
107
END
PROCESS
;
108
END
REGISTER_ARCH
;
109
110
LIBRARY
IEEE
;
111
USE
IEEE.STD_LOGIC_1164.
ALL
;
112
USE
IEEE.STD_LOGIC_ARITH.
ALL
;
113
USE
IEEE.STD_LOGIC_UNSIGNED.
ALL
;
114
USE
IEEE.STD_LOGIC_MISC.
ALL
;
115
116
LIBRARY
work
;
117
USE
work.ALL
;
118
USE
work.BMG_TB_PKG.
ALL
;
119
120
121
ENTITY
BMG_STIM_GEN
IS
122
PORT
(
123
CLKA
:
IN
STD_LOGIC
;
124
CLKB
:
IN
STD_LOGIC
;
125
TB_RST
:
IN
STD_LOGIC
;
126
ADDRA
:
OUT
STD_LOGIC_VECTOR
(
9
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
127
DINA
:
OUT
STD_LOGIC_VECTOR
(
31
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
128
WEA
:
OUT
STD_LOGIC_VECTOR
(
0
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
129
ADDRB
:
OUT
STD_LOGIC_VECTOR
(
9
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
130
CHECK_DATA
:
OUT
STD_LOGIC
:=
'
0
'
131
)
;
132
END
BMG_STIM_GEN
;
133
134
135
ARCHITECTURE
BEHAVIORAL
OF
BMG_STIM_GEN
IS
136
137
CONSTANT
ZERO
:
STD_LOGIC_VECTOR
(
31
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
138
SIGNAL
WRITE_ADDR
:
STD_LOGIC_VECTOR
(
31
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
139
SIGNAL
READ_ADDR
:
STD_LOGIC_VECTOR
(
31
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
140
SIGNAL
DINA_INT
:
STD_LOGIC_VECTOR
(
31
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
141
SIGNAL
DO_WRITE
:
STD_LOGIC
:=
'
0
'
;
142
SIGNAL
DO_READ
:
STD_LOGIC
:=
'
0
'
;
143
SIGNAL
DO_READ_R
:
STD_LOGIC
:=
'
0
'
;
144
SIGNAL
DO_READ_REG
:
STD_LOGIC_VECTOR
(
5
DOWNTO
0
)
:=
(
OTHERS
=
>
'
0
'
)
;
145
SIGNAL
PORTA_WR
:
STD_LOGIC
:=
'
0
'
;
146
SIGNAL
COUNT
:
INTEGER
:=
0
;
147
SIGNAL
INCR_WR_CNT
:
STD_LOGIC
:=
'
0
'
;
148
SIGNAL
PORTA_WR_COMPLETE
:
STD_LOGIC
:=
'
0
'
;
149
SIGNAL
PORTB_RD
:
STD_LOGIC
:=
'
0
'
;
150
SIGNAL
COUNT_RD
:
INTEGER
:=
0
;
151
SIGNAL
INCR_RD_CNT
:
STD_LOGIC
:=
'
0
'
;
152
SIGNAL
PORTB_RD_COMPLETE
:
STD_LOGIC
:=
'
0
'
;
153
SIGNAL
LATCH_PORTA_WR_COMPLETE
:
STD_LOGIC
:=
'
0
'
;
154
SIGNAL
PORTB_RD_HAPPENED
:
STD_LOGIC
:=
'
0
'
;
155
SIGNAL
PORTA_WR_L1
:
STD_LOGIC
:=
'
0
'
;
156
SIGNAL
PORTA_WR_L2
:
STD_LOGIC
:=
'
0
'
;
157
SIGNAL
PORTB_RD_R2
:
STD_LOGIC
:=
'
0
'
;
158
SIGNAL
PORTB_RD_R1
:
STD_LOGIC
:=
'
0
'
;
159
SIGNAL
LATCH_PORTB_RD_COMPLETE
:
STD_LOGIC
:=
'
0
'
;
160
SIGNAL
PORTA_WR_HAPPENED
:
STD_LOGIC
:=
'
0
'
;
161
SIGNAL
PORTB_RD_L1
:
STD_LOGIC
:=
'
0
'
;
162
SIGNAL
PORTB_RD_L2
:
STD_LOGIC
:=
'
0
'
;
163
SIGNAL
PORTA_WR_R2
:
STD_LOGIC
:=
'
0
'
;
164
SIGNAL
PORTA_WR_R1
:
STD_LOGIC
:=
'
0
'
;
165
166
CONSTANT
WR_RD_DEEP_COUNT
:
INTEGER
:=
8
;
167
CONSTANT
WR_DEEP_COUNT
:
INTEGER
:=
if_then_else
(
(
10
<=
10
)
,
WR_RD_DEEP_COUNT
,
168
(
(
32
/
32
)
*
WR_RD_DEEP_COUNT
)
)
;
169
CONSTANT
RD_DEEP_COUNT
:
INTEGER
:=
if_then_else
(
(
10
<=
10
)
,
WR_RD_DEEP_COUNT
,
170
(
(
32
/
32
)
*
WR_RD_DEEP_COUNT
)
)
;
171
172
BEGIN
173
174
ADDRA
<=
WRITE_ADDR
(
9
DOWNTO
0
)
;
175
DINA
<=
DINA_INT
;
176
ADDRB
<=
READ_ADDR
(
9
DOWNTO
0
)
when
(
DO_READ
=
'
1
'
)
else
(
OTHERS
=
>
'
0
'
)
;
177
CHECK_DATA
<=
DO_READ
;
178
179
RD_ADDR_GEN_INST:
ENTITY
work.
ADDR_GEN
180
GENERIC
MAP
(
181
C_MAX_DEPTH =>
1024
,
182
RST_INC =>
1
)
183
PORT
MAP
(
184
CLK => CLKB,
185
RST => TB_RST,
186
EN => DO_READ ,
187
LOAD => '0',
188
LOAD_VALUE => ZERO,
189
ADDR_OUT => READ_ADDR
190
)
;
191
192
WR_ADDR_GEN_INST:
ENTITY
work.
ADDR_GEN
193
GENERIC
MAP
(
194
C_MAX_DEPTH =>
1024
,
195
RST_INC =>
1
)
196
PORT
MAP
(
197
CLK => CLKA,
198
RST => TB_RST,
199
EN => DO_WRITE ,
200
LOAD => '0',
201
LOAD_VALUE => ZERO,
202
ADDR_OUT => WRITE_ADDR
203
)
;
204
205
WR_DATA_GEN_INST:
ENTITY
work.
DATA_GEN
206
GENERIC
MAP
(
207
DATA_GEN_WIDTH =>
32
,
208
DOUT_WIDTH =>
32
,
209
DATA_PART_CNT =>
1
,
210
SEED =>
2
)
211
PORT
MAP
(
212
CLK => CLKA,
213
RST => TB_RST,
214
EN => DO_WRITE ,
215
DATA_OUT => DINA_INT
216
)
;
217
218
219
PORTA_WR_PROCESS:
PROCESS
(CLKA)
220
BEGIN
221
IF
(
RISING_EDGE
(
CLKA
)
)
THEN
222
IF
(
TB_RST
=
'
1
'
)
THEN
223
PORTA_WR
<=
'
1
'
;
224
ELSE
225
PORTA_WR
<=
PORTB_RD_COMPLETE
;
226
END
IF
;
227
END
IF
;
228
END
PROCESS
;
229
230
PORTB_RD_PROCESS:
PROCESS
(CLKB)
231
BEGIN
232
IF
(
RISING_EDGE
(
CLKB
)
)
THEN
233
IF
(
TB_RST
=
'
1
'
)
THEN
234
PORTB_RD
<=
'
0
'
;
235
ELSE
236
PORTB_RD
<=
PORTA_WR_L2
;
237
END
IF
;
238
END
IF
;
239
END
PROCESS
;
240
241
PORTB_RD_COMPLETE_LATCH:
PROCESS
(CLKB)
242
BEGIN
243
IF
(
RISING_EDGE
(
CLKB
)
)
THEN
244
IF
(
TB_RST
=
'
1
'
)
THEN
245
LATCH_PORTB_RD_COMPLETE
<=
'
0
'
;
246
ELSIF
(
PORTB_RD_COMPLETE
=
'
1
'
)
THEN
247
LATCH_PORTB_RD_COMPLETE
<=
'
1
'
;
248
ELSIF
(
PORTA_WR_HAPPENED
=
'
1
'
)
THEN
249
LATCH_PORTB_RD_COMPLETE
<=
'
0
'
;
250
END
IF
;
251
END
IF
;
252
END
PROCESS
;
253
254
PROCESS
(CLKA)
255
BEGIN
256
IF
(
RISING_EDGE
(
CLKA
)
)
THEN
257
IF
(
TB_RST
=
'
1
'
)
THEN
258
PORTB_RD_L1
<=
'
0
'
;
259
PORTB_RD_L2
<=
'
0
'
;
260
ELSE
261
PORTB_RD_L1
<=
LATCH_PORTB_RD_COMPLETE
;
262
PORTB_RD_L2
<=
PORTB_RD_L1
;
263
END
IF
;
264
END
IF
;
265
END
PROCESS
;
266
267
PROCESS
(CLKB)
268
BEGIN
269
IF
(
RISING_EDGE
(
CLKB
)
)
THEN
270
IF
(
TB_RST
=
'
1
'
)
THEN
271
PORTA_WR_R1
<=
'
0
'
;
272
PORTA_WR_R2
<=
'
0
'
;
273
ELSE
274
PORTA_WR_R1
<=
PORTA_WR
;
275
PORTA_WR_R2
<=
PORTA_WR_R1
;
276
END
IF
;
277
END
IF
;
278
END
PROCESS
;
279
280
PORTA_WR_HAPPENED
<=
PORTA_WR_R2
;
281
282
PORTA_WR_COMPLETE_LATCH:
PROCESS
(CLKA)
283
BEGIN
284
IF
(
RISING_EDGE
(
CLKA
)
)
THEN
285
IF
(
TB_RST
=
'
1
'
)
THEN
286
LATCH_PORTA_WR_COMPLETE
<=
'
0
'
;
287
ELSIF
(
PORTA_WR_COMPLETE
=
'
1
'
)
THEN
288
LATCH_PORTA_WR_COMPLETE
<=
'
1
'
;
289
--ELSIF(PORTB_RD_HAPPENED='1') THEN
290
ELSE
291
LATCH_PORTA_WR_COMPLETE
<=
'
0
'
;
292
END
IF
;
293
END
IF
;
294
END
PROCESS
;
295
296
PROCESS
(CLKB)
297
BEGIN
298
IF
(
RISING_EDGE
(
CLKB
)
)
THEN
299
IF
(
TB_RST
=
'
1
'
)
THEN
300
PORTA_WR_L1
<=
'
0
'
;
301
PORTA_WR_L2
<=
'
0
'
;
302
ELSE
303
PORTA_WR_L1
<=
LATCH_PORTA_WR_COMPLETE
;
304
PORTA_WR_L2
<=
PORTA_WR_L1
;
305
END
IF
;
306
END
IF
;
307
END
PROCESS
;
308
309
PROCESS
(CLKA)
310
BEGIN
311
IF
(
RISING_EDGE
(
CLKA
)
)
THEN
312
IF
(
TB_RST
=
'
1
'
)
THEN
313
PORTB_RD_R1
<=
'
0
'
;
314
PORTB_RD_R2
<=
'
0
'
;
315
ELSE
316
PORTB_RD_R1
<=
PORTB_RD
;
317
PORTB_RD_R2
<=
PORTB_RD_R1
;
318
END
IF
;
319
END
IF
;
320
END
PROCESS
;
321
322
PORTB_RD_HAPPENED
<=
PORTB_RD_R2
;
323
324
PORTB_RD_COMPLETE
<=
'
1
'
when
(
count_rd
=
RD_DEEP_COUNT
)
else
'
0
'
;
325
326
start_rd_counter:
process
(clkb)
327
begin
328
if
(
rising_edge
(
clkb
)
)
then
329
if
(
tb_rst
=
'
1
'
)
then
330
incr_rd_cnt
<=
'
0
'
;
331
elsif
(
portb_rd
=
'
1
'
)
then
332
incr_rd_cnt
<=
'
1
'
;
333
elsif
(
portb_rd_complete
=
'
1
'
)
then
334
incr_rd_cnt
<=
'
0
'
;
335
end
if
;
336
end
if
;
337
end
process
;
338
339
RD_COUNTER:
process
(clkb)
340
begin
341
if
(
rising_edge
(
clkb
)
)
then
342
if
(
tb_rst
=
'
1
'
)
then
343
count_rd
<=
0
;
344
elsif
(
incr_rd_cnt
=
'
1
'
)
then
345
count_rd
<=
count_rd
+
1
;
346
end
if
;
347
--if(count_rd=(wr_rd_deep_count)) then
348
if
(
count_rd
=
(
RD_DEEP_COUNT
)
)
then
349
count_rd
<=
0
;
350
end
if
;
351
end
if
;
352
end
process
;
353
354
DO_READ
<=
'
1
'
when
(
count_rd
<
RD_DEEP_COUNT
and
incr_rd_cnt
=
'
1
'
)
else
'
0
'
;
355
356
PORTA_WR_COMPLETE
<=
'
1
'
when
(
count
=
WR_DEEP_COUNT
)
else
'
0
'
;
357
358
start_counter:
process
(clka)
359
begin
360
if
(
rising_edge
(
clka
)
)
then
361
if
(
tb_rst
=
'
1
'
)
then
362
incr_wr_cnt
<=
'
0
'
;
363
elsif
(
porta_wr
=
'
1
'
)
then
364
incr_wr_cnt
<=
'
1
'
;
365
elsif
(
porta_wr_complete
=
'
1
'
)
then
366
incr_wr_cnt
<=
'
0
'
;
367
end
if
;
368
end
if
;
369
end
process
;
370
371
COUNTER:
process
(clka)
372
begin
373
if
(
rising_edge
(
clka
)
)
then
374
if
(
tb_rst
=
'
1
'
)
then
375
count
<=
0
;
376
elsif
(
incr_wr_cnt
=
'
1
'
)
then
377
count
<=
count
+
1
;
378
end
if
;
379
if
(
count
=
(
WR_DEEP_COUNT
)
)
then
380
count
<=
0
;
381
end
if
;
382
end
if
;
383
end
process
;
384
385
DO_WRITE
<=
'
1
'
when
(
count
<
WR_DEEP_COUNT
and
incr_wr_cnt
=
'
1
'
)
else
'
0
'
;
386
387
388
BEGIN
_SHIFT_REG
:
FOR
I
IN
0
TO
5
GENERATE
389
BEGIN
390
DFF_RIGHT
:
IF
I
=
0
GENERATE
391
BEGIN
392
SHIFT_INST_0:
ENTITY
work.
REGISTER_LOGIC
393
PORT
MAP
(
394
Q => DO_READ_REG
(
0
)
,
395
CLK => CLKB,
396
RST => TB_RST ,
397
D => DO_READ
398
)
;
399
END
GENERATE
DFF_RIGHT
;
400
401
DFF_OTHERS
:
IF
(
(
I
>
0
)
AND
(
I
<=
5
)
)
GENERATE
402
BEGIN
403
SHIFT_INST:
ENTITY
work.
REGISTER_LOGIC
404
PORT
MAP
(
405
Q => DO_READ_REG
(
I
)
,
406
CLK =>CLKB,
407
RST =>TB_RST,
408
D =>DO_READ_REG
(
I-
1
)
409
)
;
410
END
GENERATE
DFF_OTHERS
;
411
END
GENERATE
BEGIN_SHIFT_REG
;
412
413
REGCE_PROCESS:
PROCESS
(CLKB)
414
BEGIN
415
IF
(
RISING_EDGE
(
CLKB
)
)
THEN
416
IF
(
TB_RST
=
'
1
'
)
THEN
417
DO_READ_R
<=
'
0
'
;
418
ELSE
419
DO_READ_R
<=
DO_READ
;
420
END
IF
;
421
END
IF
;
422
END
PROCESS
;
423
424
425
426
WEA
(
0
)
<=
DO_WRITE
;
427
428
429
END
ARCHITECTURE
;
430
431
432
433
434
REGISTER_LOGIC
Definition:
bmg_stim_gen.vhd:85
BMG_STIM_GEN
Definition:
bmg_stim_gen.vhd:121
DATA_GEN
Definition:
data_gen.vhd:79
ADDR_GEN
Definition:
addr_gen.vhd:79
otsdaq_prepmodernization
firmware
g-2
KickerControllerFirmware
GEL_CAPTAN
ipcore_dir
buf_one
simulation
bmg_stim_gen.vhd
Generated on Wed Apr 29 2020 18:41:41 for otsdaq_prepmodernization by
1.8.5