otsdaq_prepmodernization  v2_05_02_indev
ethernet_FIFO_pctrl.vhd
1 
2 --------------------------------------------------------------------------------
3 --
4 -- FIFO Generator Core Demo Testbench
5 --
6 --------------------------------------------------------------------------------
7 --
8 -- (c) Copyright 2009 - 2010 Xilinx, Inc. All rights reserved.
9 --
10 -- This file contains confidential and proprietary information
11 -- of Xilinx, Inc. and is protected under U.S. and
12 -- international copyright and other intellectual property
13 -- laws.
14 --
15 -- DISCLAIMER
16 -- This disclaimer is not a license and does not grant any
17 -- rights to the materials distributed herewith. Except as
18 -- otherwise provided in a valid license issued to you by
19 -- Xilinx, and to the maximum extent permitted by applicable
20 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
21 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
22 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
23 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
24 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
25 -- (2) Xilinx shall not be liable (whether in contract or tort,
26 -- including negligence, or under any other theory of
27 -- liability) for any loss or damage of any kind or nature
28 -- related to, arising under or in connection with these
29 -- materials, including for any direct, or any indirect,
30 -- special, incidental, or consequential loss or damage
31 -- (including loss of data, profits, goodwill, or any type of
32 -- loss or damage suffered as a result of any action brought
33 -- by a third party) even if such damage or loss was
34 -- reasonably foreseeable or Xilinx had been advised of the
35 -- possibility of the same.
36 --
37 -- CRITICAL APPLICATIONS
38 -- Xilinx products are not designed or intended to be fail-
39 -- safe, or for use in any application requiring fail-safe
40 -- performance, such as life-support or safety devices or
41 -- systems, Class III medical devices, nuclear facilities,
42 -- applications related to the deployment of airbags, or any
43 -- other applications that could lead to death, personal
44 -- injury, or severe property or environmental damage
45 -- (individually and collectively, "Critical
46 -- Applications"). Customer assumes the sole risk and
47 -- liability of any use of Xilinx products in Critical
48 -- Applications, subject only to applicable laws and
49 -- regulations governing limitations on product liability.
50 --
51 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
52 -- PART OF THIS FILE AT ALL TIMES.
53 --------------------------------------------------------------------------------
54 --
55 -- Filename: ethernet_FIFO_pctrl.vhd
56 --
57 -- Description:
58 -- Used for protocol control on write and read interface stimulus and status generation
59 --
60 --------------------------------------------------------------------------------
61 -- Library Declarations
62 --------------------------------------------------------------------------------
63 LIBRARY ieee;
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 
69 LIBRARY work;
70 USE work.ethernet_FIFO_pkg.ALL;
71 
73  GENERIC(
74  AXI_CHANNEL : STRING :="NONE";
75  C_APPLICATION_TYPE : INTEGER := 0;
76  C_DIN_WIDTH : INTEGER := 0;
77  C_DOUT_WIDTH : INTEGER := 0;
78  C_WR_PNTR_WIDTH : INTEGER := 0;
79  C_RD_PNTR_WIDTH : INTEGER := 0;
80  C_CH_TYPE : INTEGER := 0;
81  FREEZEON_ERROR : INTEGER := 0;
82  TB_STOP_CNT : INTEGER := 2;
83  TB_SEED : INTEGER := 2
84  );
85  PORT(
86  RESET_WR : IN STD_LOGIC;
87  RESET_RD : IN STD_LOGIC;
88  WR_CLK : IN STD_LOGIC;
89  RD_CLK : IN STD_LOGIC;
90  FULL : IN STD_LOGIC;
91  EMPTY : IN STD_LOGIC;
92  ALMOST_FULL : IN STD_LOGIC;
93  ALMOST_EMPTY : IN STD_LOGIC;
94  DATA_IN : IN STD_LOGIC_VECTOR(C_DIN_WIDTH-1 DOWNTO 0);
95  DATA_OUT : IN STD_LOGIC_VECTOR(C_DOUT_WIDTH-1 DOWNTO 0);
96  DOUT_CHK : IN STD_LOGIC;
97  PRC_WR_EN : OUT STD_LOGIC;
98  PRC_RD_EN : OUT STD_LOGIC;
99  RESET_EN : OUT STD_LOGIC;
100  SIM_DONE : OUT STD_LOGIC;
101  STATUS : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
102  );
103 END ENTITY;
104 
105 
106 ARCHITECTURE fg_pc_arch OF ethernet_FIFO_pctrl IS
107 
108  CONSTANT C_DATA_WIDTH : INTEGER := if_then_else(C_DIN_WIDTH > C_DOUT_WIDTH,C_DIN_WIDTH,C_DOUT_WIDTH);
109  CONSTANT LOOP_COUNT : INTEGER := divroundup(C_DATA_WIDTH,8);
110  CONSTANT D_WIDTH_DIFF : INTEGER := log2roundup(C_DOUT_WIDTH/C_DIN_WIDTH);
111 
112  SIGNAL data_chk_i : STD_LOGIC := if_then_else(C_CH_TYPE /= 2,'1','0');
113  SIGNAL full_chk_i : STD_LOGIC := if_then_else(C_CH_TYPE /= 2,'1','0');
114  SIGNAL empty_chk_i : STD_LOGIC := if_then_else(C_CH_TYPE /= 2,'1','0');
115  SIGNAL status_i : STD_LOGIC_VECTOR(4 DOWNTO 0):= (OTHERS => '0');
116  SIGNAL status_d1_i : STD_LOGIC_VECTOR(4 DOWNTO 0):= (OTHERS => '0');
117  SIGNAL wr_en_gen : STD_LOGIC_VECTOR(7 DOWNTO 0):= (OTHERS => '0');
118  SIGNAL rd_en_gen : STD_LOGIC_VECTOR(7 DOWNTO 0):= (OTHERS => '0');
119  SIGNAL wr_cntr : STD_LOGIC_VECTOR(C_WR_PNTR_WIDTH-2 DOWNTO 0) := (OTHERS => '0');
120  SIGNAL full_as_timeout : STD_LOGIC_VECTOR(C_WR_PNTR_WIDTH DOWNTO 0) := (OTHERS => '0');
121  SIGNAL full_ds_timeout : STD_LOGIC_VECTOR(C_WR_PNTR_WIDTH DOWNTO 0) := (OTHERS => '0');
122  SIGNAL rd_cntr : STD_LOGIC_VECTOR(C_RD_PNTR_WIDTH-2 DOWNTO 0) := (OTHERS => '0');
123  SIGNAL empty_as_timeout : STD_LOGIC_VECTOR(C_RD_PNTR_WIDTH DOWNTO 0) := (OTHERS => '0');
124  SIGNAL empty_ds_timeout : STD_LOGIC_VECTOR(C_RD_PNTR_WIDTH DOWNTO 0):= (OTHERS => '0');
125  SIGNAL wr_en_i : STD_LOGIC := '0';
126  SIGNAL rd_en_i : STD_LOGIC := '0';
127  SIGNAL state : STD_LOGIC := '0';
128  SIGNAL wr_control : STD_LOGIC := '0';
129  SIGNAL rd_control : STD_LOGIC := '0';
130  SIGNAL stop_on_err : STD_LOGIC := '0';
131  SIGNAL sim_stop_cntr : STD_LOGIC_VECTOR(7 DOWNTO 0):= conv_std_logic_vector(if_then_else(C_CH_TYPE=2,64,TB_STOP_CNT),8);
132  SIGNAL sim_done_i : STD_LOGIC := '0';
133  SIGNAL rdw_gt_wrw : STD_LOGIC_VECTOR(D_WIDTH_DIFF-1 DOWNTO 0) := (OTHERS => '1');
134  SIGNAL wrw_gt_rdw : STD_LOGIC_VECTOR(D_WIDTH_DIFF-1 DOWNTO 0) := (OTHERS => '1');
135  SIGNAL rd_activ_cont : STD_LOGIC_VECTOR(25 downto 0):= (OTHERS => '0');
136  SIGNAL prc_we_i : STD_LOGIC := '0';
137  SIGNAL prc_re_i : STD_LOGIC := '0';
138  SIGNAL reset_en_i : STD_LOGIC := '0';
139  SIGNAL sim_done_d1 : STD_LOGIC := '0';
140  SIGNAL sim_done_wr1 : STD_LOGIC := '0';
141  SIGNAL sim_done_wr2 : STD_LOGIC := '0';
142  SIGNAL empty_d1 : STD_LOGIC := '0';
143  SIGNAL empty_wr_dom1 : STD_LOGIC := '0';
144  SIGNAL state_d1 : STD_LOGIC := '0';
145  SIGNAL state_rd_dom1 : STD_LOGIC := '0';
146  SIGNAL rd_en_d1 : STD_LOGIC := '0';
147  SIGNAL rd_en_wr1 : STD_LOGIC := '0';
148  SIGNAL wr_en_d1 : STD_LOGIC := '0';
149  SIGNAL wr_en_rd1 : STD_LOGIC := '0';
150  SIGNAL full_chk_d1 : STD_LOGIC := '0';
151  SIGNAL full_chk_rd1 : STD_LOGIC := '0';
152  SIGNAL empty_wr_dom2 : STD_LOGIC := '0';
153 
154  SIGNAL state_rd_dom2 : STD_LOGIC := '0';
155  SIGNAL state_rd_dom3 : STD_LOGIC := '0';
156  SIGNAL rd_en_wr2 : STD_LOGIC := '0';
157  SIGNAL wr_en_rd2 : STD_LOGIC := '0';
158  SIGNAL full_chk_rd2 : STD_LOGIC := '0';
159  SIGNAL reset_en_d1 : STD_LOGIC := '0';
160  SIGNAL reset_en_rd1 : STD_LOGIC := '0';
161  SIGNAL reset_en_rd2 : STD_LOGIC := '0';
162 
163  SIGNAL data_chk_wr_d1 : STD_LOGIC := '0';
164  SIGNAL data_chk_rd1 : STD_LOGIC := '0';
165  SIGNAL data_chk_rd2 : STD_LOGIC := '0';
166  SIGNAL post_rst_dly_wr : STD_LOGIC_VECTOR(4 DOWNTO 0) := (OTHERS => '1');
167  SIGNAL post_rst_dly_rd : STD_LOGIC_VECTOR(4 DOWNTO 0) := (OTHERS => '1');
168 BEGIN
169  status_i <= data_chk_i & full_chk_rd2 & empty_chk_i & '0' & '0';
170  STATUS <= status_d1_i & '0' & '0' & rd_activ_cont(rd_activ_cont'high);
171 
172  prc_we_i <= wr_en_i WHEN sim_done_wr2 = '0' ELSE '0';
173  prc_re_i <= rd_en_i WHEN sim_done_i = '0' ELSE '0';
174 
175  SIM_DONE <= sim_done_i;
176  rdw_gt_wrw <= (OTHERS => '1');
177  wrw_gt_rdw <= (OTHERS => '1');
178 
179  PROCESS(RD_CLK)
180  BEGIN
181  IF (RD_CLK'event AND RD_CLK='1') THEN
182  IF(prc_re_i = '1') THEN
183  rd_activ_cont <= rd_activ_cont + "1";
184  END IF;
185  END IF;
186  END PROCESS;
187 
188 
189  PROCESS(sim_done_i)
190  BEGIN
191  assert sim_done_i = '0'
192  report "Simulation Complete for:" & AXI_CHANNEL
193  severity note;
194  END PROCESS;
195 
196 -----------------------------------------------------
197 -- SIM_DONE SIGNAL GENERATION
198 -----------------------------------------------------
199 PROCESS (RD_CLK,RESET_RD)
200 BEGIN
201  IF(RESET_RD = '1') THEN
202  --sim_done_i <= '0';
203  ELSIF(RD_CLK'event AND RD_CLK='1') THEN
204  IF((OR_REDUCE(sim_stop_cntr) = '0' AND TB_STOP_CNT /= 0) OR stop_on_err = '1') THEN
205  sim_done_i <= '1';
206  END IF;
207  END IF;
208 END PROCESS;
209 
210  -- TB Timeout/Stop
211  fifo_tb_stop_run:IF(TB_STOP_CNT /= 0) GENERATE
212  PROCESS (RD_CLK)
213  BEGIN
214  IF (RD_CLK'event AND RD_CLK='1') THEN
215  IF(state_rd_dom2 = '0' AND state_rd_dom3 = '1') THEN
216  sim_stop_cntr <= sim_stop_cntr - "1";
217  END IF;
218  END IF;
219  END PROCESS;
220  END GENERATE fifo_tb_stop_run;
221 
222 
223  -- Stop when error found
224  PROCESS (RD_CLK)
225  BEGIN
226  IF (RD_CLK'event AND RD_CLK='1') THEN
227  IF(sim_done_i = '0') THEN
228  status_d1_i <= status_i OR status_d1_i;
229  END IF;
230  IF(FREEZEON_ERROR = 1 AND status_i /= "0") THEN
231  stop_on_err <= '1';
232  END IF;
233  END IF;
234  END PROCESS;
235  -----------------------------------------------------
236 
237  -----------------------------------------------------
238  -- CHECKS FOR FIFO
239  -----------------------------------------------------
240 
241 
242  PROCESS(RD_CLK,RESET_RD)
243  BEGIN
244  IF(RESET_RD = '1') THEN
245  post_rst_dly_rd <= (OTHERS => '1');
246  ELSIF (RD_CLK'event AND RD_CLK='1') THEN
247  post_rst_dly_rd <= post_rst_dly_rd-post_rst_dly_rd(4);
248  END IF;
249  END PROCESS;
250 
251  PROCESS(WR_CLK,RESET_WR)
252  BEGIN
253  IF(RESET_WR = '1') THEN
254  post_rst_dly_wr <= (OTHERS => '1');
255  ELSIF (WR_CLK'event AND WR_CLK='1') THEN
256  post_rst_dly_wr <= post_rst_dly_wr-post_rst_dly_wr(4);
257  END IF;
258  END PROCESS;
259 
260 
261  -- FULL de-assert Counter
262  PROCESS(WR_CLK,RESET_WR)
263  BEGIN
264  IF(RESET_WR = '1') THEN
265  full_ds_timeout <= (OTHERS => '0');
266  ELSIF(WR_CLK'event AND WR_CLK='1') THEN
267  IF(state = '1') THEN
268  IF(rd_en_wr2 = '1' AND wr_en_i = '0' AND FULL = '1' AND AND_REDUCE(wrw_gt_rdw) = '1') THEN
269  full_ds_timeout <= full_ds_timeout + '1';
270  END IF;
271  ELSE
272  full_ds_timeout <= (OTHERS => '0');
273  END IF;
274  END IF;
275  END PROCESS;
276 
277 
278  -- EMPTY deassert counter
279  PROCESS(RD_CLK,RESET_RD)
280  BEGIN
281  IF(RESET_RD = '1') THEN
282  empty_ds_timeout <= (OTHERS => '0');
283  ELSIF(RD_CLK'event AND RD_CLK='1') THEN
284  IF(state = '0') THEN
285  IF(wr_en_rd2 = '1' AND rd_en_i = '0' AND EMPTY = '1' AND AND_REDUCE(rdw_gt_wrw) = '1') THEN
286  empty_ds_timeout <= empty_ds_timeout + '1';
287  END IF;
288  ELSE
289  empty_ds_timeout <= (OTHERS => '0');
290  END IF;
291  END IF;
292  END PROCESS;
293 
294  -- Full check signal generation
295  PROCESS(WR_CLK,RESET_WR)
296  BEGIN
297  IF(RESET_WR = '1') THEN
298  full_chk_i <= '0';
299  ELSIF(WR_CLK'event AND WR_CLK='1') THEN
300  IF(C_APPLICATION_TYPE = 1 AND (AXI_CHANNEL = "WACH" OR AXI_CHANNEL = "RACH" OR AXI_CHANNEL = "AXI4_Stream")) THEN
301  full_chk_i <= '0';
302  ELSE
303  full_chk_i <= AND_REDUCE(full_as_timeout) OR
304  AND_REDUCE(full_ds_timeout);
305  END IF;
306  END IF;
307  END PROCESS;
308 
309  -- Empty checks
310  PROCESS(RD_CLK,RESET_RD)
311  BEGIN
312  IF(RESET_RD = '1') THEN
313  empty_chk_i <= '0';
314  ELSIF(RD_CLK'event AND RD_CLK='1') THEN
315  IF(C_APPLICATION_TYPE = 1 AND (AXI_CHANNEL = "WACH" OR AXI_CHANNEL = "RACH" OR AXI_CHANNEL = "AXI4_Stream")) THEN
316  empty_chk_i <= '0';
317  ELSE
318  empty_chk_i <= AND_REDUCE(empty_as_timeout) OR
319  AND_REDUCE(empty_ds_timeout);
320  END IF;
321  END IF;
322  END PROCESS;
323 
324  fifo_d_chk:IF(C_CH_TYPE /= 2) GENERATE
325  PRC_WR_EN <= prc_we_i AFTER 50 ns;
326  PRC_RD_EN <= prc_re_i AFTER 100 ns;
327  data_chk_i <= dout_chk;
328  END GENERATE fifo_d_chk;
329  -----------------------------------------------------
330 
331 
332  -----------------------------------------------------
333  -- SYNCHRONIZERS B/W WRITE AND READ DOMAINS
334  -----------------------------------------------------
335  PROCESS(WR_CLK,RESET_WR)
336  BEGIN
337  IF(RESET_WR = '1') THEN
338  empty_wr_dom1 <= '1';
339  empty_wr_dom2 <= '1';
340  state_d1 <= '0';
341  wr_en_d1 <= '0';
342  rd_en_wr1 <= '0';
343  rd_en_wr2 <= '0';
344  full_chk_d1 <= '0';
345  reset_en_d1 <= '0';
346  sim_done_wr1 <= '0';
347  sim_done_wr2 <= '0';
348  ELSIF (WR_CLK'event AND WR_CLK='1') THEN
349  sim_done_wr1 <= sim_done_d1;
350  sim_done_wr2 <= sim_done_wr1;
351  reset_en_d1 <= reset_en_i;
352  state_d1 <= state;
353  empty_wr_dom1 <= empty_d1;
354  empty_wr_dom2 <= empty_wr_dom1;
355  wr_en_d1 <= wr_en_i;
356  rd_en_wr1 <= rd_en_d1;
357  rd_en_wr2 <= rd_en_wr1;
358  full_chk_d1 <= full_chk_i;
359  END IF;
360  END PROCESS;
361 
362  PROCESS(RD_CLK,RESET_RD)
363  BEGIN
364  IF(RESET_RD = '1') THEN
365  empty_d1 <= '1';
366  state_rd_dom1 <= '0';
367  state_rd_dom2 <= '0';
368  state_rd_dom3 <= '0';
369  wr_en_rd1 <= '0';
370  wr_en_rd2 <= '0';
371  rd_en_d1 <= '0';
372  full_chk_rd1 <= '0';
373  full_chk_rd2 <= '0';
374  reset_en_rd1 <= '0';
375  reset_en_rd2 <= '0';
376  sim_done_d1 <= '0';
377  ELSIF (RD_CLK'event AND RD_CLK='1') THEN
378  sim_done_d1 <= sim_done_i;
379  reset_en_rd1 <= reset_en_d1;
380  reset_en_rd2 <= reset_en_rd1;
381  empty_d1 <= EMPTY;
382  rd_en_d1 <= rd_en_i;
383  state_rd_dom1 <= state_d1;
384  state_rd_dom2 <= state_rd_dom1;
385  state_rd_dom3 <= state_rd_dom2;
386  wr_en_rd1 <= wr_en_d1;
387  wr_en_rd2 <= wr_en_rd1;
388  full_chk_rd1 <= full_chk_d1;
389  full_chk_rd2 <= full_chk_rd1;
390  END IF;
391  END PROCESS;
392 
393  RESET_EN <= reset_en_rd2;
394 
395 
396  data_fifo_en:IF(C_CH_TYPE /= 2) GENERATE
397  -----------------------------------------------------
398  -- WR_EN GENERATION
399  -----------------------------------------------------
400  gen_rand_wr_en:ethernet_FIFO_rng
401  GENERIC MAP(
402  WIDTH => 8,
403  SEED => TB_SEED+1
404  )
405  PORT MAP(
406  CLK => WR_CLK,
407  RESET => RESET_WR,
408  RANDOM_NUM => wr_en_gen,
409  ENABLE => '1'
410  );
411 
412  PROCESS(WR_CLK,RESET_WR)
413  BEGIN
414  IF(RESET_WR = '1') THEN
415  wr_en_i <= '0';
416  ELSIF(WR_CLK'event AND WR_CLK='1') THEN
417  IF(state = '1') THEN
418  wr_en_i <= wr_en_gen(0) AND wr_en_gen(7) AND wr_en_gen(2) AND wr_control;
419  ELSE
420  wr_en_i <= (wr_en_gen(3) OR wr_en_gen(4) OR wr_en_gen(2)) AND (NOT post_rst_dly_wr(4));
421  END IF;
422  END IF;
423  END PROCESS;
424 
425  -----------------------------------------------------
426  -- WR_EN CONTROL
427  -----------------------------------------------------
428  PROCESS(WR_CLK,RESET_WR)
429  BEGIN
430  IF(RESET_WR = '1') THEN
431  wr_cntr <= (OTHERS => '0');
432  wr_control <= '1';
433  full_as_timeout <= (OTHERS => '0');
434  ELSIF(WR_CLK'event AND WR_CLK='1') THEN
435  IF(state = '1') THEN
436  IF(wr_en_i = '1') THEN
437  wr_cntr <= wr_cntr + "1";
438  END IF;
439  full_as_timeout <= (OTHERS => '0');
440  ELSE
441  wr_cntr <= (OTHERS => '0');
442  IF(rd_en_wr2 = '0') THEN
443  IF(wr_en_i = '1') THEN
444  full_as_timeout <= full_as_timeout + "1";
445  END IF;
446  ELSE
447  full_as_timeout <= (OTHERS => '0');
448  END IF;
449  END IF;
450 
451  wr_control <= NOT wr_cntr(wr_cntr'high);
452 
453  END IF;
454  END PROCESS;
455 
456  -----------------------------------------------------
457  -- RD_EN GENERATION
458  -----------------------------------------------------
459  gen_rand_rd_en:ethernet_FIFO_rng
460  GENERIC MAP(
461  WIDTH => 8,
462  SEED => TB_SEED
463  )
464  PORT MAP(
465  CLK => RD_CLK,
466  RESET => RESET_RD,
467  RANDOM_NUM => rd_en_gen,
468  ENABLE => '1'
469  );
470 
471  PROCESS(RD_CLK,RESET_RD)
472  BEGIN
473  IF(RESET_RD = '1') THEN
474  rd_en_i <= '0';
475  ELSIF(RD_CLK'event AND RD_CLK='1') THEN
476  IF(state_rd_dom2 = '0') THEN
477  rd_en_i <= rd_en_gen(1) AND rd_en_gen(5) AND rd_en_gen(3) AND rd_control AND (NOT post_rst_dly_rd(4));
478  ELSE
479  rd_en_i <= rd_en_gen(0) OR rd_en_gen(6);
480  END IF;
481  END IF;
482  END PROCESS;
483 
484  -----------------------------------------------------
485  -- RD_EN CONTROL
486  -----------------------------------------------------
487  PROCESS(RD_CLK,RESET_RD)
488  BEGIN
489  IF(RESET_RD = '1') THEN
490  rd_cntr <= (OTHERS => '0');
491  rd_control <= '1';
492  empty_as_timeout <= (OTHERS => '0');
493  ELSIF(RD_CLK'event AND RD_CLK='1') THEN
494  IF(state_rd_dom2 = '0') THEN
495  IF(rd_en_i = '1') THEN
496  rd_cntr <= rd_cntr + "1";
497  END IF;
498  empty_as_timeout <= (OTHERS => '0');
499  ELSE
500  rd_cntr <= (OTHERS => '0');
501  IF(wr_en_rd2 = '0') THEN
502  IF(rd_en_i = '1') THEN
503  empty_as_timeout <= empty_as_timeout + "1";
504  END IF;
505  ELSE
506  empty_as_timeout <= (OTHERS => '0');
507  END IF;
508  END IF;
509 
510  rd_control <= NOT rd_cntr(rd_cntr'high);
511 
512  END IF;
513  END PROCESS;
514 
515  -----------------------------------------------------
516  -- STIMULUS CONTROL
517  -----------------------------------------------------
518  PROCESS(WR_CLK,RESET_WR)
519  BEGIN
520  IF(RESET_WR = '1') THEN
521  state <= '0';
522  reset_en_i <= '0';
523  ELSIF(WR_CLK'event AND WR_CLK='1') THEN
524  CASE state IS
525  WHEN '0' =>
526  IF(FULL = '1' AND empty_wr_dom2 = '0') THEN
527  state <= '1';
528  reset_en_i <= '0';
529  END IF;
530  WHEN '1' =>
531  IF(empty_wr_dom2 = '1' AND FULL = '0') THEN
532  state <= '0';
533  reset_en_i <= '1';
534  END IF;
535  WHEN OTHERS => state <= state;
536  END CASE;
537  END IF;
538  END PROCESS;
539  END GENERATE data_fifo_en;
540 
541 END ARCHITECTURE;