otsdaq_prepmodernization  v2_05_02_indev
Ethernet_RAM_tb_stim_gen.vhd
1 --------------------------------------------------------------------------------
2 --
3 -- DIST MEM GEN Core - Stimulus Generator For Single Port RAM Configuration
4 --
5 --------------------------------------------------------------------------------
6 --
7 -- (c) Copyright 2006_3010 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 --
55 -- Filename: Ethernet_RAM_tb_stim_gen.vhd
56 --
57 -- Description:
58 -- Stimulus Generation For ROM
59 --
60 --------------------------------------------------------------------------------
61 -- Author: IP Solutions Division
62 --
63 -- History: Sep 12, 2011 - First Release
64 --------------------------------------------------------------------------------
65 --
66 --------------------------------------------------------------------------------
67 -- Library Declarations
68 --------------------------------------------------------------------------------
69 LIBRARY IEEE;
70 USE IEEE.STD_LOGIC_1164.ALL;
71 USE IEEE.STD_LOGIC_ARITH.ALL;
72 USE IEEE.STD_LOGIC_UNSIGNED.ALL;
73 USE IEEE.STD_LOGIC_MISC.ALL;
74 
75 LIBRARY work;
76 USE work.ALL;
77 
78 USE work.Ethernet_RAM_TB_PKG.ALL;
79 
80 
82  PORT(
83  Q : OUT STD_LOGIC;
84  CLK : IN STD_LOGIC;
85  RST : IN STD_LOGIC;
86  D : IN STD_LOGIC
87  );
88 END REGISTER_LOGIC_SRAM;
89 
90 ARCHITECTURE REGISTER_ARCH OF REGISTER_LOGIC_SRAM IS
91  SIGNAL Q_O : STD_LOGIC :='0';
92 BEGIN
93  Q <= Q_O;
94  FF_BEH: PROCESS(CLK)
95  BEGIN
96  IF(RISING_EDGE(CLK)) THEN
97  IF(RST ='1') THEN
98  Q_O <= '0';
99  ELSE
100  Q_O <= D;
101  END IF;
102  END IF;
103  END PROCESS;
104 END REGISTER_ARCH;
105 
106 LIBRARY IEEE;
107 USE IEEE.STD_LOGIC_1164.ALL;
108 USE IEEE.STD_LOGIC_ARITH.ALL;
109 USE IEEE.STD_LOGIC_UNSIGNED.ALL;
110 USE IEEE.STD_LOGIC_MISC.ALL;
111 
112 LIBRARY work;
113 USE work.ALL;
114 USE work.Ethernet_RAM_TB_PKG.ALL;
115 
117  PORT (
118  CLK : IN STD_LOGIC;
119  RST : IN STD_LOGIC;
120  A : OUT STD_LOGIC_VECTOR(11-1 downto 0) := (OTHERS => '0');
121  D : OUT STD_LOGIC_VECTOR(64-1 downto 0) := (OTHERS => '0');
122  WE : OUT STD_LOGIC := '0';
123  DATA_IN : IN STD_LOGIC_VECTOR (63 DOWNTO 0); --OUTPUT VECTOR
124 
125  CHECK_DATA : OUT STD_LOGIC:= '0'
126  );
127 END Ethernet_RAM_TB_STIM_GEN;
128 
129 ARCHITECTURE BEHAVIORAL OF Ethernet_RAM_TB_STIM_GEN IS
130 
131  CONSTANT ZERO : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0');
132  CONSTANT DATA_PART_CNT_A: INTEGER:=1;
133  SIGNAL WRITE_ADDR : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0');
134  SIGNAL WRITE_ADDR_INT : STD_LOGIC_VECTOR(10 DOWNTO 0) := (OTHERS => '0');
135  SIGNAL DO_READ_REG : STD_LOGIC_VECTOR(4 DOWNTO 0) :=(OTHERS => '0');
136  SIGNAL READ_ADDR_INT : STD_LOGIC_VECTOR(10 DOWNTO 0) := (OTHERS => '0');
137  SIGNAL READ_ADDR : STD_LOGIC_VECTOR(31 DOWNTO 0) := (OTHERS => '0');
138  SIGNAL D_INT : STD_LOGIC_VECTOR(63 DOWNTO 0) := (OTHERS => '0');
139  SIGNAL DO_WRITE : STD_LOGIC := '0';
140  SIGNAL DO_READ : STD_LOGIC := '0';
141  SIGNAL COUNT_NO : INTEGER :=0;
142 BEGIN
143  WRITE_ADDR_INT(10 DOWNTO 0) <= WRITE_ADDR(10 DOWNTO 0);
144  READ_ADDR_INT(10 DOWNTO 0) <= READ_ADDR(10 DOWNTO 0);
145  A <= IF_THEN_ELSE(DO_WRITE='1',WRITE_ADDR_INT,READ_ADDR_INT);
146  D <= D_INT;
147  CHECK_DATA <= DO_READ;
148 
149 RD_AGEN_INST:ENTITY work.Ethernet_RAM_TB_AGEN
150  GENERIC MAP(
151  C_MAX_DEPTH => 2048
152  )
153  PORT MAP(
154  CLK => CLK,
155  RST => RST,
156  EN => DO_READ ,
157  LOAD => '0',
158  LOAD_VALUE => ZERO,
159  ADDR_OUT => READ_ADDR
160  );
161 
162 WR_AGEN_INST:ENTITY work.Ethernet_RAM_TB_AGEN
163  GENERIC MAP(
164  C_MAX_DEPTH => 2048 )
165  PORT MAP(
166  CLK => CLK,
167  RST => RST,
168  EN => DO_WRITE,
169  LOAD => '0',
170  LOAD_VALUE => ZERO,
171  ADDR_OUT => WRITE_ADDR
172  );
173 
174 WR_DGEN_INST:ENTITY work.Ethernet_RAM_TB_DGEN
175  GENERIC MAP (
176  DATA_GEN_WIDTH => 64,
177  DOUT_WIDTH => 64,
178  DATA_PART_CNT => DATA_PART_CNT_A,
179  SEED => 2
180  )
181  PORT MAP (
182  CLK => CLK,
183  RST => RST,
184  EN => DO_WRITE ,
185  DATA_OUT => D_INT
186  );
187 
188 WR_RD_PROCESS: PROCESS (CLK)
189 BEGIN
190  IF(RISING_EDGE(CLK)) THEN
191  IF(RST='1') THEN
192  DO_WRITE <= '0';
193  DO_READ <= '0';
194  COUNT_NO <= 0 ;
195  ELSIF(COUNT_NO < 4) THEN
196  DO_WRITE <= '1';
197  DO_READ <= '0';
198  COUNT_NO <= COUNT_NO + 1;
199  ELSIF(COUNT_NO< 8) THEN
200  DO_WRITE <= '0';
201  DO_READ <= '1';
202  COUNT_NO <= COUNT_NO + 1;
203  ELSIF(COUNT_NO=8) THEN
204  DO_WRITE <= '0';
205  DO_READ <= '0';
206  COUNT_NO <= 0 ;
207  END IF;
208  END IF;
209 END PROCESS;
210 
211 BEGIN_SHIFT_REG: FOR I IN 0 TO 4 GENERATE
212 BEGIN
213  DFF_RIGHT: IF I=0 GENERATE
214  BEGIN
215  SHIFT_INST_0: ENTITY work.REGISTER_LOGIC_SRAM
216  PORT MAP(
217  Q => DO_READ_REG(0),
218  CLK => CLK,
219  RST => RST,
220  D => DO_READ
221  );
222  END GENERATE DFF_RIGHT;
223  DFF_OTHERS: IF ((I>0) AND (I<=4)) GENERATE
224  BEGIN
225  SHIFT_INST: ENTITY work.REGISTER_LOGIC_SRAM
226  PORT MAP(
227  Q => DO_READ_REG (I),
228  CLK => CLK,
229  RST => RST,
230  D => DO_READ_REG (I-1)
231  );
232  END GENERATE DFF_OTHERS;
233 END GENERATE BEGIN_SHIFT_REG;
234 
235 
236  WE <= IF_THEN_ELSE(DO_WRITE='1','1','0') ;
237 
238 END ARCHITECTURE;