1 --------------------------------------------------------------------------------
3 -- FIFO Generator Core Demo Testbench
5 --------------------------------------------------------------------------------
7 -- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
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
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.
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.
50 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
51 -- PART OF THIS FILE AT ALL TIMES.
52 --------------------------------------------------------------------------------
54 -- Filename: ethernet_FIFO_tb.vhd
57 -- This is the demo testbench top file for fifo_generator core.
59 --------------------------------------------------------------------------------
60 -- Library Declarations
61 --------------------------------------------------------------------------------
64 USE ieee.std_logic_1164.
ALL;
65 USE ieee.std_logic_unsigned.
ALL;
66 USE IEEE.std_logic_arith.
ALL;
67 USE IEEE.std_logic_misc.
ALL;
68 USE ieee.numeric_std.
ALL;
69 USE ieee.std_logic_textio.
ALL;
73 USE work.ethernet_FIFO_pkg.
ALL;
80 SIGNAL status : (7 DOWNTO 0) := "00000000";
84 SIGNAL sim_done : := '0';
85 SIGNAL end_of_sim : (4 DOWNTO 0) := (OTHERS => '0');
86 -- Write and Read clock periods
87 CONSTANT wr_clk_period_by_2 : := 100 ns;
88 CONSTANT rd_clk_period_by_2 : := 200 ns;
89 -- Procedures to display strings
90 PROCEDURE disp_str(
CONSTANT str:
IN )
IS
91 variable dp_l : line := null;
94 writeline(output,dp_l);
97 PROCEDURE disp_hex(
signal hex:
IN (
7 DOWNTO 0))
IS
98 variable dp_lx : line := null;
101 writeline(output,dp_lx);
106 -- Generation of clock
109 WAIT FOR 200 ns;
-- Wait for global reset
112 WAIT FOR wr_clk_period_by_2;
114 WAIT FOR wr_clk_period_by_2;
119 WAIT FOR 400 ns;
-- Wait for global reset
122 WAIT FOR rd_clk_period_by_2;
124 WAIT FOR rd_clk_period_by_2;
128 -- Generation of Reset
138 -- Error message printing based on STATUS signal from ethernet_FIFO_synth
142 IF(status /= "0" AND status /= "1") THEN
147 IF(status(7) = '1') THEN
149 report "Data mismatch found"
153 IF(status(1) = '1') THEN
156 IF(status(5) = '1') THEN
158 report "Empty flag Mismatch/timeout"
162 IF(status(6) = '1') THEN
164 report "Full Flag Mismatch/timeout"
172 wait until sim_done = '1';
173 IF(status /= "0" AND status /= "1") THEN
175 report "Simulation failed"
179 report "Test Completed Successfully"
188 report "Test bench timed out"
192 -- Instance of ethernet_FIFO_synth
204 SIM_DONE => sim_done,