1 |
2 |
john_fpga |
--*****************************************************************************
|
2 |
|
|
-- DISCLAIMER OF LIABILITY
|
3 |
|
|
--
|
4 |
|
|
-- This file contains proprietary and confidential information of
|
5 |
|
|
-- Xilinx, Inc. ("Xilinx"), that is distributed under a license
|
6 |
|
|
-- from Xilinx, and may be used, copied and/or disclosed only
|
7 |
|
|
-- pursuant to the terms of a valid license agreement with Xilinx.
|
8 |
|
|
--
|
9 |
|
|
-- XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION
|
10 |
|
|
-- ("MATERIALS") "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
11 |
|
|
-- EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING WITHOUT
|
12 |
|
|
-- LIMITATION, ANY WARRANTY WITH RESPECT TO NONINFRINGEMENT,
|
13 |
|
|
-- MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Xilinx
|
14 |
|
|
-- does not warrant that functions included in the Materials will
|
15 |
|
|
-- meet the requirements of Licensee, or that the operation of the
|
16 |
|
|
-- Materials will be uninterrupted or error-free, or that defects
|
17 |
|
|
-- in the Materials will be corrected. Furthermore, Xilinx does
|
18 |
|
|
-- not warrant or make any representations regarding use, or the
|
19 |
|
|
-- results of the use, of the Materials in terms of correctness,
|
20 |
|
|
-- accuracy, reliability or otherwise.
|
21 |
|
|
--
|
22 |
|
|
-- Xilinx products are not designed or intended to be fail-safe,
|
23 |
|
|
-- or for use in any application requiring fail-safe performance,
|
24 |
|
|
-- such as life-support or safety devices or systems, Class III
|
25 |
|
|
-- medical devices, nuclear facilities, applications related to
|
26 |
|
|
-- the deployment of airbags, or any other applications that could
|
27 |
|
|
-- lead to death, personal injury or severe property or
|
28 |
|
|
-- environmental damage (individually and collectively, "critical
|
29 |
|
|
-- applications"). Customer assumes the sole risk and liability
|
30 |
|
|
-- of any use of Xilinx products in critical applications,
|
31 |
|
|
-- subject only to applicable laws and regulations governing
|
32 |
|
|
-- limitations on product liability.
|
33 |
|
|
--
|
34 |
|
|
-- Copyright 2005, 2006, 2007, 2008 Xilinx, Inc.
|
35 |
|
|
-- All rights reserved.
|
36 |
|
|
--
|
37 |
|
|
-- This disclaimer and copyright notice must be retained as part
|
38 |
|
|
-- of this file at all times.
|
39 |
|
|
--*****************************************************************************
|
40 |
|
|
-- ____ ____
|
41 |
|
|
-- / /\/ /
|
42 |
|
|
-- /___/ \ / Vendor : Xilinx
|
43 |
|
|
-- \ \ \/ Version : 3.6.1
|
44 |
|
|
-- \ \ Application : MIG
|
45 |
|
|
-- / / Filename : DDR2_Ram_Core_data_read_0.vhd
|
46 |
|
|
-- /___/ /\ Date Last Modified : $Date: 2010/11/26 18:25:42 $
|
47 |
|
|
-- \ \ / \ Date Created : Mon May 2 2005
|
48 |
|
|
-- \___\/\___\
|
49 |
|
|
-- Device : Spartan-3/3A/3A-DSP
|
50 |
|
|
-- Design Name : DDR2 SDRAM
|
51 |
|
|
-- Purpose : ram8d modules are instantiated for Read data FIFOs. ram8d is
|
52 |
|
|
-- each 8 bits or 4 bits depending on number data bits per strobe.
|
53 |
|
|
-- Each strobe will have two instances, one for rising edge data
|
54 |
|
|
-- and one for falling edge data.
|
55 |
|
|
--*****************************************************************************
|
56 |
|
|
library ieee;
|
57 |
|
|
library UNISIM;
|
58 |
|
|
use ieee.std_logic_1164.all;
|
59 |
|
|
use ieee.std_logic_unsigned.all;
|
60 |
|
|
use UNISIM.VCOMPONENTS.all;
|
61 |
|
|
use work.DDR2_Ram_Core_parameters_0.all;
|
62 |
|
|
|
63 |
|
|
entity DDR2_Ram_Core_data_read_0 is
|
64 |
|
|
port(
|
65 |
|
|
clk90 : in std_logic;
|
66 |
|
|
reset90 : in std_logic;
|
67 |
|
|
ddr_dq_in : in std_logic_vector((DATA_WIDTH-1) downto 0);
|
68 |
|
|
fifo_0_wr_en : in std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
|
69 |
|
|
fifo_1_wr_en : in std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
|
70 |
|
|
fifo_0_wr_addr : in std_logic_vector((4*DATA_STROBE_WIDTH)-1 downto 0);
|
71 |
|
|
fifo_1_wr_addr : in std_logic_vector((4*DATA_STROBE_WIDTH)-1 downto 0);
|
72 |
|
|
dqs_delayed_col0 : in std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
|
73 |
|
|
dqs_delayed_col1 : in std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
|
74 |
|
|
read_fifo_rden : in std_logic;
|
75 |
|
|
user_output_data : out std_logic_vector((2*DATA_WIDTH-1) downto 0);
|
76 |
|
|
u_data_val : out std_logic
|
77 |
|
|
);
|
78 |
|
|
end DDR2_Ram_Core_data_read_0;
|
79 |
|
|
|
80 |
|
|
architecture arc of DDR2_Ram_Core_data_read_0 is
|
81 |
|
|
|
82 |
|
|
component DDR2_Ram_Core_rd_gray_cntr
|
83 |
|
|
port (
|
84 |
|
|
clk90 : in std_logic;
|
85 |
|
|
reset90 : in std_logic;
|
86 |
|
|
cnt_en : in std_logic;
|
87 |
|
|
rgc_gcnt : out std_logic_vector(3 downto 0)
|
88 |
|
|
);
|
89 |
|
|
end component;
|
90 |
|
|
|
91 |
|
|
component DDR2_Ram_Core_ram8d_0 is
|
92 |
|
|
port (
|
93 |
|
|
DOUT : out std_logic_vector((DATABITSPERSTROBE -1) downto 0);
|
94 |
|
|
WADDR : in std_logic_vector(3 downto 0);
|
95 |
|
|
DIN : in std_logic_vector((DATABITSPERSTROBE -1) downto 0);
|
96 |
|
|
RADDR : in std_logic_vector(3 downto 0);
|
97 |
|
|
WCLK0 : in std_logic;
|
98 |
|
|
WCLK1 : in std_logic;
|
99 |
|
|
WE : in std_logic
|
100 |
|
|
);
|
101 |
|
|
end component;
|
102 |
|
|
|
103 |
|
|
signal fifo0_rd_addr : std_logic_vector(3 downto 0);
|
104 |
|
|
signal fifo1_rd_addr : std_logic_vector(3 downto 0);
|
105 |
|
|
|
106 |
|
|
signal first_sdr_data : std_logic_vector((2*DATA_WIDTH-1) downto 0);
|
107 |
|
|
signal reset90_r : std_logic;
|
108 |
|
|
signal fifo0_rd_addr_r : std_logic_vector((4*DATA_STROBE_WIDTH-1) downto 0);
|
109 |
|
|
signal fifo1_rd_addr_r : std_logic_vector((4*DATA_STROBE_WIDTH-1) downto 0);
|
110 |
|
|
signal fifo_0_data_out : std_logic_vector((DATA_WIDTH-1) downto 0);
|
111 |
|
|
signal fifo_1_data_out : std_logic_vector((DATA_WIDTH-1) downto 0);
|
112 |
|
|
signal fifo_0_data_out_r : std_logic_vector((DATA_WIDTH-1) downto 0);
|
113 |
|
|
signal fifo_1_data_out_r : std_logic_vector((DATA_WIDTH-1) downto 0);
|
114 |
|
|
signal dqs_delayed_col0_n : std_logic_vector((DATA_STROBE_WIDTH -1) downto 0);
|
115 |
|
|
signal dqs_delayed_col1_n : std_logic_vector((DATA_STROBE_WIDTH -1) downto 0);
|
116 |
|
|
|
117 |
|
|
signal read_fifo_rden_90r1 : std_logic;
|
118 |
|
|
signal read_fifo_rden_90r2 : std_logic;
|
119 |
|
|
signal read_fifo_rden_90r3 : std_logic;
|
120 |
|
|
signal read_fifo_rden_90r4 : std_logic;
|
121 |
|
|
signal read_fifo_rden_90r5 : std_logic;
|
122 |
|
|
signal read_fifo_rden_90r6 : std_logic;
|
123 |
|
|
|
124 |
|
|
attribute syn_preserve : boolean;
|
125 |
|
|
|
126 |
|
|
attribute syn_preserve of fifo0_rd_addr_r : signal is true;
|
127 |
|
|
attribute syn_preserve of fifo1_rd_addr_r : signal is true;
|
128 |
|
|
|
129 |
|
|
begin
|
130 |
|
|
|
131 |
|
|
process(clk90)
|
132 |
|
|
begin
|
133 |
|
|
if(clk90'event and clk90='1') then
|
134 |
|
|
reset90_r <= reset90;
|
135 |
|
|
end if;
|
136 |
|
|
end process;
|
137 |
|
|
|
138 |
|
|
gen_asgn : for asgn_i in 0 to DATA_STROBE_WIDTH-1 generate
|
139 |
|
|
dqs_delayed_col0_n(asgn_i) <= not dqs_delayed_col0(asgn_i);
|
140 |
|
|
dqs_delayed_col1_n(asgn_i) <= not dqs_delayed_col1(asgn_i);
|
141 |
|
|
end generate;
|
142 |
|
|
|
143 |
|
|
user_output_data <= first_sdr_data;
|
144 |
|
|
u_data_val <= read_fifo_rden_90r6;
|
145 |
|
|
|
146 |
|
|
-- Read fifo read enable signal phase is changed from 180 to 90 clock domain
|
147 |
|
|
|
148 |
|
|
process (clk90)
|
149 |
|
|
begin
|
150 |
|
|
if (rising_edge(clk90)) then
|
151 |
|
|
if reset90_r = '1' then
|
152 |
|
|
read_fifo_rden_90r1 <= '0';
|
153 |
|
|
read_fifo_rden_90r2 <= '0';
|
154 |
|
|
read_fifo_rden_90r3 <= '0';
|
155 |
|
|
read_fifo_rden_90r4 <= '0';
|
156 |
|
|
read_fifo_rden_90r5 <= '0';
|
157 |
|
|
read_fifo_rden_90r6<= '0';
|
158 |
|
|
else
|
159 |
|
|
read_fifo_rden_90r1 <= read_fifo_rden;
|
160 |
|
|
read_fifo_rden_90r2 <= read_fifo_rden_90r1;
|
161 |
|
|
read_fifo_rden_90r3 <= read_fifo_rden_90r2;
|
162 |
|
|
read_fifo_rden_90r4 <= read_fifo_rden_90r3;
|
163 |
|
|
read_fifo_rden_90r5 <= read_fifo_rden_90r4;
|
164 |
|
|
read_fifo_rden_90r6 <= read_fifo_rden_90r5;
|
165 |
|
|
end if;
|
166 |
|
|
end if;
|
167 |
|
|
end process;
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
process(clk90)
|
171 |
|
|
begin
|
172 |
|
|
if clk90'event and clk90 = '1' then
|
173 |
|
|
fifo_0_data_out_r <= fifo_0_data_out;
|
174 |
|
|
fifo_1_data_out_r <= fifo_1_data_out;
|
175 |
|
|
end if;
|
176 |
|
|
end process;
|
177 |
|
|
|
178 |
|
|
gen_addr : for addr_i in 0 to DATA_STROBE_WIDTH-1 generate
|
179 |
|
|
process(clk90)
|
180 |
|
|
begin
|
181 |
|
|
if clk90'event and clk90 = '1' then
|
182 |
|
|
fifo0_rd_addr_r((addr_i*4-1)+ 4 downto addr_i*4) <= fifo0_rd_addr;
|
183 |
|
|
fifo1_rd_addr_r((addr_i*4-1)+ 4 downto addr_i*4) <= fifo1_rd_addr;
|
184 |
|
|
end if;
|
185 |
|
|
end process;
|
186 |
|
|
end generate;
|
187 |
|
|
|
188 |
|
|
process(clk90)
|
189 |
|
|
begin
|
190 |
|
|
if clk90'event and clk90 = '1' then
|
191 |
|
|
if reset90_r = '1' then
|
192 |
|
|
first_sdr_data <= (others => '0');
|
193 |
|
|
elsif (read_fifo_rden_90r5 = '1') then
|
194 |
|
|
first_sdr_data <= (fifo_0_data_out_r & fifo_1_data_out_r);
|
195 |
|
|
else
|
196 |
|
|
first_sdr_data <= first_sdr_data;
|
197 |
|
|
end if;
|
198 |
|
|
end if;
|
199 |
|
|
end process;
|
200 |
|
|
|
201 |
|
|
------------------------------------------------------------------------------
|
202 |
|
|
-- fifo0_rd_addr and fifo1_rd_addr counters ( gray counters )
|
203 |
|
|
-------------------------------------------------------------------------------
|
204 |
|
|
|
205 |
|
|
fifo0_rd_addr_inst : DDR2_Ram_Core_rd_gray_cntr
|
206 |
|
|
port map (
|
207 |
|
|
clk90 => clk90,
|
208 |
|
|
reset90 => reset90,
|
209 |
|
|
cnt_en => read_fifo_rden_90r3,
|
210 |
|
|
rgc_gcnt => fifo0_rd_addr
|
211 |
|
|
);
|
212 |
|
|
fifo1_rd_addr_inst : DDR2_Ram_Core_rd_gray_cntr
|
213 |
|
|
port map (
|
214 |
|
|
clk90 => clk90,
|
215 |
|
|
reset90 => reset90,
|
216 |
|
|
cnt_en => read_fifo_rden_90r3,
|
217 |
|
|
rgc_gcnt => fifo1_rd_addr
|
218 |
|
|
);
|
219 |
|
|
|
220 |
|
|
-------------------------------------------------------------------------------
|
221 |
|
|
-- ram8d instantiations
|
222 |
|
|
-------------------------------------------------------------------------------
|
223 |
|
|
|
224 |
|
|
gen_strobe: for strobe_i in 0 to DATA_STROBE_WIDTH-1 generate
|
225 |
|
|
strobe : DDR2_Ram_Core_ram8d_0
|
226 |
|
|
Port Map (
|
227 |
|
|
dout => fifo_0_data_out((strobe_i*DATABITSPERSTROBE-1)+ DATABITSPERSTROBE downto strobe_i*DATABITSPERSTROBE),
|
228 |
|
|
waddr => fifo_0_wr_addr((strobe_i*4-1)+4 downto strobe_i*4),
|
229 |
|
|
din => ddr_dq_in((strobe_i*DATABITSPERSTROBE-1)+ DATABITSPERSTROBE downto strobe_i*DATABITSPERSTROBE),
|
230 |
|
|
raddr => fifo0_rd_addr_r((strobe_i*4-1)+4 downto strobe_i*4),
|
231 |
|
|
wclk0 => dqs_delayed_col0(strobe_i),
|
232 |
|
|
wclk1 => dqs_delayed_col1(strobe_i),
|
233 |
|
|
we => fifo_0_wr_en(strobe_i)
|
234 |
|
|
);
|
235 |
|
|
strobe_n : DDR2_Ram_Core_ram8d_0
|
236 |
|
|
Port Map (
|
237 |
|
|
dout => fifo_1_data_out((strobe_i*DATABITSPERSTROBE-1)+ DATABITSPERSTROBE downto strobe_i*DATABITSPERSTROBE),
|
238 |
|
|
waddr => fifo_1_wr_addr((strobe_i*4-1)+4 downto strobe_i*4),
|
239 |
|
|
din => ddr_dq_in((strobe_i*DATABITSPERSTROBE-1)+ DATABITSPERSTROBE downto strobe_i*DATABITSPERSTROBE),
|
240 |
|
|
raddr => fifo1_rd_addr_r((strobe_i*4-1)+4 downto strobe_i*4),
|
241 |
|
|
wclk0 => dqs_delayed_col0_n(strobe_i),
|
242 |
|
|
wclk1 => dqs_delayed_col1_n(strobe_i),
|
243 |
|
|
we => fifo_1_wr_en(strobe_i)
|
244 |
|
|
);
|
245 |
|
|
end generate;
|
246 |
|
|
|
247 |
|
|
end arc;
|