OpenCores
URL https://opencores.org/ocsvn/ddr2_sdram/ddr2_sdram/trunk

Subversion Repositories ddr2_sdram

[/] [ddr2_sdram/] [trunk/] [ipcore_dir/] [DDR2_Ram_Core/] [user_design/] [rtl/] [DDR2_Ram_Core_data_read_controller_0.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
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_controller_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
-- Description : This module has instantiations fifo_0_wr_en, fifo_1_wr_en,
52
--               dqs_delay and wr_gray_cntr.
53
--*****************************************************************************
54
library ieee;
55
library UNISIM;
56
use ieee.std_logic_1164.all;
57
use ieee.std_logic_unsigned.all;
58
use UNISIM.VCOMPONENTS.all;
59
use work.DDR2_Ram_Core_parameters_0.all;
60
 
61
entity DDR2_Ram_Core_data_read_controller_0 is
62
  port(
63
    clk                   : in  std_logic;
64
    reset                 : in  std_logic;
65
    rst_dqs_div_in        : in  std_logic;
66
    delay_sel             : in  std_logic_vector(4 downto 0);
67
    dqs_int_delay_in      : in std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
68
    fifo_0_wr_en_val      : out std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
69
    fifo_1_wr_en_val      : out std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
70
    fifo_0_wr_addr_val    : out std_logic_vector((4*DATA_STROBE_WIDTH)-1 downto 0);
71
    fifo_1_wr_addr_val    : out std_logic_vector((4*DATA_STROBE_WIDTH)-1 downto 0);
72
    dqs_delayed_col0_val  : out std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
73
    dqs_delayed_col1_val  : out std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
74
    -- debug signals
75
    vio_out_dqs           : in  std_logic_vector(4 downto 0);
76
    vio_out_dqs_en        : in  std_logic;
77
    vio_out_rst_dqs_div   : in  std_logic_vector(4 downto 0);
78
    vio_out_rst_dqs_div_en: in  std_logic
79
    );
80
 
81
end DDR2_Ram_Core_data_read_controller_0;
82
 
83
architecture arc of DDR2_Ram_Core_data_read_controller_0 is
84
 
85
  component DDR2_Ram_Core_dqs_delay
86
    port (
87
      clk_in  : in  std_logic;
88
      sel_in  : in  std_logic_vector(4 downto 0);
89
      clk_out : out std_logic
90
      );
91
  end component;
92
 
93
-- wr_gray_cntr is a gray counter with an ASYNC reset for fifo wr_addr
94
 
95
  component DDR2_Ram_Core_wr_gray_cntr
96
    port (
97
      clk      : in  std_logic;
98
      reset    : in  std_logic;
99
      cnt_en   : in  std_logic;
100
      wgc_gcnt : out std_logic_vector(3 downto 0)
101
      );
102
  end component;
103
 
104
-- fifo_wr_en module generates fifo write enable signal
105
-- enable is derived from rst_dqs_div signal
106
 
107
  component DDR2_Ram_Core_fifo_0_wr_en_0
108
    port (
109
      clk             : in  std_logic;
110
      reset           : in  std_logic;
111
      din             : in  std_logic;
112
      rst_dqs_delay_n : out std_logic;
113
      dout            : out std_logic
114
      );
115
  end component;
116
 
117
  component DDR2_Ram_Core_fifo_1_wr_en_0
118
    port (
119
      clk             : in  std_logic;
120
      rst_dqs_delay_n : in  std_logic;
121
      reset           : in  std_logic;
122
      din             : in  std_logic;
123
      dout            : out std_logic
124
      );
125
  end component;
126
 
127
 
128
  signal dqs_delayed_col0    : std_logic_vector((data_strobe_width-1) downto 0);
129
  signal dqs_delayed_col1    : std_logic_vector((data_strobe_width-1) downto 0);
130
  signal fifo_0_wr_addr      : std_logic_vector((4*DATA_STROBE_WIDTH)-1 downto 0);
131
  signal fifo_1_wr_addr      : std_logic_vector((4*DATA_STROBE_WIDTH)-1 downto 0);
132
 
133
-- FIFO WRITE ENABLE SIGNALS
134
  signal fifo_0_wr_en        : std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
135
  signal fifo_1_wr_en        : std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
136
 
137
 
138
  signal rst_dqs_div         : std_logic;
139
  signal reset_r             : std_logic;
140
  signal rst_dqs_delay_0_n   : std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
141
  signal dqs_delayed_col0_n  : std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
142
  signal dqs_delayed_col1_n  : std_logic_vector((DATA_STROBE_WIDTH-1) downto 0);
143
  signal delay_sel_rst_dqs_div : std_logic_vector(4 downto 0);
144
  signal delay_sel_dqs         : std_logic_vector(4 downto 0);
145
 
146
  attribute syn_preserve  : boolean;
147
  attribute buffer_type   : string;
148
  attribute buffer_type  of  dqs_delayed_col0: signal is "none";
149
  attribute buffer_type  of  dqs_delayed_col1: signal is "none";
150
 
151
begin
152
 
153
  process(clk)
154
  begin
155
    if(clk'event and clk = '1') then
156
      reset_r <= reset;
157
    end if;
158
  end process;
159
 
160
 
161
  fifo_0_wr_addr_val   <= fifo_0_wr_addr;
162
  fifo_1_wr_addr_val   <= fifo_1_wr_addr;
163
  fifo_0_wr_en_val     <= fifo_0_wr_en;
164
  fifo_1_wr_en_val     <= fifo_1_wr_en;
165
  dqs_delayed_col0_val <= dqs_delayed_col0 ;
166
  dqs_delayed_col1_val <= dqs_delayed_col1 ;
167
 
168
  gen_asgn : for asgn_i in 0 to DATA_STROBE_WIDTH-1 generate
169
    dqs_delayed_col0_n(asgn_i) <= not dqs_delayed_col0(asgn_i);
170
    dqs_delayed_col1_n(asgn_i) <= not dqs_delayed_col1(asgn_i);
171
  end generate;
172
 
173
 
174
 
175
 
176
  debug_rst_dqs_div_ena : if (DEBUG_EN = 1) generate
177
    delay_sel_rst_dqs_div <= vio_out_rst_dqs_div(4 downto 0) when  (vio_out_rst_dqs_div_en = '1')
178
                                             else delay_sel;
179
  end generate;
180
 
181
  debug_rst_dqs_div_dis : if (DEBUG_EN = 0) generate
182
    delay_sel_rst_dqs_div <= delay_sel;
183
  end generate;
184
 
185
 
186
-- delayed rst_dqs_div logic
187
 
188
  rst_dqs_div_delayed : DDR2_Ram_Core_dqs_delay
189
    port map (
190
      clk_in  => rst_dqs_div_in,
191
      sel_in  => delay_sel_rst_dqs_div,
192
      clk_out => rst_dqs_div
193
      );
194
 
195
 
196
  debug_ena : if (DEBUG_EN = 1) generate
197
    delay_sel_dqs <= vio_out_dqs(4 downto 0) when  (vio_out_dqs_en = '1')
198
                                             else delay_sel;
199
  end generate;
200
 
201
  debug_dis : if (DEBUG_EN = 0) generate
202
    delay_sel_dqs <= delay_sel;
203
  end generate;
204
 
205
 
206
--******************************************************************************
207
-- DQS Internal Delay Circuit implemented in LUTs
208
--******************************************************************************
209
    gen_delay: for dly_i in 0 to DATA_STROBE_WIDTH-1 generate
210
    attribute syn_preserve of  dqs_delay_col0: label is true;
211
    attribute syn_preserve of  dqs_delay_col1: label is true;
212
  begin
213
 -- Internal Clock Delay circuit placed in the first
214
   -- column (for falling edge data) adjacent to IOBs
215
    dqs_delay_col0 : DDR2_Ram_Core_dqs_delay
216
      port map (
217
        clk_in  => dqs_int_delay_in(dly_i),
218
        sel_in  => delay_sel_dqs,
219
        clk_out => dqs_delayed_col0(dly_i)
220
       );
221
  -- Internal Clock Delay circuit placed in the second
222
  --column (for rising edge data) adjacent to IOBs
223
    dqs_delay_col1 : DDR2_Ram_Core_dqs_delay
224
      port map (
225
        clk_in  => dqs_int_delay_in(dly_i),
226
        sel_in  => delay_sel_dqs,
227
        clk_out => dqs_delayed_col1(dly_i)
228
        );
229
  end generate;
230
 
231
-------------------------------------------------------------------------------
232
-------------------------------------------------------------------------------
233
 
234
  gen_wr_en: for wr_en_i in 0 to DATA_STROBE_WIDTH-1 generate
235
    fifo_0_wr_en_inst: DDR2_Ram_Core_fifo_0_wr_en_0
236
      port map (
237
        clk             => dqs_delayed_col1_n (wr_en_i),
238
        reset           => reset_r,
239
        din             => rst_dqs_div,
240
        rst_dqs_delay_n => rst_dqs_delay_0_n(wr_en_i),
241
        dout            => fifo_0_wr_en(wr_en_i)
242
        );
243
    fifo_1_wr_en_inst: DDR2_Ram_Core_fifo_1_wr_en_0
244
      port map (
245
        clk             => dqs_delayed_col0(wr_en_i),
246
        rst_dqs_delay_n => rst_dqs_delay_0_n(wr_en_i),
247
        reset           => reset_r,
248
        din             => rst_dqs_div,
249
        dout            => fifo_1_wr_en(wr_en_i)
250
        );
251
  end generate;
252
 
253
-------------------------------------------------------------------------------
254
-- write pointer gray counter instances
255
-------------------------------------------------------------------------------
256
 
257
  gen_wr_addr: for wr_addr_i in 0 to DATA_STROBE_WIDTH-1 generate
258
    fifo_0_wr_addr_inst : DDR2_Ram_Core_wr_gray_cntr
259
      port map (
260
        clk      => dqs_delayed_col1(wr_addr_i),
261
        reset    => reset_r,
262
        cnt_en   => fifo_0_wr_en(wr_addr_i),
263
        wgc_gcnt => fifo_0_wr_addr((wr_addr_i*4-1)+4 downto wr_addr_i*4)
264
        );
265
    fifo_1_wr_addr_inst : DDR2_Ram_Core_wr_gray_cntr
266
      port map (
267
        clk      => dqs_delayed_col0_n(wr_addr_i),
268
        reset    => reset_r,
269
        cnt_en   => fifo_1_wr_en(wr_addr_i),
270
        wgc_gcnt => fifo_1_wr_addr((wr_addr_i*4-1)+4 downto wr_addr_i*4)
271
        );
272
  end generate;
273
 
274
end arc;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.