OpenCores
URL https://opencores.org/ocsvn/xmatchpro/xmatchpro/trunk

Subversion Repositories xmatchpro

[/] [xmatchpro/] [trunk/] [xmw4-comdec/] [xmatch_sim7/] [ipcore_dir/] [fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3/] [simulation/] [fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_pkg.vhd] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 eejlny
--------------------------------------------------------------------------------
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: fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_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 fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_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 fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_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 fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_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 fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_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 fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_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 fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_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 fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_exdes IS
200
   PORT (
201
           WR_CLK                    : IN  std_logic;
202
           RD_CLK                    : IN  std_logic;
203
           WR_DATA_COUNT             : OUT std_logic_vector(8-1 DOWNTO 0);
204
           RD_DATA_COUNT             : OUT std_logic_vector(8-1 DOWNTO 0);
205
           RST                       : IN  std_logic;
206
           PROG_FULL                 : OUT std_logic;
207
           OVERFLOW                  : OUT std_logic;
208
           UNDERFLOW                 : OUT std_logic;
209
           WR_EN                     : IN  std_logic;
210
           RD_EN                     : IN  std_logic;
211
           DIN                       : IN  std_logic_vector(8-1 DOWNTO 0);
212
           DOUT                      : OUT std_logic_vector(64-1 DOWNTO 0);
213
           FULL                      : OUT std_logic;
214
           EMPTY                     : OUT std_logic);
215
 
216
 END COMPONENT;
217
 ------------------------ 
218
 
219
 
220
END fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_pkg;
221
 
222
 
223
 
224
PACKAGE BODY fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_pkg IS
225
 
226
 FUNCTION divroundup (
227
    data_value : INTEGER;
228
    divisor : INTEGER)
229
  RETURN INTEGER IS
230
    VARIABLE div                   : INTEGER;
231
  BEGIN
232
    div   := data_value/divisor;
233
    IF ( (data_value MOD divisor) /= 0) THEN
234
      div := div+1;
235
    END IF;
236
    RETURN div;
237
  END divroundup;
238
  ---------------------------------
239
  FUNCTION if_then_else (
240
    condition : BOOLEAN;
241
    true_case : INTEGER;
242
    false_case : INTEGER)
243
  RETURN INTEGER IS
244
    VARIABLE retval : INTEGER := 0;
245
  BEGIN
246
    IF condition=false THEN
247
      retval:=false_case;
248
    ELSE
249
      retval:=true_case;
250
    END IF;
251
    RETURN retval;
252
  END if_then_else;
253
    ---------------------------------
254
  FUNCTION if_then_else (
255
    condition : BOOLEAN;
256
    true_case : STD_LOGIC;
257
    false_case : STD_LOGIC)
258
  RETURN STD_LOGIC IS
259
    VARIABLE retval : STD_LOGIC := '0';
260
  BEGIN
261
    IF condition=false THEN
262
      retval:=false_case;
263
    ELSE
264
      retval:=true_case;
265
    END IF;
266
    RETURN retval;
267
  END if_then_else;
268
  ---------------------------------
269
  FUNCTION if_then_else (
270
    condition : BOOLEAN;
271
    true_case : TIME;
272
    false_case : TIME)
273
  RETURN TIME IS
274
    VARIABLE retval : TIME := 0 ps;
275
  BEGIN
276
    IF condition=false THEN
277
      retval:=false_case;
278
    ELSE
279
      retval:=true_case;
280
    END IF;
281
    RETURN retval;
282
  END if_then_else;
283
  ------------------------------- 
284
  FUNCTION log2roundup (
285
      data_value : INTEGER)
286
    RETURN INTEGER IS
287
 
288
      VARIABLE width       : INTEGER := 0;
289
      VARIABLE cnt         : INTEGER := 1;
290
    BEGIN
291
      IF (data_value <= 1) THEN
292
        width   := 1;
293
      ELSE
294
        WHILE (cnt < data_value) LOOP
295
          width := width + 1;
296
          cnt   := cnt *2;
297
        END LOOP;
298
      END IF;
299
 
300
      RETURN width;
301
    END log2roundup;
302
  ------------------------------------------------------------------------------
303
  -- hexstr_to_std_logic_vec
304
  --  This function converts a hex string to a std_logic_vector
305
  ------------------------------------------------------------------------------
306
  FUNCTION hexstr_to_std_logic_vec(
307
    arg1 : string;
308
    size : integer )
309
  RETURN std_logic_vector IS
310
    VARIABLE result : std_logic_vector(size-1 DOWNTO 0) := (OTHERS => '0');
311
    VARIABLE bin    : std_logic_vector(3 DOWNTO 0);
312
    VARIABLE index  : integer                           := 0;
313
  BEGIN
314
    FOR i IN arg1'reverse_range LOOP
315
      CASE arg1(i) IS
316
        WHEN '0' => bin := (OTHERS => '0');
317
        WHEN '1' => bin := (0 => '1', OTHERS => '0');
318
        WHEN '2' => bin := (1 => '1', OTHERS => '0');
319
        WHEN '3' => bin := (0 => '1', 1 => '1', OTHERS => '0');
320
        WHEN '4' => bin := (2 => '1', OTHERS => '0');
321
        WHEN '5' => bin := (0 => '1', 2 => '1', OTHERS => '0');
322
        WHEN '6' => bin := (1 => '1', 2 => '1', OTHERS => '0');
323
        WHEN '7' => bin := (3 => '0', OTHERS => '1');
324
        WHEN '8' => bin := (3 => '1', OTHERS => '0');
325
        WHEN '9' => bin := (0 => '1', 3 => '1', OTHERS => '0');
326
        WHEN 'A' => bin := (0 => '0', 2 => '0', OTHERS => '1');
327
        WHEN 'a' => bin := (0 => '0', 2 => '0', OTHERS => '1');
328
        WHEN 'B' => bin := (2 => '0', OTHERS => '1');
329
        WHEN 'b' => bin := (2 => '0', OTHERS => '1');
330
        WHEN 'C' => bin := (0 => '0', 1 => '0', OTHERS => '1');
331
        WHEN 'c' => bin := (0 => '0', 1 => '0', OTHERS => '1');
332
        WHEN 'D' => bin := (1 => '0', OTHERS => '1');
333
        WHEN 'd' => bin := (1 => '0', OTHERS => '1');
334
        WHEN 'E' => bin := (0 => '0', OTHERS => '1');
335
        WHEN 'e' => bin := (0 => '0', OTHERS => '1');
336
        WHEN 'F' => bin := (OTHERS => '1');
337
        WHEN 'f' => bin := (OTHERS => '1');
338
        WHEN OTHERS =>
339
          FOR j IN 0 TO 3 LOOP
340
            bin(j) := 'X';
341
          END LOOP;
342
      END CASE;
343
      FOR j IN 0 TO 3 LOOP
344
        IF (index*4)+j < size THEN
345
          result((index*4)+j) := bin(j);
346
        END IF;
347
      END LOOP;
348
      index := index + 1;
349
    END LOOP;
350
    RETURN result;
351
  END hexstr_to_std_logic_vec;
352
 
353
END fifo_2048x8wr_256x64rd_prog_full_fifo_gen_v9_3_pkg;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.