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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [altera_work/] [spw_fifo_ulight/] [ulight_fifo/] [synthesis/] [submodules/] [hps_sdram_p0_acv_hard_memphy.v] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 32 redbear
// (C) 2001-2017 Intel Corporation. All rights reserved.
2
// Your use of Intel Corporation's design tools, logic functions and other 
3
// software and tools, and its AMPP partner logic functions, and any output 
4 40 redbear
// files from any of the foregoing (including device programming or simulation 
5 32 redbear
// files), and any associated documentation or information are expressly subject 
6
// to the terms and conditions of the Intel Program License Subscription 
7 40 redbear
// Agreement, Intel FPGA IP License Agreement, or other applicable 
8 32 redbear
// license agreement, including, without limitation, that your use is for the 
9
// sole purpose of programming logic devices manufactured by Intel and sold by 
10
// Intel or its authorized distributors.  Please refer to the applicable 
11
// agreement for further details.
12
 
13
 
14
// ******************************************************************************************************************************** 
15
// File name: acv_hard_memphy.v
16
// This file instantiates all the main components of the PHY. 
17
// ******************************************************************************************************************************** 
18
 
19
`timescale 1 ps / 1 ps
20
 
21
module hps_sdram_p0_acv_hard_memphy (
22
        global_reset_n,
23
        soft_reset_n,
24
        ctl_reset_n,
25
        ctl_reset_export_n,
26
    afi_reset_n,
27
        pll_locked,
28
        oct_ctl_rs_value,
29
        oct_ctl_rt_value,
30
        afi_addr,
31
        afi_ba,
32
        afi_cke,
33
        afi_cs_n,
34
        afi_ras_n,
35
        afi_we_n,
36
        afi_cas_n,
37
        afi_rst_n,
38
        afi_odt,
39
        afi_mem_clk_disable,
40
        afi_dqs_burst,
41
        afi_wdata_valid,
42
        afi_wdata,
43
        afi_dm,
44
        afi_rdata,
45
        afi_rdata_en,
46
        afi_rdata_en_full,
47
        afi_rdata_valid,
48
        afi_wlat,
49
        afi_rlat,
50
        afi_cal_success,
51
        afi_cal_fail,
52
        avl_read,
53
        avl_write,
54
        avl_address,
55
        avl_writedata,
56
        avl_waitrequest,
57
        avl_readdata,
58
        cfg_addlat,
59
        cfg_bankaddrwidth,
60
        cfg_caswrlat,
61
        cfg_coladdrwidth,
62
        cfg_csaddrwidth,
63
        cfg_devicewidth,
64
        cfg_dramconfig,
65
        cfg_interfacewidth,
66
        cfg_rowaddrwidth,
67
        cfg_tcl,
68
        cfg_tmrd,
69
        cfg_trefi,
70
        cfg_trfc,
71
        cfg_twr,
72
        io_intaddrdout,
73
        io_intbadout,
74
        io_intcasndout,
75
        io_intckdout,
76
        io_intckedout,
77
        io_intckndout,
78
        io_intcsndout,
79
        io_intdmdout,
80
        io_intdqdin,
81
        io_intdqdout,
82
        io_intdqoe,
83
        io_intdqsbdout,
84
        io_intdqsboe,
85
        io_intdqsdout,
86
        io_intdqslogicdqsena,
87
        io_intdqslogicfiforeset,
88
        io_intdqslogicincrdataen,
89
        io_intdqslogicincwrptr,
90
        io_intdqslogicoct,
91
        io_intdqslogicrdatavalid,
92
        io_intdqslogicreadlatency,
93
        io_intdqsoe,
94
        io_intodtdout,
95
        io_intrasndout,
96
        io_intresetndout,
97
        io_intwendout,
98
        io_intafirlat,
99
        io_intafiwlat,
100
        io_intaficalfail,
101
        io_intaficalsuccess,
102
        mem_a,
103
        mem_ba,
104
        mem_cs_n,
105
        mem_cke,
106
        mem_odt,
107
        mem_we_n,
108
        mem_ras_n,
109
        mem_cas_n,
110
        mem_reset_n,
111
        mem_dq,
112
        mem_dm,
113
        mem_ck,
114
        mem_ck_n,
115
        mem_dqs,
116
        mem_dqs_n,
117
        reset_n_scc_clk,
118
        reset_n_avl_clk,
119
        scc_data,
120
        scc_dqs_ena,
121
        scc_dqs_io_ena,
122
        scc_dq_ena,
123
        scc_dm_ena,
124
        scc_upd,
125
        capture_strobe_tracking,
126
        phy_clk,
127
        ctl_clk,
128
        phy_reset_n,
129
        pll_afi_clk,
130
        pll_afi_half_clk,
131
        pll_addr_cmd_clk,
132
        pll_mem_clk,
133
        pll_mem_phy_clk,
134
        pll_afi_phy_clk,
135
        pll_avl_phy_clk,
136
        pll_write_clk,
137
        pll_write_clk_pre_phy_clk,
138
        pll_dqs_ena_clk,
139
        seq_clk,
140
        pll_avl_clk,
141
        pll_config_clk,
142
        dll_clk,
143
        dll_pll_locked,
144
        dll_phy_delayctrl
145
);
146
 
147
// ******************************************************************************************************************************** 
148
// BEGIN PARAMETER SECTION
149
// All parameters default to "" will have their values passed in from higher level wrapper with the controller and driver 
150
parameter DEVICE_FAMILY = "";
151
parameter IS_HHP_HPS = "false";
152
 
153
// On-chip termination
154
parameter OCT_SERIES_TERM_CONTROL_WIDTH   = "";
155
parameter OCT_PARALLEL_TERM_CONTROL_WIDTH = "";
156
 
157
// PHY-Memory Interface
158
// Memory device specific parameters, they are set according to the memory spec
159
parameter MEM_ADDRESS_WIDTH     = "";
160
parameter MEM_BANK_WIDTH        = "";
161
parameter MEM_IF_CS_WIDTH = "";
162
parameter MEM_CLK_EN_WIDTH      = "";
163
parameter MEM_CK_WIDTH          = "";
164
parameter MEM_ODT_WIDTH         = "";
165
parameter MEM_DQS_WIDTH         = "";
166
parameter MEM_DM_WIDTH          = "";
167
parameter MEM_CONTROL_WIDTH     = "";
168
parameter MEM_DQ_WIDTH          = "";
169
parameter MEM_READ_DQS_WIDTH    = "";
170
parameter MEM_WRITE_DQS_WIDTH   = "";
171
 
172
// PHY-Controller (AFI) Interface
173
// The AFI interface widths are derived from the memory interface widths based on full/half rate operations
174
// The calculations are done on higher level wrapper
175
 
176
 
177
// DLL Interface
178
// The DLL delay output control is always 6 bits for current existing devices
179
parameter DLL_DELAY_CTRL_WIDTH  = "";
180
 
181
parameter MR1_ODS               = "";
182
parameter MR1_RTT               = "";
183
parameter MR2_RTT_WR            = "";
184
 
185
parameter TB_PROTOCOL        = "";
186
parameter TB_MEM_CLK_FREQ    = "";
187
parameter TB_RATE            = "";
188
parameter TB_MEM_DQ_WIDTH    = "";
189
parameter TB_MEM_DQS_WIDTH   = "";
190
parameter TB_PLL_DLL_MASTER  = "";
191
 
192
parameter FAST_SIM_MODEL = "";
193
parameter FAST_SIM_CALIBRATION = "";
194
 
195
 
196
// Width of the calibration status register used to control calibration skipping.
197
parameter CALIB_REG_WIDTH = "";
198
 
199
parameter AC_ROM_INIT_FILE_NAME = "";
200
parameter INST_ROM_INIT_FILE_NAME = "";
201
 
202
// The number of AFI Resets to generate
203
localparam NUM_AFI_RESET = 4;
204
 
205
// Addr/cmd clock phase
206
localparam ADC_PHASE_SETTING = 0;
207
localparam ADC_INVERT_PHASE = "true";
208
 
209
// END PARAMETER SECTION
210
// ******************************************************************************************************************************** 
211
 
212
 
213
 
214
// ******************************************************************************************************************************** 
215
// BEGIN PORT SECTION
216
 
217
//  Reset Interface
218
input   global_reset_n;         // Resets (active-low) the whole system (all PHY logic + PLL)
219
input   soft_reset_n;           // Resets (active-low) PHY logic only, PLL is NOT reset
220
input   pll_locked;                     // Indicates that PLL is locked
221
output  ctl_reset_n;            // Asynchronously asserted and synchronously de-asserted on ctl_clk domain
222
output  ctl_reset_export_n;             // Asynchronously asserted and synchronously de-asserted on ctl_clk domain
223
output  afi_reset_n;            // Asynchronously asserted and synchronously de-asserted on afi_clk domain
224
 
225
 
226
 
227
input   [OCT_SERIES_TERM_CONTROL_WIDTH-1:0]    oct_ctl_rs_value;
228
input   [OCT_PARALLEL_TERM_CONTROL_WIDTH-1:0]  oct_ctl_rt_value;
229
 
230
 
231
// PHY-Controller Interface, AFI 2.0
232
// Control Interface
233
input  [19:0]  afi_addr;
234
input   [2:0]  afi_ba;
235
input   [1:0]  afi_cke;
236
input   [1:0]  afi_cs_n;
237
input   [0:0]  afi_cas_n;
238
input   [1:0]  afi_odt;
239
input   [0:0]  afi_ras_n;
240
input   [0:0]  afi_we_n;
241
input   [0:0]  afi_rst_n;
242
input   [0:0]  afi_mem_clk_disable;
243
input   [4:0]  afi_dqs_burst;
244
output  [3:0]  afi_wlat;
245
output  [4:0]  afi_rlat;
246
 
247
// Write data interface
248
input  [79:0]  afi_wdata;              // write data
249
input   [4:0]  afi_wdata_valid;          // write data valid, used to maintain write latency required by protocol spec
250
input   [9:0]  afi_dm;             // write data mask
251
 
252
// Read data interface
253
output [79:0]  afi_rdata;              // read data                
254
input   [4:0]  afi_rdata_en;       // read enable, used to maintain the read latency calibrated by PHY
255
input   [4:0]  afi_rdata_en_full;  // read enable full burst, used to create DQS enable
256
output  [0:0]  afi_rdata_valid;    // read data valid
257
 
258
// Status interface
259
output                                afi_cal_success;    // calibration success
260
output                                afi_cal_fail;       // calibration failure
261
 
262
 
263
// Avalon interface to the sequencer
264
input   [15:0]  avl_address; //MarkW TODO: the sequencer only uses 13 bits
265
input           avl_read;
266
output  [31:0]  avl_readdata;
267
output          avl_waitrequest;
268
input           avl_write;
269
input   [31:0]  avl_writedata;
270
 
271
 
272
// Configuration interface to the memory controller
273
input    [7:0]  cfg_addlat;
274
input    [7:0]  cfg_bankaddrwidth;
275
input    [7:0]  cfg_caswrlat;
276
input    [7:0]  cfg_coladdrwidth;
277
input    [7:0]  cfg_csaddrwidth;
278
input    [7:0]  cfg_devicewidth;
279
input   [23:0]  cfg_dramconfig;
280
input    [7:0]  cfg_interfacewidth;
281
input    [7:0]  cfg_rowaddrwidth;
282
input    [7:0]  cfg_tcl;
283
input    [7:0]  cfg_tmrd;
284
input   [15:0]  cfg_trefi;
285
input    [7:0]  cfg_trfc;
286
input    [7:0]  cfg_twr;
287
 
288
 
289
//  IO/bypass interface to the core (or soft controller)
290
input   [63:0]  io_intaddrdout;
291
input   [11:0]  io_intbadout;
292
input    [3:0]  io_intcasndout;
293
input    [3:0]  io_intckdout;
294
input    [7:0]  io_intckedout;
295
input    [3:0]  io_intckndout;
296
input    [7:0]  io_intcsndout;
297
input   [19:0]  io_intdmdout;
298
output [179:0]  io_intdqdin;
299
input  [179:0]  io_intdqdout;
300
input   [89:0]  io_intdqoe;
301
input   [19:0]  io_intdqsbdout;
302
input    [9:0]  io_intdqsboe;
303
input   [19:0]  io_intdqsdout;
304
input    [9:0]  io_intdqslogicdqsena;
305
input    [4:0]  io_intdqslogicfiforeset;
306
input    [9:0]  io_intdqslogicincrdataen;
307
input    [9:0]  io_intdqslogicincwrptr;
308
input    [9:0]  io_intdqslogicoct;
309
output   [4:0]  io_intdqslogicrdatavalid;
310
input   [24:0]  io_intdqslogicreadlatency;
311
input    [9:0]  io_intdqsoe;
312
input    [7:0]  io_intodtdout;
313
input    [3:0]  io_intrasndout;
314
input    [3:0]  io_intresetndout;
315
input    [3:0]  io_intwendout;
316
output   [4:0]  io_intafirlat;
317
output   [3:0]  io_intafiwlat;
318
output          io_intaficalfail;
319
output          io_intaficalsuccess;
320
 
321
 
322
// PHY-Memory Interface
323
output  [MEM_ADDRESS_WIDTH-1:0]      mem_a;
324
output  [MEM_BANK_WIDTH-1:0]         mem_ba;
325
output  [MEM_IF_CS_WIDTH-1:0]  mem_cs_n;
326
output  [MEM_CLK_EN_WIDTH-1:0]       mem_cke;
327
output  [MEM_ODT_WIDTH-1:0]          mem_odt;
328
output  [MEM_CONTROL_WIDTH-1:0]      mem_we_n;
329
output  [MEM_CONTROL_WIDTH-1:0]      mem_ras_n;
330
output  [MEM_CONTROL_WIDTH-1:0]      mem_cas_n;
331
output                               mem_reset_n;
332
inout   [MEM_DQ_WIDTH-1:0]           mem_dq;
333
output  [MEM_DM_WIDTH-1:0]           mem_dm;
334
output  [MEM_CK_WIDTH-1:0]           mem_ck;
335
output  [MEM_CK_WIDTH-1:0]           mem_ck_n;
336
inout   [MEM_DQS_WIDTH-1:0]          mem_dqs;
337
inout   [MEM_DQS_WIDTH-1:0]          mem_dqs_n;
338
 
339
 
340
 
341
output  reset_n_scc_clk;
342
output  reset_n_avl_clk;
343
 
344
 
345
// Scan chain configuration manager interface
346
input                              scc_data;
347
input    [MEM_READ_DQS_WIDTH-1:0]  scc_dqs_ena;
348
input    [MEM_READ_DQS_WIDTH-1:0]  scc_dqs_io_ena;
349
input          [MEM_DQ_WIDTH-1:0]  scc_dq_ena;
350
input          [MEM_DM_WIDTH-1:0]  scc_dm_ena;
351
input                       [0:0]  scc_upd;
352
output   [MEM_READ_DQS_WIDTH-1:0]  capture_strobe_tracking;
353
 
354
 
355
output  phy_clk;
356
output  ctl_clk;
357
output  phy_reset_n;
358
 
359
 
360
// PLL Interface
361
input  pll_afi_clk;       // clocks AFI interface logic
362
input  pll_afi_half_clk;        // 
363
input  pll_addr_cmd_clk;  // clocks address/command DDIO
364
input  pll_mem_clk;       // output clock to memory
365
input  pll_write_clk;     // clocks write data DDIO
366
input   pll_write_clk_pre_phy_clk;
367
input  pll_dqs_ena_clk;
368
input  seq_clk;
369
input  pll_avl_clk;
370
input  pll_config_clk;
371
input pll_mem_phy_clk;
372
input pll_afi_phy_clk;
373
input pll_avl_phy_clk;
374
 
375
 
376
// DLL Interface
377
output  dll_clk;
378
output  dll_pll_locked;
379
input   [DLL_DELAY_CTRL_WIDTH-1:0]  dll_phy_delayctrl;   // dll output used to control the input DQS phase shift
380
 
381
 
382
 
383
// END PARAMETER SECTION
384
// ******************************************************************************************************************************** 
385
 
386
 
387
wire  [179:0]  ddio_phy_dqdin;
388
wire    [4:0]  ddio_phy_dqslogic_rdatavalid;
389
 
390
wire   [63:0]  phy_ddio_address;
391
wire   [11:0]  phy_ddio_bank;
392
wire    [3:0]  phy_ddio_cas_n;
393
wire    [3:0]  phy_ddio_ck;
394
wire    [7:0]  phy_ddio_cke;
395
wire    [3:0]  phy_ddio_ck_n;
396
wire    [7:0]  phy_ddio_cs_n;
397
wire   [19:0]  phy_ddio_dmdout;
398
wire  [179:0]  phy_ddio_dqdout;
399
wire   [89:0]  phy_ddio_dqoe;
400
wire    [9:0]  phy_ddio_dqsb_oe;
401
wire    [9:0]  phy_ddio_dqslogic_dqsena;
402
wire    [4:0]  phy_ddio_dqslogic_fiforeset;
403
wire    [4:0]  phy_ddio_dqslogic_aclr_pstamble;
404
wire    [4:0]  phy_ddio_dqslogic_aclr_fifoctrl;
405
wire    [9:0]  phy_ddio_dqslogic_incrdataen;
406
wire    [9:0]  phy_ddio_dqslogic_incwrptr;
407
wire    [9:0]  phy_ddio_dqslogic_oct;
408
wire   [24:0]  phy_ddio_dqslogic_readlatency;
409
wire    [9:0]  phy_ddio_dqs_oe;
410
wire    [19:0]  phy_ddio_dqs_dout;
411
wire    [7:0]  phy_ddio_odt;
412
wire    [3:0]  phy_ddio_ras_n;
413
wire    [3:0]  phy_ddio_reset_n;
414
wire    [3:0]  phy_ddio_we_n;
415
 
416
wire    read_capture_clk;
417
 
418
wire    [NUM_AFI_RESET-1:0] reset_n_afi_clk;
419
wire    reset_n_addr_cmd_clk;
420
wire    reset_n_seq_clk;
421
 
422
wire    reset_n_scc_clk;
423
wire    reset_n_avl_clk;
424
wire    reset_n_resync_clk;
425
 
426
localparam SKIP_CALIBRATION_STEPS = 7'b1111111;
427
 
428
localparam CALIBRATION_STEPS = SKIP_CALIBRATION_STEPS;
429
 
430
localparam SKIP_MEM_INIT = 1'b1;
431
 
432
localparam SEQ_CALIB_INIT = {CALIBRATION_STEPS, SKIP_MEM_INIT};
433
 
434
generate
435
if (IS_HHP_HPS != "true") begin
436
        reg [CALIB_REG_WIDTH-1:0] seq_calib_init_reg /* synthesis syn_noprune syn_preserve = 1 */;
437
 
438
        // Initialization of the sequencer status register. This register
439
        // is preserved in the netlist so that it can be forced during simulation
440
        always @(posedge pll_afi_clk)
441
                `ifdef SYNTH_FOR_SIM
442
                `else
443
                //synthesis translate_off
444
                `endif
445
                seq_calib_init_reg <= SEQ_CALIB_INIT;
446
                `ifdef SYNTH_FOR_SIM
447
                `else
448
                //synthesis translate_on
449
                //synthesis read_comments_as_HDL on
450
                `endif
451
                // seq_calib_init_reg <= {CALIB_REG_WIDTH{1'b0}};
452
                `ifdef SYNTH_FOR_SIM
453
                `else
454
                // synthesis read_comments_as_HDL off
455
                `endif
456
end
457
endgenerate
458
 
459
// ******************************************************************************************************************************** 
460
// The reset scheme used in the UNIPHY is asynchronous assert and synchronous de-assert
461
// The reset block has 2 main functionalities:
462
// 1. Keep all the PHY logic in reset state until after the PLL is locked
463
// 2. Synchronize the reset to each clock domain 
464
// ******************************************************************************************************************************** 
465
 
466
 
467
generate
468
if (IS_HHP_HPS != "true") begin
469
        hps_sdram_p0_reset      ureset(
470
                .pll_afi_clk                            (pll_afi_clk),
471
                .pll_addr_cmd_clk                       (pll_addr_cmd_clk),
472
                .pll_dqs_ena_clk                        (pll_dqs_ena_clk),
473
                .seq_clk                                        (seq_clk),
474
                .pll_avl_clk                            (pll_avl_clk),
475
                .scc_clk                                        (pll_config_clk),
476
                .reset_n_scc_clk                        (reset_n_scc_clk),
477
                .reset_n_avl_clk                        (reset_n_avl_clk),
478
                .read_capture_clk                       (read_capture_clk),
479
                .pll_locked                                     (pll_locked),
480
                .global_reset_n                         (global_reset_n),
481
                .soft_reset_n                           (soft_reset_n),
482
                .ctl_reset_export_n         (ctl_reset_export_n),
483
                .reset_n_afi_clk                        (reset_n_afi_clk),
484
                .reset_n_addr_cmd_clk           (reset_n_addr_cmd_clk),
485
                .reset_n_seq_clk                        (reset_n_seq_clk),
486
                .reset_n_resync_clk                     (reset_n_resync_clk)
487
        );
488
        defparam ureset.MEM_READ_DQS_WIDTH = MEM_READ_DQS_WIDTH;
489
        defparam ureset.NUM_AFI_RESET = NUM_AFI_RESET;
490
end else begin
491
        // synthesis translate_off
492
        hps_sdram_p0_reset      ureset(
493
                .pll_afi_clk                            (pll_afi_clk),
494
                .pll_addr_cmd_clk                       (pll_addr_cmd_clk),
495
                .pll_dqs_ena_clk                        (pll_dqs_ena_clk),
496
                .seq_clk                                        (seq_clk),
497
                .pll_avl_clk                            (pll_avl_clk),
498
                .scc_clk                                        (pll_config_clk),
499
                .reset_n_scc_clk                        (reset_n_scc_clk),
500
                .reset_n_avl_clk                        (reset_n_avl_clk),
501
                .read_capture_clk                       (read_capture_clk),
502
                .pll_locked                                     (pll_locked),
503
                .global_reset_n                         (global_reset_n),
504
                .soft_reset_n                           (soft_reset_n),
505
                .ctl_reset_export_n         (ctl_reset_export_n),
506
                .reset_n_afi_clk                        (reset_n_afi_clk),
507
                .reset_n_addr_cmd_clk           (reset_n_addr_cmd_clk),
508
                .reset_n_seq_clk                        (reset_n_seq_clk),
509
                .reset_n_resync_clk                     (reset_n_resync_clk)
510
        );
511
        defparam ureset.MEM_READ_DQS_WIDTH = MEM_READ_DQS_WIDTH;
512
        defparam ureset.NUM_AFI_RESET = NUM_AFI_RESET;
513
        // synthesis translate_on
514
        // synthesis read_comments_as_HDL on
515
        // assign reset_n_afi_clk = {NUM_AFI_RESET{global_reset_n}};
516
        // assign reset_n_addr_cmd_clk = global_reset_n;
517
        // assign reset_n_avl_clk = global_reset_n;
518
        // assign reset_n_scc_clk = global_reset_n;
519
        // synthesis read_comments_as_HDL off
520
end
521
endgenerate
522
 
523
 
524
 
525
 
526
 
527
assign phy_clk = seq_clk;
528
assign phy_reset_n = reset_n_seq_clk;
529
 
530
assign dll_clk = pll_write_clk_pre_phy_clk;
531
 
532
assign dll_pll_locked = pll_locked;
533
 
534
// PHY clock and LDC
535
wire afi_clk;
536
wire avl_clk;
537
wire adc_clk;
538
wire adc_clk_cps;
539
 
540
hps_sdram_p0_acv_ldc # (
541
        .DLL_DELAY_CTRL_WIDTH (DLL_DELAY_CTRL_WIDTH),
542
        .ADC_PHASE_SETTING (ADC_PHASE_SETTING),
543
        .ADC_INVERT_PHASE (ADC_INVERT_PHASE),
544
        .IS_HHP_HPS (IS_HHP_HPS)
545
) memphy_ldc (
546
        .pll_hr_clk (pll_avl_phy_clk),
547
        .pll_dq_clk (pll_write_clk),
548
        .pll_dqs_clk (pll_mem_phy_clk),
549
        .dll_phy_delayctrl (dll_phy_delayctrl),
550
        .afi_clk (afi_clk),
551
        .avl_clk (avl_clk),
552
        .adc_clk (adc_clk),
553
        .adc_clk_cps (adc_clk_cps)
554
);
555
 
556
assign ctl_clk = afi_clk;
557
assign afi_reset_n = reset_n_afi_clk;
558
 
559
// ******************************************************************************************************************************** 
560
// This is the hard PHY instance
561
// ******************************************************************************************************************************** 
562
 
563
 
564
        cyclonev_mem_phy hphy_inst (
565
                .pllaficlk                   (afi_clk),
566
                .pllavlclk                   (avl_clk),
567
                .plllocked                   (pll_locked),
568
                .plladdrcmdclk               (adc_clk),
569
                .globalresetn                (global_reset_n),
570
                .softresetn                  (soft_reset_n),
571
                .phyresetn                   (phy_reset_n),
572
                .ctlresetn                   (ctl_reset_n),
573
                .iointaddrdout               (io_intaddrdout),
574
                .iointbadout                 (io_intbadout),
575
                .iointcasndout               (io_intcasndout),
576
                .iointckdout                 (io_intckdout),
577
                .iointckedout                (io_intckedout),
578
                .iointckndout                (io_intckndout),
579
                .iointcsndout                (io_intcsndout),
580
                .iointdmdout                 (io_intdmdout),
581
                .iointdqdin                  (io_intdqdin),
582
                .iointdqdout                 (io_intdqdout),
583
                .iointdqoe                   (io_intdqoe),
584
                .iointdqsbdout               (io_intdqsbdout),
585
                .iointdqsboe                 (io_intdqsboe),
586
                .iointdqsdout                (io_intdqsdout),
587
                .iointdqslogicdqsena         (io_intdqslogicdqsena),
588
                .iointdqslogicfiforeset      (io_intdqslogicfiforeset),
589
                .iointdqslogicincrdataen     (io_intdqslogicincrdataen),
590
                .iointdqslogicincwrptr       (io_intdqslogicincwrptr),
591
                .iointdqslogicoct            (io_intdqslogicoct),
592
                .iointdqslogicrdatavalid     (io_intdqslogicrdatavalid),
593
                .iointdqslogicreadlatency    (io_intdqslogicreadlatency),
594
                .iointdqsoe                  (io_intdqsoe),
595
                .iointodtdout                (io_intodtdout),
596
                .iointrasndout               (io_intrasndout),
597
                .iointresetndout             (io_intresetndout),
598
                .iointwendout                (io_intwendout),
599
                .iointafirlat                (io_intafirlat),
600
                .iointafiwlat                (io_intafiwlat),
601
                .iointaficalfail             (io_intaficalfail),
602
                .iointaficalsuccess          (io_intaficalsuccess),
603
                .ddiophydqdin                (ddio_phy_dqdin),
604
                .ddiophydqslogicrdatavalid   (ddio_phy_dqslogic_rdatavalid),
605
                .phyddioaddrdout             (phy_ddio_address),
606
                .phyddiobadout               (phy_ddio_bank),
607
                .phyddiocasndout             (phy_ddio_cas_n),
608
                .phyddiockdout               (phy_ddio_ck),
609
                .phyddiockedout              (phy_ddio_cke),
610
                .phyddiockndout              (),
611
                .phyddiocsndout              (phy_ddio_cs_n),
612
                .phyddiodmdout               (phy_ddio_dmdout),
613
                .phyddiodqdout               (phy_ddio_dqdout),
614
                .phyddiodqoe                 (phy_ddio_dqoe),
615
                .phyddiodqsbdout             (),
616
                .phyddiodqsboe               (phy_ddio_dqsb_oe),
617
                .phyddiodqslogicdqsena       (phy_ddio_dqslogic_dqsena),
618
                .phyddiodqslogicfiforeset    (phy_ddio_dqslogic_fiforeset),
619
                .phyddiodqslogicaclrpstamble (phy_ddio_dqslogic_aclr_pstamble),
620
                .phyddiodqslogicaclrfifoctrl (phy_ddio_dqslogic_aclr_fifoctrl),
621
                .phyddiodqslogicincrdataen   (phy_ddio_dqslogic_incrdataen),
622
                .phyddiodqslogicincwrptr     (phy_ddio_dqslogic_incwrptr),
623
                .phyddiodqslogicoct          (phy_ddio_dqslogic_oct),
624
                .phyddiodqslogicreadlatency  (phy_ddio_dqslogic_readlatency),
625
                .phyddiodqsoe                (phy_ddio_dqs_oe),
626
                .phyddiodqsdout              (phy_ddio_dqs_dout),
627
                .phyddioodtdout              (phy_ddio_odt),
628
                .phyddiorasndout             (phy_ddio_ras_n),
629
                .phyddioresetndout           (phy_ddio_reset_n),
630
                .phyddiowendout              (phy_ddio_we_n),
631
                .afiaddr                     (afi_addr),
632
                .afiba                       (afi_ba),
633
                .aficalfail                  (afi_cal_fail),
634
                .aficalsuccess               (afi_cal_success),
635
                .aficasn                     (afi_cas_n),
636
                .aficke                      (afi_cke),
637
                .aficsn                      (afi_cs_n),
638
                .afidm                       (afi_dm),
639
                .afidqsburst                 (afi_dqs_burst),
640
                .afimemclkdisable            (afi_mem_clk_disable),
641
                .afiodt                      (afi_odt),
642
                .afirasn                     (afi_ras_n),
643
                .afirdata                    (afi_rdata),
644
                .afirdataen                  (afi_rdata_en),
645
                .afirdataenfull              (afi_rdata_en_full),
646
                .afirdatavalid               (afi_rdata_valid),
647
                .afirlat                     (afi_rlat),
648
                .afirstn                     (afi_rst_n),
649
                .afiwdata                    (afi_wdata),
650
                .afiwdatavalid               (afi_wdata_valid),
651
                .afiwen                      (afi_we_n),
652
                .afiwlat                     (afi_wlat),
653
                .avladdress                  (avl_address),
654
                .avlread                     (avl_read),
655
                .avlreaddata                 (avl_readdata),
656
                .avlresetn                   (reset_n_avl_clk),
657
                .avlwaitrequest              (avl_waitrequest),
658
                .avlwrite                    (avl_write),
659
                .avlwritedata                (avl_writedata),
660
                .cfgaddlat                   (cfg_addlat),
661
                .cfgbankaddrwidth            (cfg_bankaddrwidth),
662
                .cfgcaswrlat                 (cfg_caswrlat),
663
                .cfgcoladdrwidth             (cfg_coladdrwidth),
664
                .cfgcsaddrwidth              (cfg_csaddrwidth),
665
                .cfgdevicewidth              (cfg_devicewidth),
666
                .cfgdramconfig               (cfg_dramconfig),
667
                .cfginterfacewidth           (cfg_interfacewidth),
668
                .cfgrowaddrwidth             (cfg_rowaddrwidth),
669
                .cfgtcl                      (cfg_tcl),
670
                .cfgtmrd                     (cfg_tmrd),
671
                .cfgtrefi                    (cfg_trefi),
672
                .cfgtrfc                     (cfg_trfc),
673
                .cfgtwr                      (cfg_twr),
674
                .scanen                      ()
675
        );
676
        defparam hphy_inst.hphy_ac_ddr_disable = "true";
677
        defparam hphy_inst.hphy_datapath_delay = "one_cycle";
678
        defparam hphy_inst.hphy_datapath_ac_delay = "one_and_half_cycles";
679
        defparam hphy_inst.hphy_reset_delay_en = "false";
680
        defparam hphy_inst.m_hphy_ac_rom_init_file = AC_ROM_INIT_FILE_NAME;
681
        defparam hphy_inst.m_hphy_inst_rom_init_file = INST_ROM_INIT_FILE_NAME;
682
        defparam hphy_inst.hphy_wrap_back_en = "false";
683
        defparam hphy_inst.hphy_atpg_en = "false";
684
        defparam hphy_inst.hphy_use_hphy = "true";
685
        defparam hphy_inst.hphy_csr_pipelineglobalenable = "true";
686
        defparam hphy_inst.hphy_hhp_hps = IS_HHP_HPS;
687
 
688
 
689
// ******************************************************************************************************************************** 
690
// The I/O block is responsible for instantiating all the built-in I/O logic in the FPGA
691
// ******************************************************************************************************************************** 
692
 
693
 
694
        hps_sdram_p0_acv_hard_io_pads #(
695
                .DEVICE_FAMILY(DEVICE_FAMILY),
696
                .FAST_SIM_MODEL(FAST_SIM_MODEL),
697
                .OCT_SERIES_TERM_CONTROL_WIDTH(OCT_SERIES_TERM_CONTROL_WIDTH),
698
                .OCT_PARALLEL_TERM_CONTROL_WIDTH(OCT_PARALLEL_TERM_CONTROL_WIDTH),
699
                .MEM_ADDRESS_WIDTH(MEM_ADDRESS_WIDTH),
700
                .MEM_BANK_WIDTH(MEM_BANK_WIDTH),
701
                .MEM_CHIP_SELECT_WIDTH(MEM_IF_CS_WIDTH),
702
                .MEM_CLK_EN_WIDTH(MEM_CLK_EN_WIDTH),
703
                .MEM_CK_WIDTH(MEM_CK_WIDTH),
704
                .MEM_ODT_WIDTH(MEM_ODT_WIDTH),
705
                .MEM_DQS_WIDTH(MEM_DQS_WIDTH),
706
                .MEM_DM_WIDTH(MEM_DM_WIDTH),
707
                .MEM_CONTROL_WIDTH(MEM_CONTROL_WIDTH),
708
                .MEM_DQ_WIDTH(MEM_DQ_WIDTH),
709
                .MEM_READ_DQS_WIDTH(MEM_READ_DQS_WIDTH),
710
                .MEM_WRITE_DQS_WIDTH(MEM_WRITE_DQS_WIDTH),
711
                .DLL_DELAY_CTRL_WIDTH(DLL_DELAY_CTRL_WIDTH),
712
                .ADC_PHASE_SETTING(ADC_PHASE_SETTING),
713
                .ADC_INVERT_PHASE(ADC_INVERT_PHASE),
714
                .IS_HHP_HPS(IS_HHP_HPS)
715
        ) uio_pads (
716
                .reset_n_addr_cmd_clk              (reset_n_addr_cmd_clk),
717
                .reset_n_afi_clk                   (reset_n_afi_clk[1]),
718
                .oct_ctl_rs_value                  (oct_ctl_rs_value),
719
                .oct_ctl_rt_value                  (oct_ctl_rt_value),
720
                .phy_ddio_address                  (phy_ddio_address),
721
                .phy_ddio_bank                     (phy_ddio_bank),
722
                .phy_ddio_cs_n                     (phy_ddio_cs_n),
723
                .phy_ddio_cke                      (phy_ddio_cke),
724
                .phy_ddio_odt                      (phy_ddio_odt),
725
                .phy_ddio_we_n                     (phy_ddio_we_n),
726
                .phy_ddio_ras_n                    (phy_ddio_ras_n),
727
                .phy_ddio_cas_n                    (phy_ddio_cas_n),
728
                .phy_ddio_ck                       (phy_ddio_ck),
729
                .phy_ddio_reset_n                  (phy_ddio_reset_n),
730
                .phy_mem_address                   (mem_a),
731
                .phy_mem_bank                      (mem_ba),
732
                .phy_mem_cs_n                      (mem_cs_n),
733
                .phy_mem_cke                       (mem_cke),
734
                .phy_mem_odt                       (mem_odt),
735
                .phy_mem_we_n                      (mem_we_n),
736
                .phy_mem_ras_n                     (mem_ras_n),
737
                .phy_mem_cas_n                     (mem_cas_n),
738
                .phy_mem_reset_n                   (mem_reset_n),
739
                .pll_afi_clk                       (pll_afi_clk),
740
                .pll_mem_clk                       (pll_mem_clk),
741
                .pll_afi_phy_clk                   (pll_afi_phy_clk),
742
                .pll_avl_phy_clk                   (pll_avl_phy_clk),
743
                .pll_avl_clk                       (pll_avl_clk),
744
                .avl_clk                           (avl_clk),
745
                .pll_mem_phy_clk                   (pll_mem_phy_clk),
746
                .pll_write_clk                     (pll_write_clk),
747
                .pll_dqs_ena_clk                   (pll_dqs_ena_clk),
748
                .pll_addr_cmd_clk                  (adc_clk_cps),
749
                .phy_mem_dq                        (mem_dq),
750
                .phy_mem_dm                        (mem_dm),
751
                .phy_mem_ck                        (mem_ck),
752
                .phy_mem_ck_n                      (mem_ck_n),
753
                .mem_dqs                           (mem_dqs),
754
                .mem_dqs_n                         (mem_dqs_n),
755
                .dll_phy_delayctrl                 (dll_phy_delayctrl),
756
                .scc_clk                           (pll_config_clk),
757
                .scc_data                          (scc_data),
758
                .scc_dqs_ena                       (scc_dqs_ena),
759
                .scc_dqs_io_ena                    (scc_dqs_io_ena),
760
                .scc_dq_ena                        (scc_dq_ena),
761
                .scc_dm_ena                        (scc_dm_ena),
762
                .scc_upd                           (scc_upd[0]),
763
                .phy_ddio_dmdout                   (phy_ddio_dmdout),
764
                .phy_ddio_dqdout                   (phy_ddio_dqdout),
765
                .phy_ddio_dqs_oe                   (phy_ddio_dqs_oe),
766
                .phy_ddio_dqsdout                  (phy_ddio_dqs_dout),
767
                .phy_ddio_dqsb_oe                  (phy_ddio_dqsb_oe),
768
                .phy_ddio_dqslogic_oct             (phy_ddio_dqslogic_oct),
769
                .phy_ddio_dqslogic_fiforeset       (phy_ddio_dqslogic_fiforeset),
770
                .phy_ddio_dqslogic_aclr_pstamble   (phy_ddio_dqslogic_aclr_pstamble),
771
                .phy_ddio_dqslogic_aclr_fifoctrl   (phy_ddio_dqslogic_aclr_fifoctrl),
772
                .phy_ddio_dqslogic_incwrptr        (phy_ddio_dqslogic_incwrptr),
773
                .phy_ddio_dqslogic_readlatency     (phy_ddio_dqslogic_readlatency),
774
                .ddio_phy_dqslogic_rdatavalid      (ddio_phy_dqslogic_rdatavalid),
775
                .ddio_phy_dqdin                    (ddio_phy_dqdin),
776
                .phy_ddio_dqslogic_incrdataen      (phy_ddio_dqslogic_incrdataen),
777
                .phy_ddio_dqslogic_dqsena          (phy_ddio_dqslogic_dqsena),
778
                .phy_ddio_dqoe                     (phy_ddio_dqoe),
779
                .capture_strobe_tracking           (capture_strobe_tracking)
780
    );
781
 
782
 
783
 
784
generate
785
if (IS_HHP_HPS != "true") begin
786
        reg afi_clk_reg /* synthesis dont_merge syn_noprune syn_preserve = 1 */;
787
        always @(posedge pll_afi_clk)
788
                afi_clk_reg <= ~afi_clk_reg;
789
 
790
        reg afi_half_clk_reg /* synthesis dont_merge syn_noprune syn_preserve = 1 */;
791
        always @(posedge pll_afi_half_clk)
792
                afi_half_clk_reg <= ~afi_half_clk_reg;
793
 
794
        reg avl_clk_reg /* synthesis dont_merge syn_noprune syn_preserve = 1 */;
795
        always @(posedge pll_avl_clk)
796
                avl_clk_reg <= ~avl_clk_reg;
797
        reg config_clk_reg /* synthesis dont_merge syn_noprune syn_preserve = 1 */;
798
        always @(posedge pll_config_clk)
799
                config_clk_reg <= ~config_clk_reg;
800
end
801
endgenerate
802
 
803
 
804
 
805
 
806
// Calculate the ceiling of log_2 of the input value
807
function integer ceil_log2;
808
        input integer value;
809
        begin
810
                value = value - 1;
811
                for (ceil_log2 = 0; value > 0; ceil_log2 = ceil_log2 + 1)
812
                        value = value >> 1;
813
        end
814
endfunction
815
 
816
endmodule

powered by: WebSVN 2.1.0

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