1 --*****************************************************************************
2 -- (c) Copyright 2008 -
2010 Xilinx, Inc.
All rights reserved.
4 -- This file contains confidential and proprietary information
5 -- of Xilinx, Inc. and is protected under U.S. and
6 -- international copyright and other intellectual property
10 -- This disclaimer is not a license and does not grant any
11 -- rights to the materials distributed herewith. Except as
12 -- otherwise provided in a valid license issued to you by
13 -- Xilinx, and to the maximum extent permitted by applicable
14 -- law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS"
AND
15 -- WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
16 -- AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
17 -- BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
18 -- INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
19 -- (2) Xilinx shall
not be liable (whether
in contract
or tort,
20 -- including negligence, or under any other theory of
21 -- liability) for any loss or damage of any kind or nature
22 -- related to, arising under or in connection with these
23 -- materials, including for any direct, or any indirect,
24 -- special, incidental, or consequential loss or damage
25 -- (including loss of data, profits, goodwill, or any type of
26 -- loss or damage suffered as a result of any action brought
27 -- by a third party) even if such damage or loss was
28 -- reasonably foreseeable or Xilinx had been advised of the
29 -- possibility of the same.
31 -- CRITICAL APPLICATIONS
32 -- Xilinx products are not designed or intended to be fail-
33 -- safe, or for use in any application requiring fail-safe
34 -- performance, such as life-support or safety devices or
35 -- systems, Class III medical devices, nuclear facilities,
36 -- applications related to the deployment of airbags, or any
37 -- other applications that could lead to death, personal
38 -- injury, or severe property or environmental damage
39 -- (individually and collectively, "Critical
40 -- Applications"). Customer assumes the sole risk and
41 -- liability of any use of Xilinx products in Critical
42 -- Applications, subject only to applicable laws and
43 -- regulations governing limitations on product liability.
45 -- THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
46 -- PART OF THIS FILE AT ALL TIMES.
48 --*****************************************************************************
51 -- /___/ \ / Vendor : Xilinx
52 -- \ \ \/ Version : 1.
5
53 -- \ \ Application : MIG
54 -- / / Filename : ddr_phy_top.vhd
55 -- /___/ /\ Date Last Modified : $date$
56 -- \ \ / \ Date Created : Jan 31 2012
60 --Design Name : DDR3 SDRAM
61 --Purpose : Top level memory interface block. Instantiates a clock
62 -- and reset generator, the memory controller, the phy and
63 -- the user interface blocks.
66 --*****************************************************************************
69 use ieee.std_logic_1164.
all;
70 use ieee.numeric_std.
all;
76 TCQ : := 100;
-- Register delay (simulation only)
77 AL : := "0";
-- Additive Latency option
78 BANK_WIDTH : := 3;
-- # of bank bits
79 BURST_MODE : := "8";
-- Burst length
80 BURST_TYPE : := "SEQ";
-- Burst type
81 CA_MIRROR : := "OFF";
-- C/A mirror opt for DDR3 dual rank
82 CK_WIDTH : := 1;
-- # of CK/CK# outputs to memory
84 COL_WIDTH : := 12;
-- column address width
85 CS_WIDTH : := 1;
-- # of unique CS outputs
86 CKE_WIDTH : := 1;
-- # of cke outputs
88 DM_WIDTH : := 8;
-- # of DM (data mask)
89 DQ_WIDTH : := 64;
-- # of DQ (data)
90 DQS_CNT_WIDTH : := 3;
-- = ceil(log2(DQS_WIDTH))
91 DQS_WIDTH : := 8;
-- # of DQS (strobe)
92 DRAM_TYPE : := "DDR3";
93 DRAM_WIDTH : := 8;
-- # of DQ per DQS
94 MASTER_PHY_CTL : := 0;
-- The bank number where master PHY_CONTROL resides
95 LP_DDR_CK_WIDTH : := 2;
96 DATA_IO_IDLE_PWRDWN : := "ON";
-- "ON" or "OFF"
97 -- Hard PHY parameters
98 PHYCTL_CMD_FIFO : := "FALSE";
99 -- five fields, one per possible I/O bank, 4 bits
in each field,
100 -- 1 per lane data=1/ctl=0
101 DATA_CTL_B0 : (3 downto 0) := X"c";
102 DATA_CTL_B1 : (3 downto 0) := X"f";
103 DATA_CTL_B2 : (3 downto 0) := X"f";
104 DATA_CTL_B3 : (3 downto 0) := X"f";
105 DATA_CTL_B4 : (3 downto 0) := X"f";
106 -- defines the byte lanes in I/O banks being used in the interface
107 -- 1- Used, 0- Unused
108 BYTE_LANES_B0 : (3 downto 0) := "1111";
109 BYTE_LANES_B1 : (3 downto 0) := "0000";
110 BYTE_LANES_B2 : (3 downto 0) := "0000";
111 BYTE_LANES_B3 : (3 downto 0) := "0000";
112 BYTE_LANES_B4 : (3 downto 0) := "0000";
113 -- defines the lanes in I/O banks being used in the interface. Each
114 -- = 1 I/O bank =
4 byte lanes =
48 lanes. 1-Used, 0-Unused
115 PHY_0_BITLANES : (47 downto 0) := X"000000000000";
116 PHY_1_BITLANES : (47 downto 0) := X"000000000000";
117 PHY_2_BITLANES : (47 downto 0) := X"000000000000";
119 -- control/address/data pin mapping parameters
120 CK_BYTE_MAP : (143 downto 0) := X"000000000000000000000000000000000000";
121 ADDR_MAP : (191 downto 0) := X"000000000000000000000000000000000000000000000000";
122 BANK_MAP : (35 downto 0) := X"000000000";
123 CAS_MAP : (11 downto 0) := X"000";
124 CKE_ODT_BYTE_MAP : (7 downto 0) := X"00";
125 CKE_MAP : (95 downto 0) := X"000000000000000000000000";
126 ODT_MAP : (95 downto 0) := X"000000000000000000000000";
127 CKE_ODT_AUX : := "FALSE";
128 CS_MAP : (119 downto 0) := X"000000000000000000000000000000";
129 PARITY_MAP : (11 downto 0) := X"000";
130 RAS_MAP : (11 downto 0) := X"000";
131 WE_MAP : (11 downto 0) := X"000";
133 : (143 downto 0) := X"000000000000000000000000000000000000";
134 DATA0_MAP : (95 downto 0) := X"000000000000000000000000";
135 DATA1_MAP : (95 downto 0) := X"000000000000000000000000";
136 DATA2_MAP : (95 downto 0) := X"000000000000000000000000";
137 DATA3_MAP : (95 downto 0) := X"000000000000000000000000";
138 DATA4_MAP : (95 downto 0) := X"000000000000000000000000";
139 DATA5_MAP : (95 downto 0) := X"000000000000000000000000";
140 DATA6_MAP : (95 downto 0) := X"000000000000000000000000";
141 DATA7_MAP : (95 downto 0) := X"000000000000000000000000";
142 DATA8_MAP : (95 downto 0) := X"000000000000000000000000";
143 DATA9_MAP : (95 downto 0) := X"000000000000000000000000";
144 DATA10_MAP : (95 downto 0) := X"000000000000000000000000";
145 DATA11_MAP : (95 downto 0) := X"000000000000000000000000";
146 DATA12_MAP : (95 downto 0) := X"000000000000000000000000";
147 DATA13_MAP : (95 downto 0) := X"000000000000000000000000";
148 DATA14_MAP : (95 downto 0) := X"000000000000000000000000";
149 DATA15_MAP : (95 downto 0) := X"000000000000000000000000";
150 DATA16_MAP : (95 downto 0) := X"000000000000000000000000";
151 DATA17_MAP : (95 downto 0) := X"000000000000000000000000";
152 MASK0_MAP : (107 downto 0) := X"000000000000000000000000000";
153 MASK1_MAP : (107 downto 0) := X"000000000000000000000000000";
155 -- This parameter must be set based on memory clock frequency
156 -- It must be set to 4 for frequencies above
533 MHz?? (undecided)
157 -- and set to 2 for 533 MHz
and below
158 PRE_REV3ES : := "OFF";
-- Delay O/Ps using Phaser_Out fine dly
159 nCK_PER_CLK : := 2;
-- # of memory CKs per fabric CLK
160 nCS_PER_RANK : := 1;
-- # of unique CS outputs per rank
161 ADDR_CMD_MODE : := "1T";
-- ADDR/CTRL timing: "2T", "1T"
162 IODELAY_HP_MODE : := "ON";
163 BANK_TYPE : := "HP_IO";
-- # = "HP_LP",
"HR_LP", "DEFAULT"
164 DATA_IO_PRIM_TYPE : := "DEFAULT";
-- # = "HP_LP",
"HR_LP", "DEFAULT"
165 IODELAY_GRP : := "IODELAY_MIG";
166 IBUF_LPWR_MODE : := "OFF";
-- input buffer low power option
167 OUTPUT_DRV : := "HIGH";
-- to calib_top
168 REG_CTRL : :=
"OFF"; --
to calib_top
169 RTT_NOM : := "60";
-- to calib_top
170 RTT_WR : := "120";
-- to calib_top
172 tRFC : := 110000;
-- pS
173 DDR2_DQSN_ENABLE : := "YES";
-- Enable differential DQS for DDR2
174 WRLVL : := "OFF";
-- to calib_top
175 DEBUG_PORT : := "OFF";
-- to calib_top
178 ROW_WIDTH : := 16;
-- DRAM address bus width
179 SLOT_1_CONFIG : (7 downto 0) := "00000000";
180 -- calibration Address. The address given below will be used for calibration
181 -- read and write operations.
182 CALIB_ROW_ADD : (15 downto 0) := X"0000";
-- Calibration row address
183 CALIB_COL_ADD : (11 downto 0) := X"000";
-- Calibration column address
184 CALIB_BA_ADD : (2 downto 0) := "000";
-- Calibration bank address
185 -- Simulation /debug options
186 SIM_BYPASS_INIT_CAL : := "OFF";
187 -- Parameter used to force skipping
188 -- or abbreviation of initialization
189 -- and calibration. Overrides
190 -- SIM_INIT_OPTION, SIM_CAL_OPTION,
191 -- and disables various other blocks
192 --parameter SIM_INIT_OPTION = "SKIP_PU_DLY", -- Skip various init steps
193 --parameter SIM_CAL_OPTION = "NONE", -- Skip various calib steps
194 REFCLK_FREQ : := 200.
0;
-- IODELAY ref clock freq (MHz)
195 USE_CS_PORT : := 1;
-- Support chip select output
196 USE_DM_PORT : := 1;
-- Support data mask output
197 USE_ODT_PORT : := 1;
-- Support ODT output
198 RD_PATH_REG : := 0 -- optional registers in the read path
199 -- to MC for timing improvement.
200 -- =1 enabled, = 0 disabled
203 clk : in ;
-- Fabric logic clock
204 -- To MC, calib_top, hard PHY
205 clk_ref : in ;
-- Idelay_ctrl reference clock
206 -- To hard PHY (external source)
207 freq_refclk : in ;
-- To hard PHY for Phasers
208 mem_refclk : in ;
-- Memory clock to hard PHY
209 pll_lock : in ;
-- System PLL lock signal
210 sync_pulse : in ;
-- 1/N sync pulse used to
211 -- synchronize all PHASERS
212 error : in ;
-- Support for TG error detect
213 rst_tg_mc : out ;
-- Support for TG error detect
215 device_temp : in (11 downto 0);
216 tempmon_sample_en : in ;
218 dbg_sel_pi_incdec : in ;
219 dbg_sel_po_incdec : in ;
220 dbg_byte_sel : in (DQS_CNT_WIDTH downto 0);
224 dbg_po_f_stg23_sel : in ;
226 dbg_idel_down_all : in ;
227 dbg_idel_down_cpt : in ;
228 dbg_idel_up_all : in ;
229 dbg_idel_up_cpt : in ;
230 dbg_sel_all_idel_cpt : in ;
231 dbg_sel_idel_cpt : in (DQS_CNT_WIDTH-1 downto 0);
233 slot_0_present : in (7 downto 0);
234 slot_1_present : in (7 downto 0);
236 mc_ras_n : in (nCK_PER_CLK-1 downto 0);
237 mc_cas_n : in (nCK_PER_CLK-1 downto 0);
238 mc_we_n : in (nCK_PER_CLK-1 downto 0);
239 mc_address : in (nCK_PER_CLK*ROW_WIDTH-1 downto 0);
240 mc_bank : in (nCK_PER_CLK*BANK_WIDTH-1 downto 0);
241 mc_cs_n : in (CS_WIDTH*nCS_PER_RANK*nCK_PER_CLK-1 downto 0);
243 mc_odt : in (1 downto 0);
244 mc_cke : in (nCK_PER_CLK-1 downto 0);
245 -- AUX - For ODT and CKE assertion during reads and writes
246 mc_aux_out0 : in (3 downto 0);
247 mc_aux_out1 : in (3 downto 0);
250 mc_cmd : in (2 downto 0);
251 mc_cas_slot : in (1 downto 0);
252 mc_data_offset : in (5 downto 0);
253 mc_data_offset_1 : in (5 downto 0);
254 mc_data_offset_2 : in (5 downto 0);
255 mc_rank_cnt : in (1 downto 0);
258 mc_wrdata : in (2*nCK_PER_CLK*DQ_WIDTH-1 downto 0);
259 mc_wrdata_mask : in ((2*nCK_PER_CLK*(DQ_WIDTH/8))-1 downto 0);
262 ddr_addr : out (ROW_WIDTH-1 downto 0);
263 ddr_ba : out (BANK_WIDTH-1 downto 0);
265 ddr_ck_n : out (CK_WIDTH-1 downto 0);
266 ddr_ck : out (CK_WIDTH-1 downto 0);
267 ddr_cke : out (CKE_WIDTH-1 downto 0);
268 ddr_cs_n : out ((CS_WIDTH*nCS_PER_RANK)-1 downto 0);
269 ddr_dm : out (DM_WIDTH-1 downto 0);
270 ddr_odt : out (ODT_WIDTH-1 downto 0);
275 ddr_dq : inout (DQ_WIDTH-1 downto 0);
276 ddr_dqs_n : inout (DQS_WIDTH-1 downto 0);
277 ddr_dqs : inout (DQS_WIDTH-1 downto 0);
279 dbg_calib_top : out (255 downto 0);
280 dbg_cpt_first_edge_cnt : out (6*DQS_WIDTH*RANKS-1 downto 0);
281 dbg_cpt_second_edge_cnt : out (6*DQS_WIDTH*RANKS-1 downto 0);
282 dbg_cpt_tap_cnt : out (6*DQS_WIDTH*RANKS-1 downto 0);
283 dbg_dq_idelay_tap_cnt : out (5*DQS_WIDTH*RANKS-1 downto 0);
284 dbg_phy_rdlvl : out (255 downto 0);
285 dbg_phy_wrcal : out (99 downto 0);
286 dbg_final_po_fine_tap_cnt : out (6*DQS_WIDTH-1 downto 0);
287 dbg_final_po_coarse_tap_cnt : out (3*DQS_WIDTH-1 downto 0);
288 dbg_rd_data_edge_detect : out (DQS_WIDTH-1 downto 0);
289 dbg_rddata : out (2*nCK_PER_CLK*DQ_WIDTH-1 downto 0);
290 dbg_rddata_valid : out ;
291 dbg_rdlvl_done : out (1 downto 0);
292 dbg_rdlvl_err : out (1 downto 0);
293 dbg_rdlvl_start : out (1 downto 0);
294 dbg_tap_cnt_during_wrlvl : out (5 downto 0);
295 dbg_wl_edge_detect_valid : out ;
296 dbg_wrlvl_done : out ;
297 dbg_wrlvl_err : out ;
298 dbg_wrlvl_start : out ;
299 dbg_wrlvl_fine_tap_cnt : out (6*DQS_WIDTH-1 downto 0);
300 dbg_wrlvl_coarse_tap_cnt : out (3*DQS_WIDTH-1 downto 0);
301 dbg_phy_wrlvl : out (255 downto 0);
302 dbg_pi_phaselock_start : out ;
303 dbg_pi_phaselocked_done : out ;
304 dbg_pi_phaselock_err : out ;
305 dbg_pi_phase_locked_phy4lanes : out (11 downto 0);
306 dbg_pi_dqsfound_start : out ;
307 dbg_pi_dqsfound_done : out ;
308 dbg_pi_dqsfound_err : out ;
309 dbg_pi_dqs_found_lanes_phy4lanes : out (11 downto 0);
310 dbg_wrcal_start : out ;
311 dbg_wrcal_done : out ;
312 dbg_wrcal_err : out ;
314 phy_mc_ctl_full : out ;
315 phy_mc_cmd_full : out ;
316 phy_mc_data_full : out ;
317 -- Calibration status and resultant outputs
318 init_calib_complete : out ;
319 init_wrcal_complete : out ;
320 calib_rd_data_offset_0 : out (6*RANKS-1 downto 0);
321 calib_rd_data_offset_1 : out (6*RANKS-1 downto 0);
322 calib_rd_data_offset_2 : out (6*RANKS-1 downto 0);
323 phy_rddata_valid : out ;
324 phy_rd_data : out (2*nCK_PER_CLK*DQ_WIDTH-1 downto 0);
327 rst_phaser_ref : in ;
328 dbg_rd_data_offset : out (6*RANKS-1 downto 0);
329 dbg_phy_init : out (255 downto 0);
330 dbg_prbs_rdlvl : out (255 downto 0);
331 dbg_dqs_found_cal : out (255 downto 0);
332 dbg_pi_counter_read_val : out (5 downto 0);
333 dbg_po_counter_read_val : out (8 downto 0);
334 dbg_oclkdelay_calib_start : out ;
335 dbg_oclkdelay_calib_done : out ;
336 dbg_phy_oclkdelay_cal : out (255 downto 0);
337 dbg_oclkdelay_rd_data : out (DRAM_WIDTH*16-1 downto 0)
344 -- function to OR the bits in a vectored signal
345 function OR_BR (inp_var: )
347 variable temp: := '0';
349 for idx in inp_var'range loop
350 temp := temp or inp_var(idx);
355 -- Calculate number of slots in the system
356 function CALC_nSLOTS return is
358 if (OR_BR(SLOT_1_CONFIG) = '1') then
365 function SIM_INIT_OPTION_W return is
367 if (SIM_BYPASS_INIT_CAL = "SKIP") then
368 return ("SKIP_INIT");
369 elsif (SIM_BYPASS_INIT_CAL = "FAST" or
370 SIM_BYPASS_INIT_CAL = "SIM_FULL") then
371 return ("SKIP_PU_DLY");
377 function SIM_CAL_OPTION_W return is
379 if (SIM_BYPASS_INIT_CAL = "SKIP") then
381 elsif (SIM_BYPASS_INIT_CAL = "FAST") then
383 elsif (SIM_BYPASS_INIT_CAL = "SIM_FULL" or
384 SIM_BYPASS_INIT_CAL = "SIM_INIT_CAL_FULL") then
385 return ("FAST_WIN_DETECT");
391 function CALC_WRLVL_W return is
393 if (SIM_BYPASS_INIT_CAL = "SKIP") then
400 function HIGHEST_BANK_W return is
402 if (BYTE_LANES_B4 /= "0000") then
404 elsif (BYTE_LANES_B3 /= "0000") then
406 elsif (BYTE_LANES_B2 /= "0000") then
408 elsif (BYTE_LANES_B1 /= "0000") then
415 function HIGHEST_LANE_B0_W return is
417 if (BYTE_LANES_B0(3) = '1') then
419 elsif (BYTE_LANES_B0(2) = '1') then
421 elsif (BYTE_LANES_B0(1) = '1') then
423 elsif (BYTE_LANES_B0(0) = '1') then
430 function HIGHEST_LANE_B1_W return is
432 if (BYTE_LANES_B1(3) = '1') then
434 elsif (BYTE_LANES_B1(2) = '1') then
436 elsif (BYTE_LANES_B1(1) = '1') then
438 elsif (BYTE_LANES_B1(0) = '1') then
445 function HIGHEST_LANE_B2_W return is
447 if (BYTE_LANES_B2(3) = '1') then
449 elsif (BYTE_LANES_B2(2) = '1') then
451 elsif (BYTE_LANES_B2(1) = '1') then
453 elsif (BYTE_LANES_B2(0) = '1') then
460 function HIGHEST_LANE_B3_W return is
462 if (BYTE_LANES_B3(3) = '1') then
464 elsif (BYTE_LANES_B3(2) = '1') then
466 elsif (BYTE_LANES_B3(1) = '1') then
468 elsif (BYTE_LANES_B3(0) = '1') then
475 function HIGHEST_LANE_B4_W return is
477 if (BYTE_LANES_B4(3) = '1') then
479 elsif (BYTE_LANES_B4(2) = '1') then
481 elsif (BYTE_LANES_B4(1) = '1') then
483 elsif (BYTE_LANES_B4(0) = '1') then
490 function HIGHEST_LANE_W return is
492 if (HIGHEST_LANE_B4_W /= 0) then
493 return (HIGHEST_LANE_B4_W+16);
494 elsif (HIGHEST_LANE_B3_W /= 0) then
495 return (HIGHEST_LANE_B3_W+12);
496 elsif (HIGHEST_LANE_B2_W /= 0) then
497 return (HIGHEST_LANE_B2_W+8);
498 elsif (HIGHEST_LANE_B1_W /= 0) then
499 return (HIGHEST_LANE_B1_W+4);
501 return (HIGHEST_LANE_B0_W);
505 function N_CTL_LANES_B0 return is
508 for idx in 0 to 3 loop
509 if (not(DATA_CTL_B0(idx)) = '1' and BYTE_LANES_B0(idx) = '1') then
518 function N_CTL_LANES_B1 return is
521 for idx in 0 to 3 loop
522 if (not(DATA_CTL_B1(idx)) = '1' and BYTE_LANES_B1(idx) = '1') then
531 function N_CTL_LANES_B2 return is
534 for idx in 0 to 3 loop
535 if (not(DATA_CTL_B2(idx)) = '1' and BYTE_LANES_B2(idx) = '1') then
544 function N_CTL_LANES_B3 return is
547 for idx in 0 to 3 loop
548 if (not(DATA_CTL_B3(idx)) = '1' and BYTE_LANES_B3(idx) = '1') then
557 function N_CTL_LANES_B4 return is
560 for idx in 0 to 3 loop
561 if (not(DATA_CTL_B4(idx)) = '1' and BYTE_LANES_B4(idx) = '1') then
570 function CTL_BANK_B0 return is
572 if ((not(DATA_CTL_B0(0)) = '1' and BYTE_LANES_B0(0) = '1') or
573 (not(DATA_CTL_B0(1)) = '1' and BYTE_LANES_B0(1) = '1') or
574 (not(DATA_CTL_B0(2)) = '1' and BYTE_LANES_B0(2) = '1') or
575 (not(DATA_CTL_B0(3)) = '1' and BYTE_LANES_B0(3) = '1')) then
582 function CTL_BANK_B1 return is
584 if ((not(DATA_CTL_B1(0)) = '1' and BYTE_LANES_B1(0) = '1') or
585 (not(DATA_CTL_B1(1)) = '1' and BYTE_LANES_B1(1) = '1') or
586 (not(DATA_CTL_B1(2)) = '1' and BYTE_LANES_B1(2) = '1') or
587 (not(DATA_CTL_B1(3)) = '1' and BYTE_LANES_B1(3) = '1')) then
594 function CTL_BANK_B2 return is
596 if ((not(DATA_CTL_B2(0)) = '1' and BYTE_LANES_B2(0) = '1') or
597 (not(DATA_CTL_B2(1)) = '1' and BYTE_LANES_B2(1) = '1') or
598 (not(DATA_CTL_B2(2)) = '1' and BYTE_LANES_B2(2) = '1') or
599 (not(DATA_CTL_B2(3)) = '1' and BYTE_LANES_B2(3) = '1')) then
606 function CTL_BANK_B3 return is
608 if ((not(DATA_CTL_B3(0)) = '1' and BYTE_LANES_B3(0) = '1') or
609 (not(DATA_CTL_B3(1)) = '1' and BYTE_LANES_B3(1) = '1') or
610 (not(DATA_CTL_B3(2)) = '1' and BYTE_LANES_B3(2) = '1') or
611 (not(DATA_CTL_B3(3)) = '1' and BYTE_LANES_B3(3) = '1')) then
618 function CTL_BANK_B4 return is
620 if ((not(DATA_CTL_B4(0)) = '1' and BYTE_LANES_B4(0) = '1') or
621 (not(DATA_CTL_B4(1)) = '1' and BYTE_LANES_B4(1) = '1') or
622 (not(DATA_CTL_B4(2)) = '1' and BYTE_LANES_B4(2) = '1') or
623 (not(DATA_CTL_B4(3)) = '1' and BYTE_LANES_B4(3) = '1')) then
630 function CTL_BANK_W return is
631 variable ctl_bank_var : (2 downto 0);
633 if (CTL_BANK_B0 = '1') then
634 ctl_bank_var := "000";
635 elsif (CTL_BANK_B1 = '1') then
636 ctl_bank_var := "001";
637 elsif (CTL_BANK_B2 = '1') then
638 ctl_bank_var := "010";
639 elsif (CTL_BANK_B3 = '1') then
640 ctl_bank_var := "011";
641 elsif (CTL_BANK_B4 = '1') then
642 ctl_bank_var := "100";
644 ctl_bank_var := "000";
646 return (ctl_bank_var);
649 function ODD_PARITY (inp_var : )
return is
650 variable tmp : := '0';
652 for idx in inp_var'range loop
653 tmp := tmp XOR inp_var(idx);
658 -- Calculate number of slots in the system
659 constant nSLOTS : := CALC_nSLOTS;
660 constant CLK_PERIOD : := tCK * nCK_PER_CLK;
662 -- Parameter used to force skipping or abbreviation of initialization
663 -- and calibration. Overrides SIM_INIT_OPTION, SIM_CAL_OPTION, and
664 -- disables various other blocks depending on the option selected
665 -- This option should only be used during simulation. In the case of
666 -- the "SKIP" option, the testbench used should also
not be modeling
667 -- propagation delays.
668 -- Allowable options = {"NONE", "SIM_FULL",
"SKIP", "FAST"}
669 -- "NONE" = options determined by the individual
parameter settings
670 -- "SIM_FULL" = skip power-up delay. FULL calibration performed without
671 -- averaging algorithm turned ON during window detection.
672 -- "SKIP" = skip power-up delay. Skip calibration
not yet supported.
673 -- "FAST" = skip power-up delay,
and calibrate (read leveling, write
674 -- leveling, and phase detector) only using one DQS group, and
675 -- apply the results to all other DQS groups.
676 constant SIM_INIT_OPTION : := SIM_INIT_OPTION_W;
677 constant SIM_CAL_OPTION : := SIM_CAL_OPTION_W;
678 constant WRLVL_W : := CALC_WRLVL_W;
680 constant HIGHEST_BANK : := HIGHEST_BANK_W;
682 -- constant HIGHEST_LANE_B0 = HIGHEST_LANE_B0_W;
683 -- constant HIGHEST_LANE_B1 = HIGHEST_LANE_B1_W;
684 -- constant HIGHEST_LANE_B2 = HIGHEST_LANE_B2_W;
685 -- constant HIGHEST_LANE_B3 = HIGHEST_LANE_B3_W;
686 -- constant HIGHEST_LANE_B4 = HIGHEST_LANE_B4_W;
688 constant HIGHEST_LANE : := HIGHEST_LANE_W;
690 constant N_CTL_LANES : := N_CTL_LANES_B0 + N_CTL_LANES_B1 + N_CTL_LANES_B2 + N_CTL_LANES_B3 + N_CTL_LANES_B4;
692 -- Assuming Ck/Addr/Cmd and Control are placed in a single IO Bank
693 -- This should be the case since the PLL should be placed adjacent
694 -- to the same IO Bank as Ck/Addr/Cmd and Control
695 constant CTL_BANK : (2 downto 0):= CTL_BANK_W;
697 function CTL_BYTE_LANE_W return is
698 variable ctl_byte_lane_var: (7 downto 0);
700 if (N_CTL_LANES = 4) then
701 ctl_byte_lane_var := "11100100";
702 elsif (N_CTL_LANES = 3 and
703 (((not(DATA_CTL_B0(0)) = '1') and BYTE_LANES_B0(0) = '1' and
704 (not(DATA_CTL_B0(1)) = '1') and BYTE_LANES_B0(1) = '1' and
705 (not(DATA_CTL_B0(2)) = '1') and BYTE_LANES_B0(2) = '1') or
706 ((not(DATA_CTL_B1(0)) = '1') and BYTE_LANES_B1(0) = '1' and
707 (not(DATA_CTL_B1(1)) = '1') and BYTE_LANES_B1(1) = '1' and
708 (not(DATA_CTL_B1(2)) = '1') and BYTE_LANES_B1(2) = '1') or
709 ((not(DATA_CTL_B2(0)) = '1') and BYTE_LANES_B2(0) = '1' and
710 (not(DATA_CTL_B2(1)) = '1') and BYTE_LANES_B2(1) = '1' and
711 (not(DATA_CTL_B2(2)) = '1') and BYTE_LANES_B2(2) = '1') or
712 ((not(DATA_CTL_B3(0)) = '1') and BYTE_LANES_B3(0) = '1' and
713 (not(DATA_CTL_B3(1)) = '1') and BYTE_LANES_B3(1) = '1' and
714 (not(DATA_CTL_B3(2)) = '1') and BYTE_LANES_B3(2) = '1') or
715 ((not(DATA_CTL_B4(0)) = '1') and BYTE_LANES_B4(0) = '1' and
716 (not(DATA_CTL_B4(1)) = '1') and BYTE_LANES_B4(1) = '1' and
717 (not(DATA_CTL_B4(2)) = '1') and BYTE_LANES_B4(2) = '1'))) then
718 ctl_byte_lane_var := "00100100";
719 elsif (N_CTL_LANES = 3 and
720 (((not(DATA_CTL_B0(0)) = '1') and BYTE_LANES_B0(0) = '1' and
721 (not(DATA_CTL_B0(1)) = '1') and BYTE_LANES_B0(1) = '1' and
722 (not(DATA_CTL_B0(3)) = '1') and BYTE_LANES_B0(3) = '1') or
723 ((not(DATA_CTL_B1(0)) = '1') and BYTE_LANES_B1(0) = '1' and
724 (not(DATA_CTL_B1(1)) = '1') and BYTE_LANES_B1(1) = '1' and
725 (not(DATA_CTL_B1(3)) = '1') and BYTE_LANES_B1(3) = '1') or
726 ((not(DATA_CTL_B2(0)) = '1') and BYTE_LANES_B2(0) = '1' and
727 (not(DATA_CTL_B2(1)) = '1') and BYTE_LANES_B2(1) = '1' and
728 (not(DATA_CTL_B2(3)) = '1') and BYTE_LANES_B2(3) = '1') or
729 ((not(DATA_CTL_B3(0)) = '1') and BYTE_LANES_B3(0) = '1' and
730 (not(DATA_CTL_B3(1)) = '1') and BYTE_LANES_B3(1) = '1' and
731 (not(DATA_CTL_B3(3)) = '1') and BYTE_LANES_B3(3) = '1') or
732 ((not(DATA_CTL_B4(0)) = '1') and BYTE_LANES_B4(0) = '1' and
733 (not(DATA_CTL_B4(1)) = '1') and BYTE_LANES_B4(1) = '1' and
734 (not(DATA_CTL_B4(3)) = '1') and BYTE_LANES_B4(3) = '1'))) then
735 ctl_byte_lane_var := "00110100";
736 elsif (N_CTL_LANES = 3 and
737 (((not(DATA_CTL_B0(0)) = '1') and BYTE_LANES_B0(0) = '1' and
738 (not(DATA_CTL_B0(2)) = '1') and BYTE_LANES_B0(2) = '1' and
739 (not(DATA_CTL_B0(3)) = '1') and BYTE_LANES_B0(3) = '1') or
740 ((not(DATA_CTL_B1(0)) = '1') and BYTE_LANES_B1(0) = '1' and
741 (not(DATA_CTL_B1(2)) = '1') and BYTE_LANES_B1(2) = '1' and
742 (not(DATA_CTL_B1(3)) = '1') and BYTE_LANES_B1(3) = '1') or
743 ((not(DATA_CTL_B2(0)) = '1') and BYTE_LANES_B2(0) = '1' and
744 (not(DATA_CTL_B2(2)) = '1') and BYTE_LANES_B2(2) = '1' and
745 (not(DATA_CTL_B2(3)) = '1') and BYTE_LANES_B2(3) = '1') or
746 ((not(DATA_CTL_B3(0)) = '1') and BYTE_LANES_B3(0) = '1' and
747 (not(DATA_CTL_B3(2)) = '1') and BYTE_LANES_B3(2) = '1' and
748 (not(DATA_CTL_B3(3)) = '1') and BYTE_LANES_B3(3) = '1') or
749 ((not(DATA_CTL_B4(0)) = '1') and BYTE_LANES_B4(0) = '1' and
750 (not(DATA_CTL_B4(2)) = '1') and BYTE_LANES_B4(2) = '1' and
751 (not(DATA_CTL_B4(3)) = '1') and BYTE_LANES_B4(3) = '1'))) then
752 ctl_byte_lane_var := "00111000";
753 elsif (N_CTL_LANES = 3 and
754 (((not(DATA_CTL_B0(0)) = '1') and BYTE_LANES_B0(0) = '1' and
755 (not(DATA_CTL_B0(2)) = '1') and BYTE_LANES_B0(2) = '1' and
756 (not(DATA_CTL_B0(3)) = '1') and BYTE_LANES_B0(3) = '1') or
757 ((not(DATA_CTL_B1(0)) = '1') and BYTE_LANES_B1(0) = '1' and
758 (not(DATA_CTL_B1(2)) = '1') and BYTE_LANES_B1(2) = '1' and
759 (not(DATA_CTL_B1(3)) = '1') and BYTE_LANES_B1(3) = '1') or
760 ((not(DATA_CTL_B2(0)) = '1') and BYTE_LANES_B2(0) = '1' and
761 (not(DATA_CTL_B2(2)) = '1') and BYTE_LANES_B2(2) = '1' and
762 (not(DATA_CTL_B2(3)) = '1') and BYTE_LANES_B2(3) = '1') or
763 ((not(DATA_CTL_B3(0)) = '1') and BYTE_LANES_B3(0) = '1' and
764 (not(DATA_CTL_B3(2)) = '1') and BYTE_LANES_B3(2) = '1' and
765 (not(DATA_CTL_B3(3)) = '1') and BYTE_LANES_B3(3) = '1') or
766 ((not(DATA_CTL_B4(0)) = '1') and BYTE_LANES_B4(0) = '1' and
767 (not(DATA_CTL_B4(2)) = '1') and BYTE_LANES_B4(2) = '1' and
768 (not(DATA_CTL_B4(3)) = '1') and BYTE_LANES_B4(3) = '1'))) then
769 ctl_byte_lane_var := "00111001";
770 elsif (N_CTL_LANES = 2 and
771 (((not(DATA_CTL_B0(0)) = '1') and BYTE_LANES_B0(0) = '1' and
772 (not(DATA_CTL_B0(1)) = '1') and BYTE_LANES_B0(1) = '1') or
773 ((not(DATA_CTL_B1(0)) = '1') and BYTE_LANES_B1(0) = '1' and
774 (not(DATA_CTL_B1(1)) = '1') and BYTE_LANES_B1(1) = '1') or
775 ((not(DATA_CTL_B2(0)) = '1') and BYTE_LANES_B2(0) = '1' and
776 (not(DATA_CTL_B2(1)) = '1') and BYTE_LANES_B2(1) = '1') or
777 ((not(DATA_CTL_B3(0)) = '1') and BYTE_LANES_B3(0) = '1' and
778 (not(DATA_CTL_B3(1)) = '1') and BYTE_LANES_B3(1) = '1') or
779 ((not(DATA_CTL_B4(0)) = '1') and BYTE_LANES_B4(0) = '1' and
780 (not(DATA_CTL_B4(1)) = '1') and BYTE_LANES_B4(1) = '1'))) then
781 ctl_byte_lane_var := "00000100";
782 elsif (N_CTL_LANES = 2 and
783 (((not(DATA_CTL_B0(0)) = '1') and BYTE_LANES_B0(0) = '1' and
784 (not(DATA_CTL_B0(3)) = '1') and BYTE_LANES_B0(3) = '1') or
785 ((not(DATA_CTL_B1(0)) = '1') and BYTE_LANES_B1(0) = '1' and
786 (not(DATA_CTL_B1(3)) = '1') and BYTE_LANES_B1(3) = '1') or
787 ((not(DATA_CTL_B2(0)) = '1') and BYTE_LANES_B2(0) = '1' and
788 (not(DATA_CTL_B2(3)) = '1') and BYTE_LANES_B2(3) = '1') or
789 ((not(DATA_CTL_B3(0)) = '1') and BYTE_LANES_B3(0) = '1' and
790 (not(DATA_CTL_B3(3)) = '1') and BYTE_LANES_B3(3) = '1') or
791 ((not(DATA_CTL_B4(0)) = '1') and BYTE_LANES_B4(0) = '1' and
792 (not(DATA_CTL_B4(3)) = '1') and BYTE_LANES_B4(3) = '1'))) then
793 ctl_byte_lane_var := "00001100";
794 elsif (N_CTL_LANES = 2 and
795 (((not(DATA_CTL_B0(2)) = '1') and BYTE_LANES_B0(2) = '1' and
796 (not(DATA_CTL_B0(3)) = '1') and BYTE_LANES_B0(3) = '1') or
797 ((not(DATA_CTL_B1(2)) = '1') and BYTE_LANES_B1(2) = '1' and
798 (not(DATA_CTL_B1(3)) = '1') and BYTE_LANES_B1(3) = '1') or
799 ((not(DATA_CTL_B2(2)) = '1') and BYTE_LANES_B2(2) = '1' and
800 (not(DATA_CTL_B2(3)) = '1') and BYTE_LANES_B2(3) = '1') or
801 ((not(DATA_CTL_B3(2)) = '1') and BYTE_LANES_B3(2) = '1' and
802 (not(DATA_CTL_B3(3)) = '1') and BYTE_LANES_B3(3) = '1') or
803 ((not(DATA_CTL_B4(2)) = '1') and BYTE_LANES_B4(2) = '1' and
804 (not(DATA_CTL_B4(3)) = '1') and BYTE_LANES_B4(3) = '1'))) then
805 ctl_byte_lane_var := "00001110";
806 elsif (N_CTL_LANES = 2 and
807 (((not(DATA_CTL_B0(1)) = '1') and BYTE_LANES_B0(1) = '1' and
808 (not(DATA_CTL_B0(2)) = '1') and BYTE_LANES_B0(2) = '1') or
809 ((not(DATA_CTL_B1(1)) = '1') and BYTE_LANES_B1(1) = '1' and
810 (not(DATA_CTL_B1(2)) = '1') and BYTE_LANES_B1(2) = '1') or
811 ((not(DATA_CTL_B2(1)) = '1') and BYTE_LANES_B2(1) = '1' and
812 (not(DATA_CTL_B2(2)) = '1') and BYTE_LANES_B2(2) = '1') or
813 ((not(DATA_CTL_B3(1)) = '1') and BYTE_LANES_B3(1) = '1' and
814 (not(DATA_CTL_B3(2)) = '1') and BYTE_LANES_B3(2) = '1') or
815 ((not(DATA_CTL_B4(1)) = '1') and BYTE_LANES_B4(1) = '1' and
816 (not(DATA_CTL_B4(2)) = '1') and BYTE_LANES_B4(2) = '1'))) then
817 ctl_byte_lane_var := "00001001";
818 elsif (N_CTL_LANES = 2 and
819 (((not(DATA_CTL_B0(1)) = '1') and BYTE_LANES_B0(1) = '1' and
820 (not(DATA_CTL_B0(3)) = '1') and BYTE_LANES_B0(3) = '1') or
821 ((not(DATA_CTL_B1(1)) = '1') and BYTE_LANES_B1(1) = '1' and
822 (not(DATA_CTL_B1(3)) = '1') and BYTE_LANES_B1(3) = '1') or
823 ((not(DATA_CTL_B2(1)) = '1') and BYTE_LANES_B2(1) = '1' and
824 (not(DATA_CTL_B2(3)) = '1') and BYTE_LANES_B2(3) = '1') or
825 ((not(DATA_CTL_B3(1)) = '1') and BYTE_LANES_B3(1) = '1' and
826 (not(DATA_CTL_B3(3)) = '1') and BYTE_LANES_B3(3) = '1') or
827 ((not(DATA_CTL_B4(1)) = '1') and BYTE_LANES_B4(1) = '1' and
828 (not(DATA_CTL_B4(3)) = '1') and BYTE_LANES_B4(3) = '1'))) then
829 ctl_byte_lane_var := "00001101";
830 elsif (N_CTL_LANES = 2 and
831 (((not(DATA_CTL_B0(0)) = '1') and BYTE_LANES_B0(0) = '1' and
832 (not(DATA_CTL_B0(2)) = '1') and BYTE_LANES_B0(2) = '1') or
833 ((not(DATA_CTL_B1(0)) = '1') and BYTE_LANES_B1(0) = '1' and
834 (not(DATA_CTL_B1(2)) = '1') and BYTE_LANES_B1(2) = '1') or
835 ((not(DATA_CTL_B2(0)) = '1') and BYTE_LANES_B2(0) = '1' and
836 (not(DATA_CTL_B2(2)) = '1') and BYTE_LANES_B2(2) = '1') or
837 ((not(DATA_CTL_B3(0)) = '1') and BYTE_LANES_B3(0) = '1' and
838 (not(DATA_CTL_B3(2)) = '1') and BYTE_LANES_B3(2) = '1') or
839 ((not(DATA_CTL_B4(0)) = '1') and BYTE_LANES_B4(0) = '1' and
840 (not(DATA_CTL_B4(2)) = '1') and BYTE_LANES_B4(2) = '1'))) then
841 ctl_byte_lane_var := "00001000";
843 ctl_byte_lane_var := "11100100";
845 return (ctl_byte_lane_var);
848 constant CTL_BYTE_LANE : (7 downto 0):= CTL_BYTE_LANE_W;
855 DATA_IO_PRIM_TYPE : ;
856 DATA_IO_IDLE_PWRDWN :;
881 DATA_CTL_B0 : (
3 downto 0);
882 DATA_CTL_B1 : (
3 downto 0);
883 DATA_CTL_B2 : (
3 downto 0);
884 DATA_CTL_B3 : (
3 downto 0);
885 DATA_CTL_B4 : (
3 downto 0);
886 BYTE_LANES_B0 : (
3 downto 0);
887 BYTE_LANES_B1 : (
3 downto 0);
888 BYTE_LANES_B2 : (
3 downto 0);
889 BYTE_LANES_B3 : (
3 downto 0);
890 BYTE_LANES_B4 : (
3 downto 0);
891 PHY_0_BITLANES : (
47 downto 0);
892 PHY_1_BITLANES : (
47 downto 0);
893 PHY_2_BITLANES : (
47 downto 0);
896 CK_BYTE_MAP : (
143 downto 0);
897 ADDR_MAP : (
191 downto 0);
898 BANK_MAP : (
35 downto 0);
899 CAS_MAP : (
11 downto 0);
900 CKE_ODT_BYTE_MAP : (
7 downto 0);
901 CKE_MAP : (
95 downto 0);
902 ODT_MAP : (
95 downto 0);
904 CS_MAP : (
119 downto 0);
905 PARITY_MAP : (
11 downto 0);
906 RAS_MAP : (
11 downto 0);
907 WE_MAP : (
11 downto 0);
908 DQS_BYTE_MAP : (
143 downto 0);
909 DATA0_MAP : (
95 downto 0);
910 DATA1_MAP : (
95 downto 0);
911 DATA2_MAP : (
95 downto 0);
912 DATA3_MAP : (
95 downto 0);
913 DATA4_MAP : (
95 downto 0);
914 DATA5_MAP : (
95 downto 0);
915 DATA6_MAP : (
95 downto 0);
916 DATA7_MAP : (
95 downto 0);
917 DATA8_MAP : (
95 downto 0);
918 DATA9_MAP : (
95 downto 0);
919 DATA10_MAP : (
95 downto 0);
920 DATA11_MAP : (
95 downto 0);
921 DATA12_MAP : (
95 downto 0);
922 DATA13_MAP : (
95 downto 0);
923 DATA14_MAP : (
95 downto 0);
924 DATA15_MAP : (
95 downto 0);
925 DATA16_MAP : (
95 downto 0);
926 DATA17_MAP : (
95 downto 0);
927 MASK0_MAP : (
107 downto 0);
928 MASK1_MAP : (
107 downto 0);
939 idelayctrl_refclk :
in ;
941 phy_data_wr_en :
in ;
942 phy_ctl_wd :
in (
31 downto 0);
944 phy_if_empty_def :
in ;
946 data_offset_1 :
in (
5 downto 0);
947 data_offset_2 :
in (
5 downto 0);
948 aux_in_1 :
in (
3 downto 0);
949 aux_in_2 :
in (
3 downto 0);
950 idelaye2_init_val :
out (
4 downto 0);
951 oclkdelay_init_val :
out (
5 downto 0);
955 phy_data_full :
out ;
956 phy_pre_data_a_full :
out ;
957 ddr_clk :
out (CK_WIDTH*LP_DDR_CK_WIDTH
-1 downto 0);
959 phy_write_calib :
in ;
960 phy_read_calib :
in ;
961 calib_in_common :
in ;
962 calib_sel :
in (
5 downto 0);
963 calib_zero_inputs :
in (HIGHEST_BANK
-1 downto 0);
964 calib_zero_ctrl :
in (HIGHEST_BANK
-1 downto 0);
965 po_fine_enable :
in (
2 downto 0);
966 po_coarse_enable :
in (
2 downto 0);
967 po_fine_inc :
in (
2 downto 0);
968 po_coarse_inc :
in (
2 downto 0);
969 po_counter_load_en :
in ;
970 po_counter_read_en :
in ;
971 po_sel_fine_oclk_delay :
in (
2 downto 0);
972 po_counter_load_val :
in (
8 downto 0);
973 po_counter_read_val :
out (
8 downto 0);
974 pi_counter_read_val :
out (
5 downto 0);
975 pi_rst_dqs_find :
in (HIGHEST_BANK
-1 downto 0);
976 pi_fine_enable :
in ;
978 pi_counter_load_en :
in ;
979 pi_counter_load_val :
in (
5 downto 0);
984 pi_phase_locked :
out ;
985 pi_phase_locked_all :
out ;
987 pi_dqs_found_all :
out ;
988 pi_dqs_out_of_range :
out ;
989 phy_init_data_sel :
in ;
990 mux_address :
in (nCK_PER_CLK*ROW_WIDTH
-1 downto 0);
991 mux_bank :
in (nCK_PER_CLK*BANK_WIDTH
-1 downto 0);
992 mux_cas_n :
in (nCK_PER_CLK
-1 downto 0);
993 mux_cs_n :
in (CS_WIDTH*nCS_PER_RANK*nCK_PER_CLK
-1 downto 0);
994 mux_ras_n :
in (nCK_PER_CLK
-1 downto 0);
995 mux_odt :
in (
1 downto 0);
996 mux_cke :
in (nCK_PER_CLK
-1 downto 0);
997 mux_we_n :
in (nCK_PER_CLK
-1 downto 0);
998 parity_in :
in (nCK_PER_CLK
-1 downto 0);
999 mux_wrdata :
in (
2*nCK_PER_CLK*DQ_WIDTH
-1 downto 0);
1000 mux_wrdata_mask :
in (
2*nCK_PER_CLK*(DQ_WIDTH/
8)
-1 downto 0);
1002 rd_data :
out (
2*nCK_PER_CLK*DQ_WIDTH
-1 downto 0);
1003 ddr_addr :
out (ROW_WIDTH
-1 downto 0);
1004 ddr_ba :
out (BANK_WIDTH
-1 downto 0);
1006 ddr_cke :
out (CKE_WIDTH
-1 downto 0);
1007 ddr_cs_n :
out (CS_WIDTH*nCS_PER_RANK
-1 downto 0);
1008 ddr_dm :
out (DM_WIDTH
-1 downto 0);
1009 ddr_odt :
out (ODT_WIDTH
-1 downto 0);
1014 ddr_dq :
inout (DQ_WIDTH
-1 downto 0);
1015 ddr_dqs :
inout (DQS_WIDTH
-1 downto 0);
1016 ddr_dqs_n :
inout (DQS_WIDTH
-1 downto 0);
1017 dbg_pi_counter_read_en :
in ;
1018 ref_dll_lock :
out ;
1019 rst_phaser_ref :
in ;
1020 dbg_pi_phase_locked_phy4lanes :
out (
11 downto 0);
1021 dbg_pi_dqs_found_lanes_phy4lanes :
out (
11 downto 0)
1023 end component mig_7series_v1_9_ddr_mc_phy_wrapper;
1037 BYTE_LANES_B0 : (
3 downto 0);
1038 BYTE_LANES_B1 : (
3 downto 0);
1039 BYTE_LANES_B2 : (
3 downto 0);
1040 BYTE_LANES_B3 : (
3 downto 0);
1041 BYTE_LANES_B4 : (
3 downto 0);
1042 DATA_CTL_B0 : (
3 downto 0);
1043 DATA_CTL_B1 : (
3 downto 0);
1044 DATA_CTL_B2 : (
3 downto 0);
1045 DATA_CTL_B3 : (
3 downto 0);
1046 DATA_CTL_B4 : (
3 downto 0);
1047 DQS_BYTE_MAP : (
143 downto 0);
1048 CTL_BYTE_LANE : (
7 downto 0);
1049 CTL_BANK : (
2 downto 0);
1050 SLOT_1_CONFIG : (
7 downto 0);
1063 DDR2_DQSN_ENABLE : ;
1065 CALIB_ROW_ADD : (
15 downto 0);
1066 CALIB_COL_ADD : (
11 downto 0);
1067 CALIB_BA_ADD : (
2 downto 0);
1090 slot_0_present :
in (
7 downto 0);
1091 slot_1_present :
in (
7 downto 0);
1092 phy_ctl_ready :
in ;
1095 phy_data_full :
in ;
1098 calib_ctl_wren :
out ;
1099 calib_cmd_wren :
out ;
1100 calib_seq :
out (
1 downto 0);
1101 calib_aux_out :
out (
3 downto 0);
1102 calib_cke :
out (nCK_PER_CLK
-1 downto 0);
1103 calib_odt :
out (
1 downto 0);
1104 calib_cmd :
out (
2 downto 0);
1105 calib_wrdata_en :
out ;
1106 calib_rank_cnt :
out (
1 downto 0);
1107 calib_cas_slot :
out (
1 downto 0);
1108 calib_data_offset_0 :
out (
5 downto 0);
1109 calib_data_offset_1 :
out (
5 downto 0);
1110 calib_data_offset_2 :
out (
5 downto 0);
1111 phy_address :
out (nCK_PER_CLK*ROW_WIDTH
-1 downto 0);
1112 phy_bank :
out (nCK_PER_CLK*BANK_WIDTH
-1 downto 0);
1113 phy_cs_n :
out (CS_WIDTH*nCS_PER_RANK*nCK_PER_CLK
-1 downto 0);
1114 phy_ras_n :
out (nCK_PER_CLK
-1 downto 0);
1115 phy_cas_n :
out (nCK_PER_CLK
-1 downto 0);
1116 phy_we_n :
out (nCK_PER_CLK
-1 downto 0);
1118 calib_sel :
out (
5 downto 0);
1119 calib_in_common :
out ;
1120 calib_zero_inputs :
out (HIGHEST_BANK
-1 downto 0);
1121 calib_zero_ctrl :
out (HIGHEST_BANK
-1 downto 0);
1122 phy_if_empty_def :
out ;
1123 phy_if_reset :
out ;
1124 pi_phaselocked :
in ;
1125 pi_phase_locked_all :
in ;
1127 pi_dqs_found_all :
in ;
1128 pi_dqs_found_lanes :
in (HIGHEST_LANE
-1 downto 0);
1129 pi_counter_read_val :
in (
5 downto 0);
1130 pi_rst_stg1_cal :
out (HIGHEST_BANK
-1 downto 0);
1131 pi_en_stg2_f :
out ;
1132 pi_stg2_f_incdec :
out ;
1133 pi_stg2_load :
out ;
1134 pi_stg2_reg_l :
out (
5 downto 0);
1138 po_sel_stg2stg3 :
out (
2 downto 0);
1139 po_stg2_c_incdec :
out (
2 downto 0);
1140 po_en_stg2_c :
out (
2 downto 0);
1141 po_stg2_f_incdec :
out (
2 downto 0);
1142 po_en_stg2_f :
out (
2 downto 0);
1143 po_counter_load_en :
out ;
1144 po_counter_read_val :
in (
8 downto 0);
1145 device_temp :
in (
11 downto 0);
1146 tempmon_sample_en :
in ;
1148 idelaye2_init_val :
in (
4 downto 0);
1149 oclkdelay_init_val :
in (
5 downto 0);
1152 phy_wrdata :
out (
2*nCK_PER_CLK*DQ_WIDTH
-1 downto 0);
1153 dlyval_dq :
out (
5*RANKS*DQ_WIDTH
-1 downto 0);
1154 phy_rddata :
in (
2*nCK_PER_CLK*DQ_WIDTH
-1 downto 0);
1155 calib_rd_data_offset_0 :
out (
6*RANKS
-1 downto 0);
1156 calib_rd_data_offset_1 :
out (
6*RANKS
-1 downto 0);
1157 calib_rd_data_offset_2 :
out (
6*RANKS
-1 downto 0);
1158 phy_rddata_valid :
out ;
1159 calib_writes :
out ;
1160 init_calib_complete :
out ;
1161 init_wrcal_complete :
out ;
1162 pi_phase_locked_err :
out ;
1163 pi_dqsfound_err :
out ;
1165 dbg_pi_phaselock_start :
out ;
1166 dbg_pi_dqsfound_start :
out ;
1167 dbg_pi_dqsfound_done :
out ;
1168 dbg_wrcal_start :
out ;
1169 dbg_wrcal_done :
out ;
1170 dbg_wrlvl_start :
out ;
1171 dbg_wrlvl_done :
out ;
1172 dbg_wrlvl_err :
out ;
1173 dbg_wrlvl_fine_tap_cnt :
out (
6*DQS_WIDTH
-1 downto 0);
1174 dbg_wrlvl_coarse_tap_cnt :
out (
3*DQS_WIDTH
-1 downto 0);
1175 dbg_phy_wrlvl :
out (
255 downto 0);
1176 dbg_tap_cnt_during_wrlvl :
out (
5 downto 0);
1177 dbg_wl_edge_detect_valid :
out ;
1178 dbg_rd_data_edge_detect :
out (DQS_WIDTH
-1 downto 0);
1179 dbg_final_po_fine_tap_cnt :
out (
6*DQS_WIDTH
-1 downto 0);
1180 dbg_final_po_coarse_tap_cnt :
out (
3*DQS_WIDTH
-1 downto 0);
1181 dbg_phy_wrcal :
out (
99 downto 0);
1182 dbg_rdlvl_start :
out (
1 downto 0);
1183 dbg_rdlvl_done :
out (
1 downto 0);
1184 dbg_rdlvl_err :
out (
1 downto 0);
1185 dbg_cpt_first_edge_cnt :
out (
6*DQS_WIDTH*RANKS
-1 downto 0);
1186 dbg_cpt_second_edge_cnt :
out (
6*DQS_WIDTH*RANKS
-1 downto 0);
1187 dbg_cpt_tap_cnt :
out (
6*DQS_WIDTH*RANKS
-1 downto 0);
1188 dbg_dq_idelay_tap_cnt :
out (
5*DQS_WIDTH*RANKS
-1 downto 0);
1189 dbg_sel_pi_incdec :
in ;
1190 dbg_sel_po_incdec :
in ;
1191 dbg_byte_sel :
in (DQS_CNT_WIDTH
downto 0);
1195 dbg_po_f_stg23_sel :
in ;
1197 dbg_idel_up_all :
in ;
1198 dbg_idel_down_all :
in ;
1199 dbg_idel_up_cpt :
in ;
1200 dbg_idel_down_cpt :
in ;
1201 dbg_sel_idel_cpt :
in (DQS_CNT_WIDTH
-1 downto 0);
1202 dbg_sel_all_idel_cpt :
in ;
1203 dbg_phy_rdlvl :
out (
255 downto 0);
1204 dbg_calib_top :
out (
255 downto 0);
1205 dbg_phy_init :
out (
255 downto 0);
1206 dbg_prbs_rdlvl :
out (
255 downto 0);
1207 dbg_dqs_found_cal :
out (
255 downto 0);
1208 dbg_phy_oclkdelay_cal :
out (
255 downto 0);
1209 dbg_oclkdelay_rd_data :
out (DRAM_WIDTH*
16-1 downto 0);
1210 dbg_oclkdelay_calib_start :
out ;
1211 dbg_oclkdelay_calib_done :
out
1213 end component mig_7series_v1_9_ddr_calib_top;
1215 signal phy_din : (HIGHEST_LANE*80-1 downto 0);
1216 signal phy_dout : (HIGHEST_LANE*80-1 downto 0);
1217 signal ddr_cmd_ctl_data : (HIGHEST_LANE*12-1 downto 0);
1218 signal aux_out : ((((HIGHEST_LANE+3)/4)*4)-1 downto 0);
1219 signal ddr_clk : (CK_WIDTH * LP_DDR_CK_WIDTH-1 downto 0);
1220 signal phy_mc_go : ;
1221 signal phy_ctl_full : ;
1222 signal phy_cmd_full : ;
1223 signal phy_data_full : ;
1224 signal phy_pre_data_a_full : ;
1226 signal phy_write_calib : ;
1227 signal phy_read_calib : ;
1228 signal rst_stg1_cal : (HIGHEST_BANK-1 downto 0);
1229 signal calib_sel : (5 downto 0);
1230 signal calib_in_common : ;
1231 signal calib_zero_inputs : (HIGHEST_BANK-1 downto 0);
1232 signal calib_zero_ctrl : (HIGHEST_BANK-1 downto 0);
1233 signal pi_phase_locked : ;
1234 signal pi_phase_locked_all : ;
1235 signal pi_found_dqs : ;
1236 signal pi_dqs_found_all : ;
1237 signal pi_dqs_out_of_range : ;
1238 signal pi_enstg2_f : ;
1239 signal pi_stg2_fincdec : ;
1240 signal pi_stg2_load : ;
1241 signal pi_stg2_reg_l : (5 downto 0);
1242 signal idelay_ce : ;
1243 signal idelay_inc : ;
1244 signal idelay_ld : ;
1245 signal po_sel_stg2stg3 : (2 downto 0);
1246 signal po_stg2_cincdec : (2 downto 0);
1247 signal po_enstg2_c : (2 downto 0);
1248 signal po_stg2_fincdec : (2 downto 0);
1249 signal po_enstg2_f : (2 downto 0);
1250 signal po_counter_read_val : (8 downto 0);
1251 signal pi_counter_read_val : (5 downto 0);
1252 signal phy_wrdata : (2*nCK_PER_CLK*DQ_WIDTH-1 downto 0);
1253 signal parity : (nCK_PER_CLK-1 downto 0);
1254 signal phy_address : (nCK_PER_CLK*ROW_WIDTH-1 downto 0);
1255 signal phy_bank : (nCK_PER_CLK*BANK_WIDTH-1 downto 0);
1256 signal phy_cs_n : (CS_WIDTH*nCS_PER_RANK*nCK_PER_CLK-1 downto 0);
1257 signal phy_ras_n : (nCK_PER_CLK-1 downto 0);
1258 signal phy_cas_n : (nCK_PER_CLK-1 downto 0);
1259 signal phy_we_n : (nCK_PER_CLK-1 downto 0);
1260 signal phy_reset_n : ;
1261 signal calib_aux_out : (3 downto 0);
1262 signal calib_cke : (nCK_PER_CLK-1 downto 0);
1263 signal calib_odt : (1 downto 0);
1264 signal calib_ctl_wren : ;
1265 signal calib_cmd_wren : ;
1266 signal calib_wrdata_en : ;
1267 signal calib_cmd : (2 downto 0);
1268 signal calib_seq : (1 downto 0);
1269 signal calib_data_offset_0 : (5 downto 0);
1270 signal calib_data_offset_1 : (5 downto 0);
1271 signal calib_data_offset_2 : (5 downto 0);
1272 signal calib_rank_cnt : (1 downto 0);
1273 signal calib_cas_slot : (1 downto 0);
1274 signal mux_address : (nCK_PER_CLK*ROW_WIDTH-1 downto 0);
1275 signal mux_aux_out : (3 downto 0);
1276 signal aux_out_map : (3 downto 0);
1277 signal mux_bank : (nCK_PER_CLK*BANK_WIDTH-1 downto 0);
1278 signal mux_cmd : (2 downto 0);
1279 signal mux_cmd_wren : ;
1280 signal mux_cs_n : (CS_WIDTH*nCS_PER_RANK*nCK_PER_CLK-1 downto 0);
1281 signal mux_ctl_wren : ;
1282 signal mux_cas_slot : (1 downto 0);
1283 signal mux_data_offset : (5 downto 0);
1284 signal mux_data_offset_1 : (5 downto 0);
1285 signal mux_data_offset_2 : (5 downto 0);
1286 signal mux_ras_n : (nCK_PER_CLK-1 downto 0);
1287 signal mux_cas_n : (nCK_PER_CLK-1 downto 0);
1288 signal mux_rank_cnt : (1 downto 0);
1289 signal mux_reset_n : ;
1290 signal mux_we_n : (nCK_PER_CLK-1 downto 0);
1291 signal mux_wrdata : (2*nCK_PER_CLK*DQ_WIDTH-1 downto 0);
1292 signal mux_wrdata_mask : (2*nCK_PER_CLK*(DQ_WIDTH/8)-1 downto 0);
1293 signal mux_wrdata_en : ;
1294 signal mux_cke : (nCK_PER_CLK-1 downto 0);
1295 signal mux_odt : (1 downto 0);
1296 signal phy_if_empty_def : ;
1297 signal phy_if_reset : ;
1298 signal phy_init_data_sel : ;
1299 signal rd_data_map : (2*nCK_PER_CLK*DQ_WIDTH-1 downto 0);
1300 signal phy_rddata_valid_w : ;
1301 signal rddata_valid_reg : ;
1302 signal rd_data_reg : (2*nCK_PER_CLK*DQ_WIDTH-1 downto 0);
1303 signal idelaye2_init_val : (4 downto 0);
1304 signal oclkdelay_init_val : (5 downto 0);
1306 signal mc_cs_n_temp : (CS_WIDTH*nCS_PER_RANK*nCK_PER_CLK-1 downto 0);
1308 signal calib_rd_data_offset_i0 : (6*RANKS-1 downto 0);
1309 signal init_wrcal_complete_i : ;
1310 signal phy_ctl_wd_i : (31 downto 0);
1311 signal po_counter_load_en : ;
1312 signal parity_0_wire : ((ROW_WIDTH+BANK_WIDTH+3)-1 downto 0);
1313 signal parity_1_wire : ((ROW_WIDTH+BANK_WIDTH+3)-1 downto 0);
1314 signal parity_2_wire : ((ROW_WIDTH+BANK_WIDTH+3)-1 downto 0);
1315 signal parity_3_wire : ((ROW_WIDTH+BANK_WIDTH+3)-1 downto 0);
1316 signal dbg_pi_dqs_found_lanes_phy4lanes_i : (11 downto 0);
1317 signal all_zeros : (8 downto 0):= (others => '0');
1321 --***************************************************************************
1323 dbg_rddata_valid <= rddata_valid_reg;
1324 dbg_rddata <= rd_data_reg;
1326 dbg_rd_data_offset <= calib_rd_data_offset_i0;
1327 calib_rd_data_offset_0 <= calib_rd_data_offset_i0;
1329 dbg_pi_phaselocked_done <= pi_phase_locked_all;
1331 dbg_po_counter_read_val <= po_counter_read_val;
1332 dbg_pi_counter_read_val <= pi_counter_read_val;
1334 dbg_pi_dqs_found_lanes_phy4lanes <= dbg_pi_dqs_found_lanes_phy4lanes_i;
1336 init_wrcal_complete <= init_wrcal_complete_i;
1338 --***************************************************************************
1340 clock_gen : for i in 0 to (CK_WIDTH-1) generate
1341 ddr_ck(i) <= ddr_clk(LP_DDR_CK_WIDTH * i);
1342 ddr_ck_n(i) <= ddr_clk((LP_DDR_CK_WIDTH * i) + 1);
1345 --***************************************************************************
1346 -- During memory initialization and calibration the calibration logic drives
1347 -- the memory signals. After calibration is complete the memory controller
1348 -- drives the memory signals.
1349 -- Do not expect timing issues in 4:
1 mode at
800 MHz/1600 Mbps
1350 --***************************************************************************
1352 cs_rdimm : if((REG_CTRL = "ON") and (DRAM_TYPE = "DDR3") and (RANKS = 1) and (nCS_PER_RANK = 2)) generate
1353 cs_rdimm_gen: for v in 0 to (CS_WIDTH*nCS_PER_RANK*nCK_PER_CLK)-1 generate
1354 cs_rdimm_gen_i : if((v mod (CS_WIDTH*nCS_PER_RANK)) = 0) generate
1355 mc_cs_n_temp(v) <= mc_cs_n(v) ;
1358 cs_rdimm_gen_j : if(not((v mod (CS_WIDTH*nCS_PER_RANK)) = 0)) generate
1359 mc_cs_n_temp(v) <= '1' ;
1365 cs_others : if(not(REG_CTRL = "ON") or not(DRAM_TYPE = "DDR3") or not(RANKS = 1) or not(nCS_PER_RANK = 2)) generate
1366 mc_cs_n_temp <= mc_cs_n ;
1369 mux_wrdata <= mc_wrdata when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_wrdata;
1370 mux_wrdata_mask <= mc_wrdata_mask when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else (others => '0');
1371 mux_address <= mc_address when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_address;
1372 mux_bank <= mc_bank when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_bank;
1373 mux_cs_n <= mc_cs_n_temp when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_cs_n;
1374 mux_ras_n <= mc_ras_n when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_ras_n;
1375 mux_cas_n <= mc_cas_n when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_cas_n;
1376 mux_we_n <= mc_we_n when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_we_n;
1377 mux_reset_n <= mc_reset_n when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else phy_reset_n;
1378 mux_aux_out <= mc_aux_out0 when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else calib_aux_out;
1379 mux_odt <= mc_odt when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else calib_odt;
1380 mux_cke <= mc_cke when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else calib_cke;
1381 mux_cmd_wren <= mc_cmd_wren when (phy_init_data_sel ='1' or init_wrcal_complete_i = '1') else calib_cmd_wren;
1382 mux_ctl_wren <= mc_ctl_wren when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else calib_ctl_wren;
1383 mux_wrdata_en <= mc_wrdata_en when (phy_init_data_sel = '1' or init_wrcal_complete_i = '1') else calib_wrdata_en;
1384 mux_cmd <= mc_cmd when (phy_init_data_sel ='1' or init_wrcal_complete_i ='1') else calib_cmd;
1385 mux_cas_slot <= mc_cas_slot when (phy_init_data_sel ='1' or init_wrcal_complete_i = '1') else calib_cas_slot;
1386 mux_data_offset <= mc_data_offset when (phy_init_data_sel ='1' or init_wrcal_complete_i = '1') else calib_data_offset_0;
1387 mux_data_offset_1 <= mc_data_offset_1 when (phy_init_data_sel ='1' or init_wrcal_complete_i = '1') else calib_data_offset_1;
1388 mux_data_offset_2 <= mc_data_offset_2 when (phy_init_data_sel ='1' or init_wrcal_complete_i = '1') else calib_data_offset_2;
1389 -- Reserved field. Hard coded to 2'b00 irrespective
of the number
of ranks. CR
643601
1390 mux_rank_cnt <= "00";
1393 -- Assigning cke & odt for DDR2 & DDR3
1394 -- No changes for DDR3 & DDR2 dual rank
1395 -- DDR2 single rank systems might potentially need 3 odt signals.
1396 -- Aux_out[2] will have the odt toggled by phy and controller
1397 -- wiring aux_out[2] to 0 &
3. Depending upon the odt
parameter
1398 -- all of the three odt bits or some of them might be used.
1399 -- mapping done in mc_phy_wrapper module
1400 aux_out_gen : if(CKE_ODT_AUX = "TRUE") generate
1401 aux_out_map <= (mux_aux_out(1) & mux_aux_out(1) & mux_aux_out(1) &
1402 mux_aux_out(0)) when ((DRAM_TYPE = "DDR2") and
1407 wo_aux_out_gen : if(not(CKE_ODT_AUX = "TRUE")) generate
1408 aux_out_map <= "0000";
1411 init_calib_complete <= phy_init_data_sel;
1413 phy_mc_ctl_full <= phy_ctl_full;
1414 phy_mc_cmd_full <= phy_cmd_full;
1415 phy_mc_data_full <= phy_pre_data_a_full;
1418 --***************************************************************************
1419 -- Generate parity for DDR3 RDIMM.
1420 --***************************************************************************
1422 gen_ddr3_parity : if ((DRAM_TYPE = "DDR3") and (REG_CTRL = "ON")) generate
1424 gen_ddr3_parity_4by1: if (nCK_PER_CLK = 4) generate
1426 parity_0_wire <= (mux_address((ROW_WIDTH*4)-1 downto ROW_WIDTH*3) &
1427 mux_bank((BANK_WIDTH*4)-1 downto BANK_WIDTH*3) &
1428 mux_cas_n(3) & mux_ras_n(3) & mux_we_n(3));
1429 parity_1_wire <= (mux_address(ROW_WIDTH-1 downto 0) &
1430 mux_bank(BANK_WIDTH-1 downto 0) & mux_cas_n(0) &
1431 mux_ras_n(0) & mux_we_n(0));
1432 parity_2_wire <= (mux_address((ROW_WIDTH*2)-1 downto ROW_WIDTH) &
1433 mux_bank((BANK_WIDTH*2)-1 downto BANK_WIDTH) &
1434 mux_cas_n(1) & mux_ras_n(1) & mux_we_n(1));
1435 parity_3_wire <= (mux_address((ROW_WIDTH*3)-1 downto ROW_WIDTH*2) &
1436 mux_bank((BANK_WIDTH*3)-1 downto BANK_WIDTH*2) &
1437 mux_cas_n(2) & mux_ras_n(2) & mux_we_n(2));
1441 if (clk'event and clk = '1') then
1442 parity(0) <= ODD_PARITY(parity_0_wire) after (TCQ) * 1 ps;
1446 process (mux_address, mux_bank, mux_cas_n, mux_ras_n, mux_we_n)
1448 parity(1) <= ODD_PARITY(parity_1_wire) after (TCQ) * 1 ps;
1449 parity(2) <= ODD_PARITY(parity_2_wire) after (TCQ) * 1 ps;
1450 parity(3) <= ODD_PARITY(parity_3_wire) after (TCQ) * 1 ps;
1454 gen_ddr3_parity_2by1: if ( not(nCK_PER_CLK = 4)) generate
1456 parity_1_wire <= (mux_address(ROW_WIDTH-1 downto 0) &
1457 mux_bank(BANK_WIDTH-1 downto 0) & mux_cas_n(0) &
1458 mux_ras_n(0) & mux_we_n(0));
1459 parity_2_wire <= (mux_address((ROW_WIDTH*2)-1 downto ROW_WIDTH) &
1460 mux_bank((BANK_WIDTH*2)-1 downto BANK_WIDTH) &
1461 mux_cas_n(1) & mux_ras_n(1) & mux_we_n(1));
1465 if (clk'event and clk='1') then
1466 parity(0) <= ODD_PARITY(parity_2_wire) after (TCQ) * 1 ps;
1470 process(mux_address, mux_bank, mux_cas_n, mux_ras_n, mux_we_n)
1472 parity(1) <= ODD_PARITY(parity_1_wire) after (TCQ) * 1 ps;
1477 gen_ddr3_noparity : if (not(DRAM_TYPE = "DDR3") or not(REG_CTRL = "ON")) generate
1478 gen_ddr3_noparity_4by1 : if (nCK_PER_CLK = 4) generate
1481 if (clk'event and clk='1') then
1482 parity(0) <= '0' after (TCQ)*1 ps;
1483 parity(1) <= '0' after (TCQ)*1 ps;
1484 parity(2) <= '0' after (TCQ)*1 ps;
1485 parity(3) <= '0' after (TCQ)*1 ps;
1490 gen_ddr3_noparity_2by1 : if (not(nCK_PER_CLK = 4)) generate
1493 if (clk'event and clk='1') then
1494 parity(0) <= '0' after (TCQ)*1 ps;
1495 parity(1) <= '0' after (TCQ)*1 ps;
1502 --***************************************************************************
1503 -- Code for optional register stage in read path to MC for timing
1504 --***************************************************************************
1505 RD_REG_TIMING : if(RD_PATH_REG = 1) generate
1508 if (clk'event and clk='1') then
1509 rddata_valid_reg <= phy_rddata_valid_w after (TCQ)*1 ps;
1510 rd_data_reg <= rd_data_map after (TCQ)*1 ps;
1515 RD_REG_NO_TIMING : if( not(RD_PATH_REG = 1)) generate
1516 process (phy_rddata_valid_w, rd_data_map)
1518 rddata_valid_reg <= phy_rddata_valid_w;
1519 rd_data_reg <= rd_data_map;
1523 phy_rddata_valid <= rddata_valid_reg;
1524 phy_rd_data <= rd_data_reg;
1526 --***************************************************************************
1527 -- Hard PHY and accompanying mapping logic
1528 --***************************************************************************
1530 phy_ctl_wd_i <= ("00000" & mux_cas_slot & calib_seq & mux_data_offset &
1531 mux_rank_cnt & "000" & aux_out_map & "00000" & mux_cmd);
1537 BANK_TYPE => BANK_TYPE,
1538 DATA_IO_PRIM_TYPE => DATA_IO_PRIM_TYPE,
1539 IODELAY_GRP => IODELAY_GRP,
1540 DATA_IO_IDLE_PWRDWN => DATA_IO_IDLE_PWRDWN,
1541 nCK_PER_CLK => nCK_PER_CLK,
1542 nCS_PER_RANK => nCS_PER_RANK,
1543 BANK_WIDTH => BANK_WIDTH,
1544 CKE_WIDTH => CKE_WIDTH,
1545 CS_WIDTH => CS_WIDTH,
1546 CK_WIDTH => CK_WIDTH,
1548 DDR2_DQSN_ENABLE => DDR2_DQSN_ENABLE,
1549 DM_WIDTH => DM_WIDTH,
1550 DQ_WIDTH => DQ_WIDTH,
1551 DQS_CNT_WIDTH => DQS_CNT_WIDTH,
1552 DQS_WIDTH => DQS_WIDTH,
1553 DRAM_TYPE => DRAM_TYPE,
1555 ODT_WIDTH => ODT_WIDTH,
1556 REG_CTRL => REG_CTRL,
1557 ROW_WIDTH => ROW_WIDTH,
1558 USE_CS_PORT => USE_CS_PORT,
1559 USE_DM_PORT => USE_DM_PORT,
1560 USE_ODT_PORT => USE_ODT_PORT,
1561 IBUF_LPWR_MODE => IBUF_LPWR_MODE ,
1562 LP_DDR_CK_WIDTH => LP_DDR_CK_WIDTH,
1563 PHYCTL_CMD_FIFO => PHYCTL_CMD_FIFO,
1564 DATA_CTL_B0 => DATA_CTL_B0,
1565 DATA_CTL_B1 => DATA_CTL_B1,
1566 DATA_CTL_B2 => DATA_CTL_B2,
1567 DATA_CTL_B3 => DATA_CTL_B3,
1568 DATA_CTL_B4 => DATA_CTL_B4,
1569 BYTE_LANES_B0 => BYTE_LANES_B0,
1570 BYTE_LANES_B1 => BYTE_LANES_B1,
1571 BYTE_LANES_B2 => BYTE_LANES_B2,
1572 BYTE_LANES_B3 => BYTE_LANES_B3,
1573 BYTE_LANES_B4 => BYTE_LANES_B4,
1574 PHY_0_BITLANES => PHY_0_BITLANES ,
1575 PHY_1_BITLANES => PHY_1_BITLANES ,
1576 PHY_2_BITLANES => PHY_2_BITLANES ,
1577 HIGHEST_BANK => HIGHEST_BANK,
1578 HIGHEST_LANE => HIGHEST_LANE,
1579 CK_BYTE_MAP => CK_BYTE_MAP,
1580 ADDR_MAP => ADDR_MAP,
1581 BANK_MAP => BANK_MAP,
1583 CKE_ODT_BYTE_MAP => CKE_ODT_BYTE_MAP,
1586 CKE_ODT_AUX => CKE_ODT_AUX,
1588 PARITY_MAP => PARITY_MAP,
1591 DQS_BYTE_MAP => DQS_BYTE_MAP,
1592 DATA0_MAP => DATA0_MAP,
1593 DATA1_MAP => DATA1_MAP,
1594 DATA2_MAP => DATA2_MAP,
1595 DATA3_MAP => DATA3_MAP,
1596 DATA4_MAP => DATA4_MAP,
1597 DATA5_MAP => DATA5_MAP,
1598 DATA6_MAP => DATA6_MAP,
1599 DATA7_MAP => DATA7_MAP,
1600 DATA8_MAP => DATA8_MAP,
1601 DATA9_MAP => DATA9_MAP,
1602 DATA10_MAP => DATA10_MAP,
1603 DATA11_MAP => DATA11_MAP,
1604 DATA12_MAP => DATA12_MAP,
1605 DATA13_MAP => DATA13_MAP,
1606 DATA14_MAP => DATA14_MAP,
1607 DATA15_MAP => DATA15_MAP,
1608 DATA16_MAP => DATA16_MAP,
1609 DATA17_MAP => DATA17_MAP,
1610 MASK0_MAP => MASK0_MAP,
1611 MASK1_MAP => MASK1_MAP,
1612 SIM_CAL_OPTION => SIM_CAL_OPTION ,
1613 MASTER_PHY_CTL => MASTER_PHY_CTL
1618 -- For memory frequencies between 400~1066 MHz freq_refclk = mem_refclk
1619 -- For memory frequencies below 400 MHz mem_refclk = mem_refclk
and
1620 -- freq_refclk = 2x or 4x mem_refclk such that it remains
in the
1621 -- 400~1066 MHz range
1622 freq_refclk => freq_refclk,
1623 mem_refclk => mem_refclk,
1624 pll_lock => pll_lock,
1625 sync_pulse => sync_pulse,
1626 idelayctrl_refclk => clk_ref,
1627 phy_cmd_wr_en => mux_cmd_wren,
1628 phy_data_wr_en => mux_wrdata_en,
1629 -- phy_ctl_wd = {ACTPRE[31:30],EventDelay[29:25],seq[24:23],
1630 -- DataOffset[22:17],HiIndex[16:15],LowIndex[14:12],
1631 -- AuxOut[11:8],ControlOffset[7:3],PHYCmd[2:0]}
1632 -- The fields ACTPRE, and BankCount are only used
1633 -- when the hard PHY counters are used by the MC.
1634 phy_ctl_wd => phy_ctl_wd_i,
1635 phy_ctl_wr => mux_ctl_wren,
1636 phy_if_empty_def => phy_if_empty_def,
1637 phy_if_reset => phy_if_reset,
1638 data_offset_1 => mux_data_offset_1,
1639 data_offset_2 => mux_data_offset_2,
1640 aux_in_1 => aux_out_map,
1641 aux_in_2 => aux_out_map,
1642 idelaye2_init_val => idelaye2_init_val,
1643 oclkdelay_init_val => oclkdelay_init_val,
1644 if_empty => if_empty,
1645 phy_ctl_full => phy_ctl_full,
1646 phy_cmd_full => phy_cmd_full,
1647 phy_data_full => phy_data_full,
1648 phy_pre_data_a_full => phy_pre_data_a_full,
1650 phy_mc_go => phy_mc_go,
1651 phy_write_calib => phy_write_calib,
1652 phy_read_calib => phy_read_calib ,
1653 calib_in_common => calib_in_common,
1654 calib_sel => calib_sel,
1655 calib_zero_inputs => calib_zero_inputs,
1656 calib_zero_ctrl => calib_zero_ctrl,
1657 po_fine_enable => po_enstg2_f,
1658 po_coarse_enable => po_enstg2_c,
1659 po_fine_inc => po_stg2_fincdec,
1660 po_coarse_inc => po_stg2_cincdec,
1661 po_counter_load_en => po_counter_load_en,
1662 po_counter_read_en => '1',
1663 po_sel_fine_oclk_delay => po_sel_stg2stg3,
1664 po_counter_load_val => all_zeros,
1665 po_counter_read_val => po_counter_read_val,
1666 pi_counter_read_val => pi_counter_read_val,
1667 pi_rst_dqs_find => rst_stg1_cal,
1668 pi_fine_enable => pi_enstg2_f,
1669 pi_fine_inc => pi_stg2_fincdec,
1670 pi_counter_load_en => pi_stg2_load,
1671 pi_counter_load_val => pi_stg2_reg_l,
1672 idelay_ce => idelay_ce,
1673 idelay_inc => idelay_inc,
1674 idelay_ld => idelay_ld,
1676 pi_phase_locked => pi_phase_locked,
1677 pi_phase_locked_all => pi_phase_locked_all,
1678 pi_dqs_found => pi_found_dqs,
1679 pi_dqs_found_all => pi_dqs_found_all,
1680 -- Currently not being used. May be used in future if periodic reads
1681 -- become a requirement. This output could also be used to signal a
1682 -- catastrophic failure in read capture and the need for re-cal
1683 pi_dqs_out_of_range => pi_dqs_out_of_range,
1684 phy_init_data_sel => phy_init_data_sel,
1685 mux_address => mux_address,
1686 mux_bank => mux_bank,
1687 mux_cas_n => mux_cas_n,
1688 mux_cs_n => mux_cs_n,
1689 mux_ras_n => mux_ras_n,
1692 mux_we_n => mux_we_n,
1693 parity_in => parity,
1694 mux_wrdata => mux_wrdata,
1695 mux_wrdata_mask => mux_wrdata_mask,
1696 mux_reset_n => mux_reset_n,
1697 rd_data => rd_data_map,
1698 ddr_addr => ddr_addr,
1700 ddr_cas_n => ddr_cas_n,
1702 ddr_cs_n => ddr_cs_n,
1705 ddr_parity => ddr_parity,
1706 ddr_ras_n => ddr_ras_n,
1707 ddr_we_n => ddr_we_n,
1708 ddr_reset_n => ddr_reset_n,
1711 ddr_dqs_n => ddr_dqs_n,
1712 dbg_pi_counter_read_en => '1',
1713 ref_dll_lock => ref_dll_lock,
1714 rst_phaser_ref => rst_phaser_ref ,
1715 dbg_pi_phase_locked_phy4lanes => dbg_pi_phase_locked_phy4lanes,
1716 dbg_pi_dqs_found_lanes_phy4lanes => dbg_pi_dqs_found_lanes_phy4lanes_i
1719 --***************************************************************************
1720 -- Soft memory initialization and calibration logic
1721 --***************************************************************************
1726 nCK_PER_CLK => nCK_PER_CLK,
1728 CLK_PERIOD => CLK_PERIOD,
1729 N_CTL_LANES => N_CTL_LANES,
1730 DRAM_TYPE => DRAM_TYPE,
1732 HIGHEST_LANE => HIGHEST_LANE,
1733 HIGHEST_BANK => HIGHEST_BANK,
1734 BANK_TYPE => BANK_TYPE,
1735 BYTE_LANES_B0 => BYTE_LANES_B0,
1736 BYTE_LANES_B1 => BYTE_LANES_B1,
1737 BYTE_LANES_B2 => BYTE_LANES_B2,
1738 BYTE_LANES_B3 => BYTE_LANES_B3,
1739 BYTE_LANES_B4 => BYTE_LANES_B4,
1740 DATA_CTL_B0 => DATA_CTL_B0,
1741 DATA_CTL_B1 => DATA_CTL_B1,
1742 DATA_CTL_B2 => DATA_CTL_B2,
1743 DATA_CTL_B3 => DATA_CTL_B3,
1744 DATA_CTL_B4 => DATA_CTL_B4,
1745 DQS_BYTE_MAP => DQS_BYTE_MAP,
1746 CTL_BYTE_LANE => CTL_BYTE_LANE,
1747 CTL_BANK => CTL_BANK,
1748 SLOT_1_CONFIG => SLOT_1_CONFIG,
1749 BANK_WIDTH => BANK_WIDTH,
1750 CA_MIRROR => CA_MIRROR,
1751 COL_WIDTH => COL_WIDTH,
1752 nCS_PER_RANK => nCS_PER_RANK,
1753 DQ_WIDTH => DQ_WIDTH,
1754 DQS_CNT_WIDTH => DQS_CNT_WIDTH,
1755 DQS_WIDTH => DQS_WIDTH,
1756 DRAM_WIDTH => DRAM_WIDTH,
1757 ROW_WIDTH => ROW_WIDTH,
1759 CS_WIDTH => CS_WIDTH,
1760 CKE_WIDTH => CKE_WIDTH,
1761 DDR2_DQSN_ENABLE => DDR2_DQSN_ENABLE,
1762 PER_BIT_DESKEW =>
"OFF",
1763 CALIB_ROW_ADD => CALIB_ROW_ADD,
1764 CALIB_COL_ADD => CALIB_COL_ADD,
1765 CALIB_BA_ADD => CALIB_BA_ADD,
1767 ADDR_CMD_MODE => ADDR_CMD_MODE,
1768 BURST_MODE => BURST_MODE,
1769 BURST_TYPE => BURST_TYPE,
1773 OUTPUT_DRV => OUTPUT_DRV,
1774 REG_CTRL => REG_CTRL,
1777 USE_ODT_PORT => USE_ODT_PORT,
1779 PRE_REV3ES => PRE_REV3ES,
1780 SIM_INIT_OPTION => SIM_INIT_OPTION,
1781 SIM_CAL_OPTION => SIM_CAL_OPTION ,
1782 CKE_ODT_AUX => CKE_ODT_AUX,
1783 DEBUG_PORT => DEBUG_PORT
1789 slot_0_present => slot_0_present ,
1790 slot_1_present => slot_1_present ,
1791 -- PHY Control Block and IN_FIFO status
1792 phy_ctl_ready => phy_mc_go,
1793 phy_ctl_full => '0',
1794 phy_cmd_full => '0',
1795 phy_data_full => '0',
1796 -- hard PHY calibration modes
1797 write_calib => phy_write_calib,
1798 read_calib => phy_read_calib ,
1799 -- Signals from calib logic to be MUXED with MC
1800 -- signals before sending to hard PHY
1801 calib_ctl_wren => calib_ctl_wren ,
1802 calib_cmd_wren => calib_cmd_wren ,
1803 calib_seq => calib_seq,
1804 calib_aux_out => calib_aux_out,
1805 calib_odt => calib_odt,
1806 calib_cke => calib_cke,
1807 calib_cmd => calib_cmd,
1808 calib_wrdata_en => calib_wrdata_en,
1809 calib_rank_cnt => calib_rank_cnt ,
1810 calib_cas_slot => calib_cas_slot ,
1811 calib_data_offset_0 => calib_data_offset_0,
1812 calib_data_offset_1 => calib_data_offset_1,
1813 calib_data_offset_2 => calib_data_offset_2,
1814 phy_address => phy_address,
1815 phy_bank => phy_bank,
1816 phy_cs_n => phy_cs_n,
1817 phy_ras_n => phy_ras_n,
1818 phy_cas_n => phy_cas_n,
1819 phy_we_n => phy_we_n,
1820 phy_reset_n => phy_reset_n,
1821 -- DQS count and ck/addr/cmd to be mapped to calib_sel
1822 -- based on parameter that defines placement of ctl lanes
1823 -- and DQS byte groups in each bank. When phy_write_calib
1824 -- is de-asserted calib_sel should select CK/addr/cmd/ctl.
1825 calib_sel => calib_sel,
1826 calib_in_common => calib_in_common,
1827 calib_zero_inputs => calib_zero_inputs,
1828 calib_zero_ctrl => calib_zero_ctrl,
1829 phy_if_empty_def => phy_if_empty_def,
1830 phy_if_reset => phy_if_reset,
1831 -- DQS Phaser_IN calibration/status signals
1832 pi_phaselocked => pi_phase_locked,
1833 pi_phase_locked_all => pi_phase_locked_all,
1834 pi_found_dqs => pi_found_dqs,
1835 pi_dqs_found_all => pi_dqs_found_all,
1836 pi_dqs_found_lanes => dbg_pi_dqs_found_lanes_phy4lanes_i
(HIGHEST_LANE-
1 downto 0),
1837 pi_rst_stg1_cal => rst_stg1_cal,
1838 pi_en_stg2_f => pi_enstg2_f,
1839 pi_stg2_f_incdec => pi_stg2_fincdec,
1840 pi_stg2_load => pi_stg2_load,
1841 pi_stg2_reg_l => pi_stg2_reg_l,
1842 pi_counter_read_val => pi_counter_read_val,
1843 device_temp => device_temp,
1844 tempmon_sample_en => tempmon_sample_en,
1845 -- IDELAY tap enable and inc signals
1846 idelay_ce => idelay_ce,
1847 idelay_inc => idelay_inc,
1848 idelay_ld => idelay_ld,
1849 -- DQS Phaser_OUT calibration/status signals
1850 po_sel_stg2stg3 => po_sel_stg2stg3,
1851 po_stg2_c_incdec => po_stg2_cincdec,
1852 po_en_stg2_c => po_enstg2_c,
1853 po_stg2_f_incdec => po_stg2_fincdec,
1854 po_en_stg2_f => po_enstg2_f,
1855 po_counter_load_en => po_counter_load_en,
1856 po_counter_read_val => po_counter_read_val,
1857 phy_if_empty => if_empty,
1858 idelaye2_init_val => idelaye2_init_val,
1859 oclkdelay_init_val => oclkdelay_init_val,
1861 rst_tg_mc => rst_tg_mc,
1862 phy_wrdata => phy_wrdata,
1863 -- From calib logic To data IN_FIFO
1864 -- DQ IDELAY tap value from Calib logic
1865 -- port to be added to mc_phy by Gary
1867 -- From data IN_FIFO To Calib logic and MC/UI
1868 phy_rddata => rd_data_map,
1869 -- From calib logic To MC
1870 phy_rddata_valid => phy_rddata_valid_w,
1871 calib_rd_data_offset_0 => calib_rd_data_offset_i0,
1872 calib_rd_data_offset_1 => calib_rd_data_offset_1,
1873 calib_rd_data_offset_2 => calib_rd_data_offset_2,
1874 calib_writes =>
open,
1875 -- Mem Init and Calibration status To MC
1876 init_calib_complete => phy_init_data_sel,
1877 init_wrcal_complete => init_wrcal_complete_i,
1878 -- Debug Error signals
1879 pi_phase_locked_err => dbg_pi_phaselock_err,
1880 pi_dqsfound_err => dbg_pi_dqsfound_err,
1881 wrcal_err => dbg_wrcal_err,
1883 dbg_pi_phaselock_start => dbg_pi_phaselock_start,
1884 dbg_pi_dqsfound_start => dbg_pi_dqsfound_start,
1885 dbg_pi_dqsfound_done => dbg_pi_dqsfound_done,
1886 dbg_wrcal_start => dbg_wrcal_start,
1887 dbg_wrcal_done => dbg_wrcal_done ,
1888 dbg_wrlvl_start => dbg_wrlvl_start,
1889 dbg_wrlvl_done => dbg_wrlvl_done ,
1890 dbg_wrlvl_err => dbg_wrlvl_err,
1891 dbg_wrlvl_fine_tap_cnt => dbg_wrlvl_fine_tap_cnt,
1892 dbg_wrlvl_coarse_tap_cnt => dbg_wrlvl_coarse_tap_cnt,
1893 dbg_phy_wrlvl => dbg_phy_wrlvl,
1894 dbg_tap_cnt_during_wrlvl => dbg_tap_cnt_during_wrlvl,
1895 dbg_wl_edge_detect_valid => dbg_wl_edge_detect_valid,
1896 dbg_rd_data_edge_detect => dbg_rd_data_edge_detect,
1897 dbg_final_po_fine_tap_cnt => dbg_final_po_fine_tap_cnt,
1898 dbg_final_po_coarse_tap_cnt => dbg_final_po_coarse_tap_cnt,
1899 dbg_phy_wrcal => dbg_phy_wrcal,
1900 dbg_rdlvl_start => dbg_rdlvl_start,
1901 dbg_rdlvl_done => dbg_rdlvl_done ,
1902 dbg_rdlvl_err => dbg_rdlvl_err,
1903 dbg_cpt_first_edge_cnt => dbg_cpt_first_edge_cnt,
1904 dbg_cpt_second_edge_cnt => dbg_cpt_second_edge_cnt,
1905 dbg_cpt_tap_cnt => dbg_cpt_tap_cnt,
1906 dbg_dq_idelay_tap_cnt => dbg_dq_idelay_tap_cnt,
1907 dbg_sel_pi_incdec => dbg_sel_pi_incdec,
1908 dbg_sel_po_incdec => dbg_sel_po_incdec,
1909 dbg_byte_sel => dbg_byte_sel,
1910 dbg_pi_f_inc => dbg_pi_f_inc,
1911 dbg_pi_f_dec => dbg_pi_f_dec,
1912 dbg_po_f_inc => dbg_po_f_inc,
1913 dbg_po_f_stg23_sel => dbg_po_f_stg23_sel,
1914 dbg_po_f_dec => dbg_po_f_dec,
1915 dbg_idel_up_all => dbg_idel_up_all,
1916 dbg_idel_down_all => dbg_idel_down_all,
1917 dbg_idel_up_cpt => dbg_idel_up_cpt,
1918 dbg_idel_down_cpt => dbg_idel_down_cpt,
1919 dbg_sel_idel_cpt => dbg_sel_idel_cpt,
1920 dbg_sel_all_idel_cpt => dbg_sel_all_idel_cpt,
1921 dbg_phy_rdlvl => dbg_phy_rdlvl,
1922 dbg_calib_top => dbg_calib_top,
1923 dbg_phy_init => dbg_phy_init,
1924 dbg_prbs_rdlvl => dbg_prbs_rdlvl ,
1925 dbg_dqs_found_cal => dbg_dqs_found_cal,
1926 dbg_phy_oclkdelay_cal => dbg_phy_oclkdelay_cal,
1927 dbg_oclkdelay_rd_data => dbg_oclkdelay_rd_data,
1928 dbg_oclkdelay_calib_start => dbg_oclkdelay_calib_start,
1929 dbg_oclkdelay_calib_done => dbg_oclkdelay_calib_done
1932 end architecture arch_ddr_phy_top;