1 ----------------------------------------------------------------------------------
5 -- Create Date: 11:
31:
47 07/26/2010
7 -- Module Name: ddr_if - Behavioral
16 -- Revision 0.
01 -
File Created
17 -- Additional Comments:
19 ----------------------------------------------------------------------------------
21 use IEEE.STD_LOGIC_1164.
ALL;
22 use IEEE.STD_LOGIC_ARITH.
ALL;
23 use IEEE.STD_LOGIC_UNSIGNED.
ALL;
24 use IEEE.std_logic_misc.
all;
27 -- Uncomment the following library declaration if using
28 -- arithmetic functions with or values
29 --use IEEE.NUMERIC_STD.ALL;
31 -- Uncomment the following library declaration if instantiating
32 -- any Xilinx primitives in this code.
34 use UNISIM.VComponents.
all;
37 generic(SIM_BYPASS_INIT_CAL : := "OFF";
SIMULATION : := "FALSE");
48 mem_test : in (1 downto 0);
49 EventData : in array3X67;
50 EventData_we : in (2 downto 0);
51 wport_rdy : out (2 downto 0);
52 WrtMonBlkDone : out (2 downto 0);
53 WrtMonEvtDone : out (2 downto 0);
54 KiloByte_toggle : out (2 downto 0);
55 EoB_toggle : out (2 downto 0);
56 EventBufAddr : in array3x14;
57 EventBufAddr_we : in (2 downto 0);
58 EventFIFOfull : out (2 downto 0);
59 TCP_din : in (31 downto 0);
60 TCP_channel : in (1 downto 0);
62 TCP_wcount : out (2 downto 0);
63 TCP_dout : out (31 downto 0);
-- TCP data are written in unit of 32-bit words
64 TCP_dout_type : out (2 downto 0);
-- TCP data destination
65 TCP_raddr : in (28 downto 0);
-- 28-26 encoded request source 25-0 address in 64 word
66 TCP_length : in (12 downto 0);
-- in 64 word, actual length -
1
67 TCP_dout_valid : out ;
71 cs_out : out (511 downto 0);
76 page_addr : in (9 downto 0);
77 ipb_addr : in (31 downto 0);
78 ipb_wdata : in (31 downto 0);
79 ipb_rdata : out (31 downto 0);
81 mem_stat : out (63 downto 0);
82 device_temp : in (11 downto 0);
84 ddr3_dq : inout (31 downto 0);
85 ddr3_dm : out (3 downto 0);
86 ddr3_addr : out (13 downto 0);
87 ddr3_ba : out (2 downto 0);
88 ddr3_dqs_p : inout (3 downto 0);
89 ddr3_dqs_n : inout (3 downto 0);
94 ddr3_cke : out (0 to 0);
95 ddr3_odt : out (0 to 0);
96 ddr3_ck_p : out (0 to 0);
97 ddr3_ck_n : out (0 to 0)
107 --***************************************************************************
108 -- The following parameters refer to width of various ports
109 --***************************************************************************
111 -- # of memory Bank Address bits.
113 -- # of CK/CK# outputs to memory.
115 -- # of memory Column Address bits.
117 -- # of unique CS outputs to memory.
119 -- # of unique CS outputs per rank for phy
121 -- # of CKE outputs to memory.
122 DATA_BUF_ADDR_WIDTH : :=
5;
124 -- = ceil(log2(DQ_WIDTH))
127 -- # of DM (data mask)
131 DQS_CNT_WIDTH : :=
2;
132 -- = ceil(log2(DQS_WIDTH))
138 PAYLOAD_WIDTH : :=
32;
140 MC_ERR_ADDR_WIDTH : :=
31;
146 -- # of ODT outputs to memory.
148 -- # of memory Row Address bits.
150 -- # = RANK_WIDTH + BANK_WIDTH
151 -- + ROW_WIDTH + COL_WIDTH;
152 -- Chip Select is always tied to low for
153 -- single rank devices
155 -- # = 1,
When Chip
Select (CS#) output
is enabled
156 -- = 0,
When Chip
Select (CS#) output
is disabled
157 -- If CS_N disabled, user must connect
158 -- DRAM CS_N input(s) to ground
160 -- # = 1,
When Data Mask option
is enabled
161 -- = 0,
When Data Mask option
is disbaled
162 -- When Data Mask option is disabled in
163 -- MIG Controller Options page, the logic
164 -- related to Data Mask should not get
167 -- # = 1,
When ODT output
is enabled
168 -- = 0,
When ODT output
is disabled
169 PHY_CONTROL_MASTER_BANK : :=
1;
170 -- The bank index where master PHY_CONTROL resides,
171 -- equal to the PLL residing bank
172 MEM_DENSITY : :=
"2Gb";
173 -- Indicates the density of the Memory part
174 -- Added for the sake of Vivado simulations
175 MEM_SPEEDGRADE : := "
107E";
176 -- Indicates the Speed grade of Memory Part
177 -- Added for the sake of Vivado simulations
178 MEM_DEVICE_WIDTH : :=
16;
179 -- Indicates the device width of the Memory Part
180 -- Added for the sake of Vivado simulations
182 --***************************************************************************
183 -- The following parameters are mode register settings
184 --***************************************************************************
187 -- Additive Latency (Mode Register 1).
188 -- # = "0",
"CL-1",
"CL-2".
190 -- Additive Latency (Extended Mode Register).
192 -- # Additive Latency in number of clock
196 -- Burst Length (Mode Register 0).
197 -- # = "8", "
4",
"OTF".
199 -- Burst Length (Mode Register).
201 BURST_TYPE : :=
"SEQ";
202 -- DDR3 SDRAM: Burst Type (Mode Register 0).
203 -- DDR2 SDRAM: Burst Type (Mode Register).
204 -- # = "SEQ" - (Sequential),
205 -- = "INT" - (Interleaved).
207 -- in number of clock cycles
208 -- DDR3 SDRAM: CAS Latency (Mode Register 0).
209 -- DDR2 SDRAM: CAS Latency (Mode Register).
211 -- in number of clock cycles
212 -- DDR3 SDRAM: CAS Write Latency (Mode Register 2).
213 -- DDR2 SDRAM: Can be ignored
214 OUTPUT_DRV : :=
"LOW";
215 -- Output Driver Impedance Control (Mode Register 1).
216 -- # = "HIGH" - RZQ/7,
219 -- RTT_NOM (ODT) (Mode Register 1).
224 -- RTT_WR (ODT) (Mode Register 2).
225 -- # = "OFF" - Dynamic ODT off,
228 ADDR_CMD_MODE : :=
"1T" ;
231 -- # = "ON" - RDIMMs,
232 -- = "OFF" - Components, SODIMMs, UDIMMs.
233 CA_MIRROR : :=
"OFF";
234 -- C/A mirror opt for DDR3 dual rank
236 --***************************************************************************
237 -- The following parameters are multiplier and divisor factors for PLLE2.
238 -- Based on the selected design frequency these parameters vary.
239 --***************************************************************************
240 CLKIN_PERIOD : :=
4288;
241 -- Input Clock Period
242 CLKFBOUT_MULT : :=
8;
243 -- write PLL VCO multiplier
244 DIVCLK_DIVIDE : :=
1;
245 -- write PLL VCO divisor
246 CLKOUT0_PHASE : :=
337.
5;
247 -- Phase for PLL output clock (CLKOUT0)
248 CLKOUT0_DIVIDE : :=
2;
249 -- VCO output divisor for PLL output clock (CLKOUT0)
250 CLKOUT1_DIVIDE : :=
2;
251 -- VCO output divisor for PLL output clock (CLKOUT1)
252 CLKOUT2_DIVIDE : :=
32;
253 -- VCO output divisor for PLL output clock (CLKOUT2)
254 CLKOUT3_DIVIDE : :=
8;
255 -- VCO output divisor for PLL output clock (CLKOUT3)
257 --***************************************************************************
258 -- Memory Timing Parameters. These parameters varies based on the selected
260 --***************************************************************************
262 -- memory tCKE paramter in pS
264 -- memory tRAW paramter in pS.
266 -- memory tPRDI paramter in pS.
268 -- memory tRAS paramter in pS.
270 -- memory tRCD paramter in pS.
272 -- memory tREFI paramter in pS.
274 -- memory tRFC paramter in pS.
276 -- memory tRP paramter in pS.
278 -- memory tRRD paramter in pS.
280 -- memory tRTP paramter in pS.
282 -- memory tWTR paramter in pS.
284 -- memory tZQI paramter in nS.
286 -- memory tZQCS paramter in clock cycles.
288 --***************************************************************************
289 -- Simulation parameters
290 --***************************************************************************
291 SIM_BYPASS_INIT_CAL : :=
"OFF";
292 -- # = "OFF" - Complete memory init &
293 -- calibration sequence
294 -- # = "SKIP" -
Not supported
295 -- # = "FAST" - Complete memory init &
use
296 -- abbreviated calib sequence
298 SIMULATION : :=
"FALSE";
299 -- Should be TRUE during design simulations and
300 -- FALSE during implementations
302 --***************************************************************************
303 -- The following parameters varies based on the pin out entered in MIG GUI.
304 -- Do not change any of these parameters directly by editing the RTL.
305 -- Any changes required should be done through GUI and the design regenerated.
306 --***************************************************************************
307 BYTE_LANES_B0 : (
3 downto 0) := "
0011";
308 -- Byte lanes used in an IO column.
309 BYTE_LANES_B1 : (
3 downto 0) := "
1111";
310 -- Byte lanes used in an IO column.
311 BYTE_LANES_B2 : (
3 downto 0) := "
1100";
312 -- Byte lanes used in an IO column.
313 BYTE_LANES_B3 : (
3 downto 0) := "
0000";
314 -- Byte lanes used in an IO column.
315 BYTE_LANES_B4 : (
3 downto 0) := "
0000";
316 -- Byte lanes used in an IO column.
317 DATA_CTL_B0 : (
3 downto 0) := "
0011";
318 -- Indicates Byte lane is data byte lane
319 -- or control Byte lane. '1' in a
320 -- position indicates a data byte lane and
321 -- a '0' indicates a control byte lane
322 DATA_CTL_B1 : (
3 downto 0) := "
0000";
323 -- Indicates Byte lane is data byte lane
324 -- or control Byte lane. '1' in a
325 -- position indicates a data byte lane and
326 -- a '0' indicates a control byte lane
327 DATA_CTL_B2 : (
3 downto 0) := "
1100";
328 -- Indicates Byte lane is data byte lane
329 -- or control Byte lane. '1' in a
330 -- position indicates a data byte lane and
331 -- a '0' indicates a control byte lane
332 DATA_CTL_B3 : (
3 downto 0) := "
0000";
333 -- Indicates Byte lane is data byte lane
334 -- or control Byte lane. '1' in a
335 -- position indicates a data byte lane and
336 -- a '0' indicates a control byte lane
337 DATA_CTL_B4 : (
3 downto 0) := "
0000";
338 -- Indicates Byte lane is data byte lane
339 -- or control Byte lane. '1' in a
340 -- position indicates a data byte lane and
341 -- a '0' indicates a control byte lane
342 PHY_0_BITLANES : (
47 downto 0) := X"
00000037F2FF";
343 PHY_1_BITLANES : (
47 downto 0) := X"
000004F3FDFF";
344 PHY_2_BITLANES : (
47 downto 0) := X"
3FE3DF000000";
346 -- control/address/data pin mapping parameters
348 : (
143 downto 0) := X"
000000000000000000000000000000000013";
350 : (
191 downto 0) := X"
00000010610710A10210510811B10110010B111113122119";
351 BANK_MAP : (
35 downto 0) := X"
11510311A";
352 CAS_MAP : (
11 downto 0) := X"
118";
353 CKE_ODT_BYTE_MAP : (
7 downto 0) := X"
00";
354 CKE_MAP : (
95 downto 0) := X"
000000000000000000000104";
355 ODT_MAP : (
95 downto 0) := X"
000000000000000000000112";
356 CS_MAP : (
119 downto 0) := X"
000000000000000000000000000000";
357 PARITY_MAP : (
11 downto 0) := X"
000";
358 RAS_MAP : (
11 downto 0) := X"
110";
359 WE_MAP : (
11 downto 0) := X"
114";
361 : (
143 downto 0) := X"
000000000000000000000000000000012223";
362 DATA0_MAP : (
95 downto 0) := X"
232235237234238231236233";
363 DATA1_MAP : (
95 downto 0) := X"
220226221224223227228229";
364 DATA2_MAP : (
95 downto 0) := X"
012015013016018011014019";
365 DATA3_MAP : (
95 downto 0) := X"
000002001009006003005007";
366 DATA4_MAP : (
95 downto 0) := X"
000000000000000000000000";
367 DATA5_MAP : (
95 downto 0) := X"
000000000000000000000000";
368 DATA6_MAP : (
95 downto 0) := X"
000000000000000000000000";
369 DATA7_MAP : (
95 downto 0) := X"
000000000000000000000000";
370 DATA8_MAP : (
95 downto 0) := X"
000000000000000000000000";
371 DATA9_MAP : (
95 downto 0) := X"
000000000000000000000000";
372 DATA10_MAP : (
95 downto 0) := X"
000000000000000000000000";
373 DATA11_MAP : (
95 downto 0) := X"
000000000000000000000000";
374 DATA12_MAP : (
95 downto 0) := X"
000000000000000000000000";
375 DATA13_MAP : (
95 downto 0) := X"
000000000000000000000000";
376 DATA14_MAP : (
95 downto 0) := X"
000000000000000000000000";
377 DATA15_MAP : (
95 downto 0) := X"
000000000000000000000000";
378 DATA16_MAP : (
95 downto 0) := X"
000000000000000000000000";
379 DATA17_MAP : (
95 downto 0) := X"
000000000000000000000000";
380 MASK0_MAP : (
107 downto 0) := X"
000000000000000004010222239";
381 MASK1_MAP : (
107 downto 0) := X"
000000000000000000000000000";
383 SLOT_0_CONFIG : (
7 downto 0) := "
00000001";
385 SLOT_1_CONFIG : (
7 downto 0) := "
00000000";
388 : :=
"BANK_ROW_COLUMN";
390 --***************************************************************************
391 -- IODELAY and PHY related parameters
392 --***************************************************************************
393 IODELAY_HP_MODE : :=
"ON";
395 IBUF_LPWR_MODE : :=
"OFF";
397 DATA_IO_IDLE_PWRDWN : :=
"ON";
399 BANK_TYPE : :=
"HP_IO";
400 -- # = "HP_IO",
"HPL_IO",
"HR_IO", "HRL_IO"
401 DATA_IO_PRIM_TYPE : :=
"HP_LP";
402 -- # = "HP_LP",
"HR_LP", "DEFAULT"
403 CKE_ODT_AUX : :=
"FALSE";
404 USER_REFRESH : :=
"OFF";
406 -- # = "ON" - DDR3 SDRAM
407 -- = "OFF" - DDR2 SDRAM.
408 ORDERING : :=
"NORM";
409 -- # = "NORM",
"STRICT",
"RELAXED".
410 CALIB_ROW_ADD : (
15 downto 0) := X"
0000";
411 -- Calibration row address will be used for
412 -- calibration read and write operations
413 CALIB_COL_ADD : (
11 downto 0) := X"
000";
414 -- Calibration column address will be used for
415 -- calibration read and write operations
416 CALIB_BA_ADD : (
2 downto 0) := "
000";
417 -- Calibration bank address will be used for
418 -- calibration read and write operations
420 IODELAY_GRP : :=
"IODELAY_MIG";
421 -- It is associated to a set of IODELAYs with
422 -- an IDELAYCTRL that have same IODELAY CONTROLLER
424 SYSCLK_TYPE : :=
"DIFFERENTIAL";
425 -- System clock type DIFFERENTIAL, SINGLE_ENDED,
427 REFCLK_TYPE : :=
"NO_BUFFER";
428 -- Reference clock type DIFFERENTIAL, SINGLE_ENDED
429 -- NO_BUFFER, USE_SYSTEM_CLOCK
431 CMD_PIPE_PLUS1 : :=
"ON";
432 -- add pipeline stage between MC and PHY
433 DRAM_TYPE : :=
"DDR3";
434 CAL_WIDTH : :=
"HALF";
438 --***************************************************************************
439 -- Referece clock frequency parameters
440 --***************************************************************************
441 REFCLK_FREQ : :=
200.
0;
442 -- IODELAYCTRL reference clock frequency
443 DIFF_TERM_REFCLK : :=
"TRUE";
444 -- Differential Termination for idelay
445 -- reference clock input pins
446 --***************************************************************************
447 -- System clock frequency parameters
448 --***************************************************************************
450 -- memory tCK paramter.
451 -- # = Clock Period in pS.
453 -- # of memory CKs per fabric CLK
454 DIFF_TERM_SYSCLK : :=
"FALSE";
455 -- Differential Termination for System
458 --***************************************************************************
460 --***************************************************************************
461 DEBUG_PORT : :=
"OFF";
462 -- # = "ON" Enable debug signals/controls.
463 -- = "OFF" Disable debug signals/controls.
465 --***************************************************************************
466 -- Temparature monitor parameter
467 --***************************************************************************
468 TEMP_MON_CONTROL : :=
"EXTERNAL";
469 -- # = "INTERNAL", "EXTERNAL"
472 -- =1 for active low reset,
473 -- =0 for active high.
479 ddr3_dq :
inout (DQ_WIDTH
-1 downto 0);
480 ddr3_dqs_p :
inout (DQS_WIDTH
-1 downto 0);
481 ddr3_dqs_n :
inout (DQS_WIDTH
-1 downto 0);
484 ddr3_addr :
out (ROW_WIDTH
-1 downto 0);
485 ddr3_ba :
out (BANK_WIDTH
-1 downto 0);
490 ddr3_ck_p :
out (CK_WIDTH
-1 downto 0);
491 ddr3_ck_n :
out (CK_WIDTH
-1 downto 0);
492 ddr3_cke :
out (CKE_WIDTH
-1 downto 0);
494 ddr3_dm :
out (DM_WIDTH
-1 downto 0);
495 ddr3_odt :
out (ODT_WIDTH
-1 downto 0);
498 -- Differential system clocks
501 -- Single-ended iodelayctrl clk (reference clock)
503 -- user interface signals
504 app_addr :
in (ADDR_WIDTH
-1 downto 0);
505 app_cmd :
in (
2 downto 0);
507 app_wdf_data :
in ((nCK_PER_CLK*
2*PAYLOAD_WIDTH)
-1 downto 0);
509 app_wdf_mask :
in ((nCK_PER_CLK*
2*PAYLOAD_WIDTH)/
8-1 downto 0) ;
511 app_rd_data :
out ((nCK_PER_CLK*
2*PAYLOAD_WIDTH)
-1 downto 0);
512 app_rd_data_end :
out ;
513 app_rd_data_valid :
out ;
517 app_sr_active :
out ;
523 ui_clk_sync_rst :
out ;
527 init_calib_complete :
out ;
528 device_temp_i :
in (
11 downto 0);
529 -- The 12 MSB bits
of the temperature sensor transfer
530 -- function need to be connected to this port. This port
531 -- will be synchronized w.r.t. to fabric clock internally.
546 test :
IN (
1 downto 0);
547 test_block_sent :
IN ;
548 TCP_addr :
IN (
28 downto 0);
549 TCP_length :
IN (
12 downto 0);
554 ipb_addr :
IN (
31 downto 0);
555 page_addr :
IN (
9 downto 0);
558 app_rd_data_valid :
IN ;
559 app_rd_data :
IN (
255 downto 0);
561 test_status :
OUT (
63 downto 0);
562 TCP_dout :
OUT (
31 downto 0);
563 TCP_dout_type :
OUT (
2 downto 0);
564 TCP_dout_valid :
OUT ;
567 cs_out :
OUT (
511 downto 0);
568 ipb_rdata :
OUT (
31 downto 0);
572 app_addr :
OUT (
27 downto 0)
584 din :
IN (
65 downto 0);
586 event_addr :
IN (
13 downto 0);
592 WrtMonBlkDone :
out ;
593 WrtMonEvtDone :
out ;
594 KiloByte_toggle :
out ;
600 app_addr :
OUT (
23 downto 0);
601 dout :
OUT (
255 downto 0);
602 cs_out :
OUT (
511 downto 0);
603 debug :
OUT (
63 downto 0)
614 test :
IN (
1 downto 0);
615 TCP_din :
in (
31 downto 0);
616 TCP_channel :
in (
1 downto 0);
618 TCP_wcount :
out (
2 downto 0);
622 ipb_addr :
IN (
31 downto 0);
623 ipb_wdata :
IN (
31 downto 0);
627 test_block_sent :
OUT ;
633 app_wdf_mask :
OUT (
7 downto 0);
634 app_addr :
OUT (
23 downto 0);
635 dout :
OUT (
255 downto 0);
636 debug_out :
OUT (
63 downto 0)
647 signal ipb_wack : := '0';
648 signal ipb_rack : := '0';
649 type array4X256 is array(0 to 3) of (255 downto 0);
650 signal w_data : array4X256 := (others => (others => '0'));
651 type array4X24 is array(0 to 3) of (23 downto 0);
652 signal w_addr : array4X24 := (others => (others => '0'));
653 signal test_stat : (63 downto 0) := (others => '0');
654 signal w_mask : (7 downto 0) := (others => '0');
655 signal app_wdf_wren : := '0';
656 signal app_en : := '0';
657 signal app_cmd : (2 downto 0) := (others => '0');
658 signal app_addr : (27 downto 0) := (others => '0');
659 signal app_raddr : (27 downto 0) := (others => '0');
660 signal app_rdy : := '0';
661 signal app_rdyp : := '0';
662 signal app_wdf_rdy : := '0';
663 signal app_wdf_rdyp : := '0';
664 signal app_wdf_mask : (31 downto 0) := (others => '0');
665 signal app_rd_data_valid : := '0';
667 signal phy_init_done : := '0';
668 signal app_rd_data : (255 downto 0) := (others => '0');
669 signal app_wdf_data : (255 downto 0) := (others => '0');
670 signal test_block_sent : := '0';
671 signal test_pause : := '0';
672 signal app_rrqst : := '0';
673 signal app_rack : := '0';
674 signal app_ren : := '0';
675 signal app_wen : (3 downto 0) := (others => '1');
676 signal w_data_we : (3 downto 0) := (others => '0');
677 signal w_rqst : (3 downto 0) := (others => '0');
678 signal w_ack : (3 downto 0) := (others => '0');
679 signal InitDoneSyncRegs : (2 downto 0) := (others => '0');
680 signal resetSyncRegsMem : (2 downto 0) := (others => '0');
681 signal resetSyncRegsTCP : (2 downto 0) := (others => '0');
682 signal sysCntr : (19 downto 0) := (others => '0');
683 signal MemCntr : (20 downto 0) := (others => '0');
684 signal sysCntrSyncRegs : (2 downto 0) := (others => '0');
685 --signal TCP_dout_i : (31 downto 0) := (
others => '0');
686 signal fifo_rst : := '1';
687 signal fifo_en : := '1';
688 signal reset_dl : := '1';
689 signal debug : (255 downto 0) := (others => '0');
690 signal rport_cs : (511 downto 0) := (others => '0');
691 type array3X512 is array(0 to 2) of (511 downto 0);
692 signal wportA_cs : array3x512 := (others => (others => '0'));
697 Din :
IN (
303 downto 0)
700 signal cs_in : (303 downto 0) := (others => '0');
706 ina :
IN (
135 downto 0);
707 inb :
IN (
135 downto 0)
710 signal cs_ina : (135 downto 0) := (others => '0');
711 signal cs_inb : (135 downto 0) := (others => '0');
714 --i_chipscope: chipscope generic map(N => 7)
PORT MAP(
720 --cs_ina(135 downto 128) <= cs_inb(
135 downto 128);
721 --cs_inb(135 downto 132) <= wportA_cs(
0)(
18 downto 15);
722 --cs_inb(131) <= wportA_cs(
0)(
13);
723 --cs_inb(130 downto 128) <= wportA_cs(
0)(
42 downto 40);
724 --cs_ina(16 downto 0) <= wportA_cs(
0)(
37 downto 21);
725 --cs_inb(23 downto 21) <= wportA_cs(
0)(
42 downto 40);
726 --cs_inb(20 downto 0) <= wportA_cs(
0)(
20 downto 0);
727 --cs_out(165 downto 104) <= rport_cs(
165 downto 104);
728 --cs_out(103 downto 89) <= wportA_cs(
0)(
14 downto 0);
729 --cs_out(88) <= app_wdf_wren;
730 --cs_out(87) <= app_wdf_rdy;
731 --cs_out(86) <= app_rdy;
732 --cs_out(85) <= app_en;
733 --cs_out(84 downto 81) <= app_wen;
734 --cs_out(80 downto 77) <= w_ack;
735 --cs_out(76 downto 73) <= w_rqst;
736 --cs_out(72 downto 0) <= rport_cs(
72 downto 0);
737 --i_chipscope1: chipscope1 generic map(N => 2)
PORT MAP(
741 --cs_in(288) <= w_rqst(
3);
742 --cs_in(289) <= test_stat(
31);
743 --cs_in(287) <= w_data_we(
3);
744 --g_cs: for i in 0 to 7 generate
745 -- cs_in(i*26+103 downto i*26+78) <= w_data(3)(i*32+25
downto i*32);
747 --cs_in(77 downto 70) <= w_mask;
748 --cs_in(69 downto 46) <= w_addr(
3);
749 --cs_in(45 downto 18) <= app_addr;
750 --cs_in(17 downto 14) <= w_ack;
751 --cs_in(13 downto 10) <= w_rqst;
752 --cs_in(9) <= app_rack;
753 --cs_in(8) <= app_ren;
754 --cs_in(7) <= app_rrqst;
755 --cs_in(6) <= app_wdf_rdyp;
756 --cs_in(5) <= app_wdf_wren;
757 --cs_in(4) <= app_wdf_rdy;
758 --cs_in(3) <= app_rdyp;
759 --cs_in(2) <= app_rdy;
760 --cs_in(1) <= app_en;
761 --cs_in(0) <= app_wen(
3);
762 --TCP_dout <= TCP_dout_i;
765 if(sysclk'event and sysclk = '1')then
766 SysCntr <= SysCntr + 1;
769 ipb_ack <= ipb_rack or ipb_wack;
774 resetSys => resetSyncRegsTCP
(2),
775 resetMem => resetSyncRegsMem
(2),
778 test_block_sent => test_block_sent,
779 test_pause => test_pause,
780 test_status => test_stat,
781 TCP_dout => TCP_dout,
782 TCP_dout_type => TCP_dout_type,
783 TCP_addr => TCP_raddr,
784 TCP_length => TCP_length,
785 TCP_dout_valid => TCP_dout_valid ,
786 TCP_rqst => TCP_rrqst,
787 TCP_lastword => TCP_lastword,
791 ipb_write => ipb_write,
792 ipb_strobe => ipb_strobe,
793 ipb_addr => ipb_addr,
794 ipb_rdata => ipb_rdata,
796 page_addr => page_addr,
797 app_rqst => app_rrqst,
801 app_rd_data_valid => app_rd_data_valid,
802 app_rd_data => app_rd_data,
803 app_addr => app_raddr
808 fifo_rst => fifo_rst,
811 g_ddr_wportA : for i in 0 to 2 generate
815 fifo_rst => fifo_rst,
817 resetSys => resetSys,
818 resetMem => resetSyncRegsMem
(2),
820 din => EventData
(i
)(65 downto 0),
821 din_we => EventData_we
(i
),
822 port_rdy => wport_rdy
(i
),
823 WrtMonBlkDone => WrtMonBlkDone
(i
),
824 WrtMonEvtDone => WrtMonEvtDone
(i
),
825 KiloByte_toggle => KiloByte_toggle
(i
),
826 EoB_toggle => EoB_toggle
(i
),
827 buf_full => EventFIFOfull
(i
),
828 event_addr => EventBufAddr
(i
),
829 addr_we => EventBufAddr_we
(i
),
833 app_en => app_wen
(i
),
834 app_wdf_rdy => app_wdf_rdyp,
835 app_wdf_wren => w_data_we
(i
),
836 app_addr => w_addr
(i
),
838 cs_out => wportA_cs
(i
),
839 debug => debug
(64*i+63
downto 64*i
)
846 resetSys => resetSyncRegsTCP
(2),
847 resetMem => resetSyncRegsMem
(2),
850 test_block_sent => test_block_sent,
851 test_pause => test_pause,
853 TCP_channel => TCP_channel,
855 TCP_wcount => TCP_wcount,
857 ipb_write => ipb_write,
858 ipb_strobe => ipb_strobe,
859 ipb_addr => ipb_addr,
860 ipb_wdata => ipb_wdata,
862 app_rqst => w_rqst
(3),
864 app_en => app_wen
(3),
866 app_wdf_rdy => app_wdf_rdyp,
867 app_wdf_wren => w_data_we
(3),
868 app_wdf_mask => w_mask,
869 app_addr => w_addr
(3),
871 debug_out => debug
(255 downto 192)
873 app_rdyp <= app_rdy or not app_en;
874 app_wdf_rdyp <= app_wdf_rdy or not app_wdf_wren;
875 process(TCPclk,reset)
878 resetSyncRegsTCP <= (others => '1');
879 elsif(TCPclk'event and TCPclk = '1')then
880 resetSyncRegsTCP <= resetSyncRegsTCP(1 downto 0) & '0';
886 resetSyncRegsMem <= (others => '1');
887 elsif(clk'event and clk = '1')then
888 resetSyncRegsMem <= resetSyncRegsMem(1 downto 0) & '0';
891 process(clk,phy_init_done)
893 if(phy_init_done = '0')then
894 InitDoneSyncRegs <= (others => '0');
895 elsif(clk'event and clk = '1')then
896 InitDoneSyncRegs <= InitDoneSyncRegs(1 downto 0) & '1';
900 variable w_sel : (1 downto 0);
902 w_sel(1) := w_ack(3) or w_ack(2);
903 w_sel(0) := w_ack(3) or w_ack(1);
904 if(clk'event and clk = '1')then
905 if(InitDoneSyncRegs(2) = '0')then
907 w_ack <= (others => '0');
908 elsif(or_reduce(w_ack and w_rqst) = '0' and (app_rrqst = '0' or app_rack = '0'))then
910 w_ack <= (others => '0');
911 if(w_rqst(3) = '1')then
913 elsif(app_rrqst = '1')then
915 elsif(w_rqst(0) = '1')then
917 elsif(w_rqst(1) = '1')then
919 elsif(w_rqst(2) = '1')then
923 if(app_en = '0' or app_rdy = '1')then
924 if(app_rack = '1')then
926 app_addr(26 downto 3) <= app_raddr(26 downto 3);
929 app_addr(26 downto 3) <= w_addr(conv_integer(w_sel));
932 if(resetSyncRegsMem(2) = '1')then
934 elsif(or_reduce(app_wen) = '1' or app_ren = '1')then
936 elsif(app_rdy = '1')then
939 if(resetSyncRegsMem(2) = '1')then
941 elsif(or_reduce(w_data_we) = '1')then
943 elsif(app_wdf_rdy = '1')then
946 if(app_wdf_rdy = '1' or app_wdf_wren = '0')then
947 if(w_ack(3) = '1')then
948 for i in 0 to 31 loop
949 app_wdf_mask(i) <= w_mask(i/4);
952 app_wdf_mask <= (others => '0');
955 when "00" => app_wdf_data <= w_data(0);
956 when "01" => app_wdf_data <= w_data(1);
957 when "10" => app_wdf_data <= w_data(2);
958 when others => app_wdf_data <= w_data(3);
964 app_addr(2 downto 0) <= "000";
968 ddr3_dqs_n => ddr3_dqs_n,
969 ddr3_dqs_p => ddr3_dqs_p,
970 ddr3_addr => ddr3_addr,
972 ddr3_ras_n => ddr3_ras_n,
973 ddr3_cas_n => ddr3_cas_n,
974 ddr3_we_n => ddr3_we_n,
975 ddr3_reset_n => ddr3_reset_n,
976 ddr3_ck_p => ddr3_ck_p,
977 ddr3_ck_n => ddr3_ck_n,
978 ddr3_cke => ddr3_cke,
980 ddr3_odt => ddr3_odt,
981 sys_clk_p => mem_clk_p,
982 sys_clk_n => mem_clk_n,
983 clk_ref_i => clk_ref,
984 app_addr => app_addr,
987 app_wdf_data => app_wdf_data,
988 app_wdf_end => app_wdf_wren,
989 app_wdf_mask => app_wdf_mask,
990 app_wdf_wren => app_wdf_wren,
991 app_rd_data => app_rd_data,
992 app_rd_data_end =>
open,
993 app_rd_data_valid => app_rd_data_valid,
995 app_wdf_rdy => app_wdf_rdy,
997 app_sr_active =>
open,
1003 ui_clk_sync_rst =>
open ,
1004 init_calib_complete => phy_init_done,
1005 device_temp_i => device_temp,
1008 --process(phy_init_done,test_stat,ipb_addr,app_rrqst, app_rack, app_ren, app_wen, w_data_we, w_rqst, w_ack, app_en_accept, test_block_sent, test_pause, app_wdf_wren, app_en, app_cmd, app_rdy, app_wdf_rdy, app_wdf_rdyp, app_rd_data_valid, w_mask, w_addr, app_cmd, app_addr, app_raddr)
1010 -- case ipb_addr(18 downto 16)
is
1011 -- when "000" => mem_stat <=
not phy_init_done & test_stat(
32) & x"0" & app_rrqst & app_rack & app_ren & test_block_sent & test_pause & app_en_accept & app_wen & w_data_we & w_rqst & w_ack & test_stat(
31 downto 0);
1012 -- when "001" => mem_stat <= "
00" & app_wdf_wren & app_en & app_rdy & app_wdf_rdy & app_wdf_rdyp & app_rd_data_valid & w_addr(
0) & w_mask & w_addr(
1);
1013 -- when "010" => mem_stat <= "
00000" & app_cmd & w_addr(
3) & "
00" & test_stat(
63 downto 58) & w_addr(
2);
1014 -- when "011" => mem_stat <= x"0" & app_addr & x"0" & app_raddr;
1015 -- when "100" => mem_stat <= debug(
63 downto 0);
1016 -- when "101" => mem_stat <= debug(
127 downto 64);
1017 -- when "110" => mem_stat <= debug(
191 downto 128);
1018 ---- when others => mem_stat <= debug(255 downto 192);
1019 -- when others => mem_stat <= test_stat(63 downto 32) & debug(
223 downto 192);
1022 mem_stat(63) <= not phy_init_done;
1023 mem_stat(62) <= debug(192);
1024 mem_stat(61) <= debug(128);
1025 mem_stat(60) <= debug(64);
1026 mem_stat(31 downto 0) <= test_stat(31 downto 0);
1027 --mem_stat(62) <= test_stat(
32);
1028 mem_stat(59 downto 32) <= (others => '0');
1029 --mem_stat(40 downto 32) <= debug(
8 downto 0);
1030 --mem_stat(31 downto 0) <= test_stat(
31 downto 0);
1031 --mem_stat(31 downto 21) <= SysCntr(
10 downto 0);
1032 --mem_stat(20 downto 0) <= MemCntr;
1033 --mem_stat(55 downto 53) <= SysCntrSync;
1034 --mem_stat(0) <= overflowErr;
1035 --mem_stat(1) <= testErr;
1036 --mem_stat(2) <= mem_ready;
1037 --mem_stat(17) <= rd_rqst;
1038 --mem_stat(18) <=
not wfifo_empty;
1039 --mem_stat(19) <= wfifo_full;
1040 --mem_stat(20) <= test;
1041 --mem_stat(21) <= EOF;
1042 --mem_stat(60 downto 56) <= SysCntr(
15 downto 11);
1043 --mem_stat(26) <=
not fifo_en;
1044 --mem_stat(27) <= app_cmd(
0);
1045 --mem_stat(28) <= app_en;
1046 --mem_stat(29) <=
not app_rdy;
1047 --mem_stat(30) <=
not app_wdf_rdy;
1048 --mem_stat(31) <=
not phy_init_done;