otsdaq_prepmodernization  v2_05_02_indev
EthernetRAM_synth.vhd
1 
2 
3 
4 
5 
6 
7 
8 
9 --------------------------------------------------------------------------------
10 --
11 -- BLK MEM GEN v7_3 Core - Synthesizable Testbench
12 --
13 --------------------------------------------------------------------------------
14 --
15 -- (c) Copyright 2006_3010 Xilinx, Inc. All rights reserved.
16 --
17 -- This file contains confidential and proprietary information
18 -- of Xilinx, Inc. and is protected under U.S. and
19 -- international copyright and other intellectual property
20 -- laws.
21 --
22 -- DISCLAIMER
23 -- This disclaimer is not a license and does not grant any
24 -- rights to the materials distributed herewith. Except as
25 -- otherwise provided in a valid license issued to you by
26 -- Xilinx, and to the maximum extent permitted by applicable
27 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
28 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
29 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
30 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
31 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
32 -- (2) Xilinx shall not be liable (whether in contract or tort,
33 -- including negligence, or under any other theory of
34 -- liability) for any loss or damage of any kind or nature
35 -- related to, arising under or in connection with these
36 -- materials, including for any direct, or any indirect,
37 -- special, incidental, or consequential loss or damage
38 -- (including loss of data, profits, goodwill, or any type of
39 -- loss or damage suffered as a result of any action brought
40 -- by a third party) even if such damage or loss was
41 -- reasonably foreseeable or Xilinx had been advised of the
42 -- possibility of the same.
43 --
44 -- CRITICAL APPLICATIONS
45 -- Xilinx products are not designed or intended to be fail-
46 -- safe, or for use in any application requiring fail-safe
47 -- performance, such as life-support or safety devices or
48 -- systems, Class III medical devices, nuclear facilities,
49 -- applications related to the deployment of airbags, or any
50 -- other applications that could lead to death, personal
51 -- injury, or severe property or environmental damage
52 -- (individually and collectively, "Critical
53 -- Applications"). Customer assumes the sole risk and
54 -- liability of any use of Xilinx products in Critical
55 -- Applications, subject only to applicable laws and
56 -- regulations governing limitations on product liability.
57 --
58 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
59 -- PART OF THIS FILE AT ALL TIMES.
60 
61 --------------------------------------------------------------------------------
62 --
63 -- Filename: EthernetRAM_synth.vhd
64 --
65 -- Description:
66 -- Synthesizable Testbench
67 --------------------------------------------------------------------------------
68 -- Author: IP Solutions Division
69 --
70 -- History: Sep 12, 2011 - First Release
71 --------------------------------------------------------------------------------
72 --
73 --------------------------------------------------------------------------------
74 -- Library Declarations
75 --------------------------------------------------------------------------------
76 
77 LIBRARY IEEE;
78 USE IEEE.STD_LOGIC_1164.ALL;
79 USE IEEE.STD_LOGIC_UNSIGNED.ALL;
80 USE IEEE.STD_LOGIC_ARITH.ALL;
81 USE IEEE.NUMERIC_STD.ALL;
82 USE IEEE.STD_LOGIC_MISC.ALL;
83 
84 LIBRARY STD;
85 USE STD.TEXTIO.ALL;
86 
87 --LIBRARY unisim;
88 --USE unisim.vcomponents.ALL;
89 
90 LIBRARY work;
91 USE work.ALL;
92 USE work.BMG_TB_PKG.ALL;
93 
95 PORT(
96  CLK_IN : IN STD_LOGIC;
97  RESET_IN : IN STD_LOGIC;
98  STATUS : OUT STD_LOGIC_VECTOR(8 DOWNTO 0) := (OTHERS => '0') --ERROR STATUS OUT OF FPGA
99  );
100 END ENTITY;
101 
102 ARCHITECTURE EthernetRAM_synth_ARCH OF EthernetRAM_synth IS
103 
104 
105 COMPONENT EthernetRAM_exdes
106  PORT (
107  --Inputs - Port A
108  WEA : IN STD_LOGIC_VECTOR(0 DOWNTO 0);
109  ADDRA : IN STD_LOGIC_VECTOR(9 DOWNTO 0);
110  DINA : IN STD_LOGIC_VECTOR(63 DOWNTO 0);
111  DOUTA : OUT STD_LOGIC_VECTOR(63 DOWNTO 0);
112  CLKA : IN STD_LOGIC
113 
114 
115  );
116 
117 END COMPONENT;
118 
119 
120  SIGNAL CLKA: STD_LOGIC := '0';
121  SIGNAL RSTA: STD_LOGIC := '0';
122  SIGNAL WEA: STD_LOGIC_VECTOR(0 DOWNTO 0) := (OTHERS => '0');
123  SIGNAL WEA_R: STD_LOGIC_VECTOR(0 DOWNTO 0) := (OTHERS => '0');
124  SIGNAL ADDRA: STD_LOGIC_VECTOR(9 DOWNTO 0) := (OTHERS => '0');
125  SIGNAL ADDRA_R: STD_LOGIC_VECTOR(9 DOWNTO 0) := (OTHERS => '0');
126  SIGNAL DINA: STD_LOGIC_VECTOR(63 DOWNTO 0) := (OTHERS => '0');
127  SIGNAL DINA_R: STD_LOGIC_VECTOR(63 DOWNTO 0) := (OTHERS => '0');
128  SIGNAL DOUTA: STD_LOGIC_VECTOR(63 DOWNTO 0);
129  SIGNAL CHECKER_EN : STD_LOGIC:='0';
130  SIGNAL CHECKER_EN_R : STD_LOGIC:='0';
131  SIGNAL STIMULUS_FLOW : STD_LOGIC_VECTOR(22 DOWNTO 0) := (OTHERS =>'0');
132  SIGNAL clk_in_i: STD_LOGIC;
133 
134  SIGNAL RESET_SYNC_R1 : STD_LOGIC:='1';
135  SIGNAL RESET_SYNC_R2 : STD_LOGIC:='1';
136  SIGNAL RESET_SYNC_R3 : STD_LOGIC:='1';
137 
138  SIGNAL ITER_R0 : STD_LOGIC := '0';
139  SIGNAL ITER_R1 : STD_LOGIC := '0';
140  SIGNAL ITER_R2 : STD_LOGIC := '0';
141 
142  SIGNAL ISSUE_FLAG : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0');
143  SIGNAL ISSUE_FLAG_STATUS : STD_LOGIC_VECTOR(7 DOWNTO 0) := (OTHERS => '0');
144 
145  BEGIN
146 
147 -- clk_buf: bufg
148 -- PORT map(
149 -- i => CLK_IN,
150 -- o => clk_in_i
151 -- );
152  clk_in_i <= CLK_IN;
153  CLKA <= clk_in_i;
154 
155  RSTA <= RESET_SYNC_R3 AFTER 50 ns;
156 
157 
158  PROCESS(clk_in_i)
159  BEGIN
160  IF(RISING_EDGE(clk_in_i)) THEN
161  RESET_SYNC_R1 <= RESET_IN;
162  RESET_SYNC_R2 <= RESET_SYNC_R1;
163  RESET_SYNC_R3 <= RESET_SYNC_R2;
164  END IF;
165  END PROCESS;
166 
167 
168 PROCESS(CLKA)
169 BEGIN
170  IF(RISING_EDGE(CLKA)) THEN
171  IF(RESET_SYNC_R3='1') THEN
172  ISSUE_FLAG_STATUS<= (OTHERS => '0');
173  ELSE
174  ISSUE_FLAG_STATUS <= ISSUE_FLAG_STATUS OR ISSUE_FLAG;
175  END IF;
176  END IF;
177 END PROCESS;
178 
179 STATUS(7 DOWNTO 0) <= ISSUE_FLAG_STATUS;
180 
181 
182 
183  BMG_DATA_CHECKER_INST: ENTITY work.CHECKER
184  GENERIC MAP (
185  WRITE_WIDTH => 64,
186  READ_WIDTH => 64 )
187  PORT MAP (
188  CLK => CLKA,
189  RST => RSTA,
190  EN => CHECKER_EN_R ,
191  DATA_IN => DOUTA,
192  STATUS => ISSUE_FLAG(0)
193  );
194 
195  PROCESS(CLKA)
196  BEGIN
197  IF(RISING_EDGE(CLKA)) THEN
198  IF(RSTA='1') THEN
199  CHECKER_EN_R <= '0';
200  ELSE
201  CHECKER_EN_R <= CHECKER_EN AFTER 50 ns;
202  END IF;
203  END IF;
204  END PROCESS;
205 
206 
207  BMG_STIM_GEN_INST:ENTITY work.BMG_STIM_GEN
208  PORT MAP(
209  CLK => clk_in_i ,
210  RST => RSTA,
211  ADDRA => ADDRA,
212  DINA => DINA,
213  WEA => WEA,
214  CHECK_DATA => CHECKER_EN
215  );
216 
217  PROCESS(CLKA)
218  BEGIN
219  IF(RISING_EDGE(CLKA)) THEN
220  IF(RESET_SYNC_R3='1') THEN
221  STATUS(8) <= '0';
222  iter_r2 <= '0';
223  iter_r1 <= '0';
224  iter_r0 <= '0';
225  ELSE
226  STATUS(8) <= iter_r2;
227  iter_r2 <= iter_r1;
228  iter_r1 <= iter_r0;
229  iter_r0 <= STIMULUS_FLOW(8);
230  END IF;
231  END IF;
232  END PROCESS;
233 
234 
235  PROCESS(CLKA)
236  BEGIN
237  IF(RISING_EDGE(CLKA)) THEN
238  IF(RESET_SYNC_R3='1') THEN
239  STIMULUS_FLOW <= (OTHERS => '0');
240  ELSIF(WEA(0)='1') THEN
241  STIMULUS_FLOW <= STIMULUS_FLOW+1;
242  END IF;
243  END IF;
244  END PROCESS;
245 
246 
247 
248 
249  PROCESS(CLKA)
250  BEGIN
251  IF(RISING_EDGE(CLKA)) THEN
252  IF(RESET_SYNC_R3='1') THEN
253  WEA_R <= (OTHERS=>'0') AFTER 50 ns;
254  DINA_R <= (OTHERS=>'0') AFTER 50 ns;
255 
256 
257  ELSE
258  WEA_R <= WEA AFTER 50 ns;
259  DINA_R <= DINA AFTER 50 ns;
260 
261  END IF;
262  END IF;
263  END PROCESS;
264 
265 
266  PROCESS(CLKA)
267  BEGIN
268  IF(RISING_EDGE(CLKA)) THEN
269  IF(RESET_SYNC_R3='1') THEN
270  ADDRA_R <= (OTHERS=> '0') AFTER 50 ns;
271  ELSE
272  ADDRA_R <= ADDRA AFTER 50 ns;
273  END IF;
274  END IF;
275  END PROCESS;
276 
277 
278  BMG_PORT: EthernetRAM_exdes PORT MAP (
279  --Port A
280  WEA => WEA_R,
281  ADDRA => ADDRA_R,
282  DINA => DINA_R,
283  DOUTA => DOUTA,
284  CLKA => CLKA
285 
286  );
287 END ARCHITECTURE;