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

Subversion Repositories sgmii

[/] [sgmii/] [trunk/] [sim/] [BFMs/] [SGMII_altera/] [triple_speed_ethernet-library/] [altera_tse_pcs_pma_gige.v] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 jefflieu
// -------------------------------------------------------------------------
2
// -------------------------------------------------------------------------
3
//
4
// Revision Control Information
5
//
6
// $RCSfile: altera_tse_pcs_pma_gige.v,v $
7
// $Source: /ipbu/cvs/sio/projects/TriSpeedEthernet/src/RTL/Top_level_modules/altera_tse_pcs_pma_gige.v,v $
8
//
9
// $Revision: #1 $
10 20 jefflieu
// $Date: 2012/06/21 $
11
// Check in by : $Author: swbranch $
12 9 jefflieu
// Author      : Arul Paniandi
13
//
14
// Project     : Triple Speed Ethernet
15
//
16
// Description : 
17
//
18
// Top level PCS + PMA module for Triple Speed Ethernet PCS + PMA
19
 
20
// 
21
// ALTERA Confidential and Proprietary
22
// Copyright 2006 (c) Altera Corporation
23
// All rights reserved
24
//
25
// -------------------------------------------------------------------------
26
// -------------------------------------------------------------------------
27
 
28
//Legal Notice: (C)2007 Altera Corporation. All rights reserved.  Your
29
//use of Altera Corporation's design tools, logic functions and other
30
//software and tools, and its AMPP partner logic functions, and any
31
//output files any of the foregoing (including device programming or
32
//simulation files), and any associated documentation or information are
33
//expressly subject to the terms and conditions of the Altera Program
34
//License Subscription Agreement or other applicable license agreement,
35
//including, without limitation, that your use is for the sole purpose
36
//of programming logic devices manufactured by Altera and sold by Altera
37
//or its authorized distributors.  Please refer to the applicable
38
//agreement for further details.
39
 
40
(*altera_attribute = {"-name SYNCHRONIZER_IDENTIFICATION OFF;SUPPRESS_DA_RULE_INTERNAL=\"R102,R105,D102,D101,D103\"" } *)
41
module altera_tse_pcs_pma_gige (
42
    // inputs:
43
    address,
44
    clk,
45
    gmii_tx_d,
46
    gmii_tx_en,
47
    gmii_tx_err,
48
    gxb_cal_blk_clk,
49
    gxb_pwrdn_in,
50
    mii_tx_d,
51
    mii_tx_en,
52
    mii_tx_err,
53
    read,
54
    reconfig_clk,
55
    reconfig_togxb,
56
    reconfig_busy,
57
    ref_clk,
58
    reset,
59
    reset_rx_clk,
60
    reset_tx_clk,
61
    rxp,
62
    write,
63
    writedata,
64
 
65
    // outputs:
66
    gmii_rx_d,
67
    gmii_rx_dv,
68
    gmii_rx_err,
69
    hd_ena,
70
    led_an,
71
    led_char_err,
72
    led_col,
73
    led_crs,
74
    led_disp_err,
75
    led_link,
76
    mii_col,
77
    mii_crs,
78
    mii_rx_d,
79
    mii_rx_dv,
80
    mii_rx_err,
81
    pcs_pwrdn_out,
82
    readdata,
83
    reconfig_fromgxb,
84
    rx_clk,
85
    set_10,
86
    set_100,
87
    set_1000,
88
    tx_clk,
89
        rx_clkena,
90
        tx_clkena,
91
    txp,
92
    rx_recovclkout,
93
    waitrequest
94
);
95
 
96
 
97
//  Parameters to configure the core for different variations
98
//  ---------------------------------------------------------
99
 
100
parameter PHY_IDENTIFIER        = 32'h 00000000; //  PHY Identifier 
101
parameter DEV_VERSION           = 16'h 0001 ;    //  Customer Phy's Core Version
102
parameter ENABLE_SGMII          = 1;             //  Enable SGMII logic for synthesis
103
parameter EXPORT_PWRDN          = 1'b0;          //  Option to export the Alt2gxb powerdown signal
104
parameter DEVICE_FAMILY         = "ARRIAGX";     //  The device family the the core is targetted for.
105
parameter TRANSCEIVER_OPTION    = 1'b0;          //  Option to select transceiver block for MAC PCS PMA Instantiation. 
106
                                                 //  Valid Values are 0 and 1:  0 - GXB (GIGE Mode) 1 - LVDS I/O.
107
parameter STARTING_CHANNEL_NUMBER = 0;           //  Starting Channel Number for Reconfig block
108
parameter ENABLE_ALT_RECONFIG   = 0;             //  Option to expose the alt_reconfig ports
109
parameter SYNCHRONIZER_DEPTH    = 3;             //  Number of synchronizer
110
 
111
  output  [7:0] gmii_rx_d;
112
  output  gmii_rx_dv;
113
  output  gmii_rx_err;
114
  output  hd_ena;
115
  output  led_an;
116
  output  led_char_err;
117
  output  led_col;
118
  output  led_crs;
119
  output  led_disp_err;
120
  output  led_link;
121
  output  mii_col;
122
  output  mii_crs;
123
  output  [3:0] mii_rx_d;
124
  output  mii_rx_dv;
125
  output  mii_rx_err;
126
  output  pcs_pwrdn_out;
127
  output  [15:0] readdata;
128
  output  [16:0] reconfig_fromgxb;
129
  output  rx_clk;
130
  output  set_10;
131
  output  set_100;
132
  output  set_1000;
133
  output  tx_clk;
134
  output  rx_clkena;
135
  output  tx_clkena;
136
  output  txp;
137
  output  rx_recovclkout;
138
  output  waitrequest;
139
 
140
  input   [4:0] address;
141
  input   clk;
142
  input   [7:0] gmii_tx_d;
143
  input   gmii_tx_en;
144
  input   gmii_tx_err;
145
  input   gxb_pwrdn_in;
146
  input   gxb_cal_blk_clk;
147
  input   [3:0] mii_tx_d;
148
  input   mii_tx_en;
149
  input   mii_tx_err;
150
  input   read;
151
  input   reconfig_clk;
152
  input   [3:0] reconfig_togxb;
153
  input   reconfig_busy;
154
  input   ref_clk;
155
  input   reset;
156
  input   reset_rx_clk;
157
  input   reset_tx_clk;
158
  input   rxp;
159
  input   write;
160
  input   [15:0] writedata;
161
 
162
 
163
  wire    PCS_rx_reset;
164
  wire    PCS_tx_reset;
165
  wire    PCS_reset;
166
  wire    gige_pma_reset;
167
  wire    [7:0] gmii_rx_d;
168
  wire    gmii_rx_dv;
169
  wire    gmii_rx_err;
170
  wire    hd_ena;
171
  wire    led_an;
172
  wire    led_char_err;
173
  wire    led_char_err_gx;
174
  wire    led_col;
175
  wire    led_crs;
176
  wire    led_disp_err;
177
  wire    led_link;
178
  wire    link_status;
179
  wire    mii_col;
180
  wire    mii_crs;
181
  wire    [3:0] mii_rx_d;
182
  wire    mii_rx_dv;
183
  wire    mii_rx_err;
184
  wire    rx_pcs_clk;
185
  wire    tx_pcs_clk;
186
  wire    [7:0] pcs_rx_frame;
187
  wire    pcs_rx_kchar;
188
 
189
  wire    [15:0] readdata;
190
  wire    rx_char_err_gx;
191
  wire    rx_clk;
192
  wire    rx_disp_err;
193
  wire    [7:0] rx_frame;
194
  wire    rx_syncstatus;
195
  wire    rx_kchar;
196
  wire    set_10;
197
  wire    set_100;
198
  wire    set_1000;
199
  wire    tx_clk;
200
  wire    rx_clkena;
201
  wire    tx_clkena;
202
  wire    [7:0] tx_frame;
203
  wire    tx_kchar;
204
  wire    txp;
205
  wire    waitrequest;
206
  wire    sd_loopback;
207
  wire    pcs_pwrdn_out_sig;
208
  wire    gxb_pwrdn_in_sig;
209
 
210
  wire   rx_runlengthviolation;
211
  wire   rx_patterndetect;
212
  wire   rx_runningdisp;
213
  wire   rx_rmfifodatadeleted;
214
  wire   rx_rmfifodatainserted;
215
  wire   pcs_rx_rmfifodatadeleted;
216
  wire   pcs_rx_rmfifodatainserted;
217
 
218
  wire   [16:0] reconfig_fromgxb;
219
  wire   reset_ref_clk;
220
  wire   reset_rx_pcs_clk_int;
221
  wire   pll_powerdown_sqcnr,tx_digitalreset_sqcnr,rx_analogreset_sqcnr,rx_digitalreset_sqcnr,gxb_powerdown_sqcnr,pll_locked;
222
  wire   rx_digitalreset_sqcnr_rx_clk,tx_digitalreset_sqcnr_tx_clk,rx_digitalreset_sqcnr_clk;
223
  wire   rx_freqlocked;
224
  wire  locked_signal;
225
//  Assign the digital reset of the PMA to the PCS logic
226
//  --------------------------------------------------------
227
altera_tse_reset_synchronizer reset_sync_2 (
228
        .clk(rx_clk),
229
        .reset_in(rx_digitalreset_sqcnr),
230
        .reset_out(rx_digitalreset_sqcnr_rx_clk)
231
        );
232
 
233
altera_tse_reset_synchronizer reset_sync_3 (
234
        .clk(tx_clk),
235
        .reset_in(tx_digitalreset_sqcnr),
236
        .reset_out(tx_digitalreset_sqcnr_tx_clk)
237
        );
238
 
239
altera_tse_reset_synchronizer reset_sync_4 (
240
        .clk(clk),
241
        .reset_in(rx_digitalreset_sqcnr),
242
        .reset_out(rx_digitalreset_sqcnr_clk)
243
        );
244
 
245
assign PCS_rx_reset = reset_rx_clk | rx_digitalreset_sqcnr_rx_clk;
246
assign PCS_tx_reset = reset_tx_clk | tx_digitalreset_sqcnr_tx_clk;
247
assign PCS_reset = reset;
248
 
249
//  Assign the character error and link status to top level leds
250
//  ------------------------------------------------------------
251
assign led_char_err = led_char_err_gx;
252
assign led_link = link_status;
253
 
254
 
255
 
256
// Instantiation of the PCS core that connects to a PMA
257
// --------------------------------------------------------
258
  altera_tse_top_1000_base_x_strx_gx altera_tse_top_1000_base_x_strx_gx_inst
259
    (
260
        .rx_carrierdetected(pcs_rx_carrierdetected),
261
        .rx_rmfifodatadeleted(pcs_rx_rmfifodatadeleted),
262
        .rx_rmfifodatainserted(pcs_rx_rmfifodatainserted),
263
        .gmii_rx_d (gmii_rx_d),
264
        .gmii_rx_dv (gmii_rx_dv),
265
        .gmii_rx_err (gmii_rx_err),
266
        .gmii_tx_d (gmii_tx_d),
267
        .gmii_tx_en (gmii_tx_en),
268
        .gmii_tx_err (gmii_tx_err),
269
        .hd_ena (hd_ena),
270
        .led_an (led_an),
271
        .led_char_err (led_char_err_gx),
272
        .led_col (led_col),
273
        .led_crs (led_crs),
274
        .led_link (link_status),
275
        .mii_col (mii_col),
276
        .mii_crs (mii_crs),
277
        .mii_rx_d (mii_rx_d),
278
        .mii_rx_dv (mii_rx_dv),
279
        .mii_rx_err (mii_rx_err),
280
        .mii_tx_d (mii_tx_d),
281
        .mii_tx_en (mii_tx_en),
282
        .mii_tx_err (mii_tx_err),
283
        .powerdown (pcs_pwrdn_out_sig),
284
        .reg_addr (address),
285
        .reg_busy (waitrequest),
286
        .reg_clk (clk),
287
        .reg_data_in (writedata),
288
        .reg_data_out (readdata),
289
        .reg_rd (read),
290
        .reg_wr (write),
291
        .reset_reg_clk (PCS_reset),
292
        .reset_rx_clk (PCS_rx_reset),
293
        .reset_tx_clk (PCS_tx_reset),
294
        .rx_clk (rx_clk),
295
        .rx_clkout (rx_pcs_clk),
296
        .rx_frame (pcs_rx_frame),
297
        .rx_kchar (pcs_rx_kchar),
298
        .sd_loopback (sd_loopback),
299
        .set_10 (set_10),
300
        .set_100 (set_100),
301
        .set_1000 (set_1000),
302
        .tx_clk (tx_clk),
303
                .rx_clkena(rx_clkena),
304
            .tx_clkena(tx_clkena),
305
                .ref_clk(1'b0),
306
        .tx_clkout (tx_pcs_clk),
307
        .tx_frame (tx_frame),
308
        .tx_kchar (tx_kchar)
309
 
310
    );
311
    defparam
312
        altera_tse_top_1000_base_x_strx_gx_inst.PHY_IDENTIFIER = PHY_IDENTIFIER,
313
        altera_tse_top_1000_base_x_strx_gx_inst.DEV_VERSION = DEV_VERSION,
314
        altera_tse_top_1000_base_x_strx_gx_inst.ENABLE_SGMII = ENABLE_SGMII;
315
 
316 20 jefflieu
 
317
// Based on PHYIP , when user assert reset - it hold the reset sequencer block in reset.
318
//                , reset sequencing only start then reset_sequnece end.
319
wire reset_sync;
320
reg  reset_start;
321
 
322
 altera_tse_reset_synchronizer reset_sync_u0 (
323
    .clk(clk),
324
    .reset_in(reset),
325
    .reset_out(reset_sync)
326
    );
327
 
328
always@(posedge clk or posedge reset_sync) begin
329
    if (reset_sync) begin
330
        reset_start <= 1'b1;
331 9 jefflieu
    end
332 20 jefflieu
    else begin
333
        reset_start <= 1'b0;
334
    end
335
end
336 9 jefflieu
 
337 20 jefflieu
 
338 9 jefflieu
// Export powerdown signal or wire it internally
339
// ---------------------------------------------
340
reg data_in_d1,gxb_pwrdn_in_sig_clk;
341
generate if (EXPORT_PWRDN == 1)
342
    begin
343
        always @(posedge clk or posedge gxb_pwrdn_in)
344
        begin
345
          if (gxb_pwrdn_in == 1) begin
346
              data_in_d1 <= 1;
347
              gxb_pwrdn_in_sig_clk <= 1;
348
          end else begin
349
            data_in_d1 <= 1'b0;
350
            gxb_pwrdn_in_sig_clk <= data_in_d1;
351
          end
352
        end
353
        assign gxb_pwrdn_in_sig = gxb_pwrdn_in;
354
        assign pcs_pwrdn_out = pcs_pwrdn_out_sig;
355
    end
356
else
357
    begin
358
        assign gxb_pwrdn_in_sig = pcs_pwrdn_out_sig;
359
                assign pcs_pwrdn_out = 1'b0;
360
        always@(*) begin
361
            gxb_pwrdn_in_sig_clk = gxb_pwrdn_in_sig;
362
        end
363
    end
364
endgenerate
365
 
366
// Reset logic used to reset the PMA blocks
367
// ----------------------------------------  
368
//  ALTGX Reset Sequencer
369
        altera_tse_reset_sequencer altera_tse_reset_sequencer_inst(
370
            // User inputs and outputs
371
            .clock(clk),
372 20 jefflieu
            .reset_all(reset_start | gxb_pwrdn_in_sig_clk),
373 9 jefflieu
            //.reset_tx_digital(reset_ref_clk),
374
            //.reset_rx_digital(reset_ref_clk),
375 20 jefflieu
            .powerdown_all(reset_sync),
376 9 jefflieu
            .tx_ready(), // output
377
            .rx_ready(), // output
378
            // I/O transceiver and status
379
            .pll_powerdown(pll_powerdown_sqcnr),// output
380
            .tx_digitalreset(tx_digitalreset_sqcnr),// output
381
            .rx_analogreset(rx_analogreset_sqcnr),// output
382
            .rx_digitalreset(rx_digitalreset_sqcnr),// output
383
            .gxb_powerdown(gxb_powerdown_sqcnr),// output
384
            .pll_is_locked(locked_signal),
385
            .rx_is_lockedtodata(rx_freqlocked),
386
            .manual_mode(1'b0),
387
            .rx_oc_busy(reconfig_busy)
388
        );
389
 
390
    assign locked_signal = (reset? 1'b0: pll_locked);
391
 
392
// Instantiation of the Alt2gxb block as the PMA for Stratix_II_GX and ArriaGX devices
393
// ----------------------------------------------------------------------------------- 
394
 
395
    altera_tse_reset_synchronizer ch_0_reset_sync_0 (
396
        .clk(rx_pcs_clk),
397
        .reset_in(rx_digitalreset_sqcnr),
398
        .reset_out(reset_rx_pcs_clk_int)
399
        );
400
 
401
    // Aligned Rx_sync from gxb
402
    // -------------------------------
403
    altera_tse_gxb_aligned_rxsync the_altera_tse_gxb_aligned_rxsync
404
      (
405
        .clk(rx_pcs_clk),
406
        .reset(reset_rx_pcs_clk_int),
407
        //input (from alt2gxb)
408
        .alt_dataout(rx_frame),
409
        .alt_sync(rx_syncstatus),
410
        .alt_disperr(rx_disp_err),
411
        .alt_ctrldetect(rx_kchar),
412
        .alt_errdetect(rx_char_err_gx),
413
        .alt_rmfifodatadeleted(rx_rmfifodatadeleted),
414
        .alt_rmfifodatainserted(rx_rmfifodatainserted),
415
        .alt_runlengthviolation(rx_runlengthviolation),
416
        .alt_patterndetect(rx_patterndetect),
417
        .alt_runningdisp(rx_runningdisp),
418
 
419
        //output (to PCS)
420
        .altpcs_dataout(pcs_rx_frame),
421
        .altpcs_sync(link_status),
422
        .altpcs_disperr(led_disp_err),
423
        .altpcs_ctrldetect(pcs_rx_kchar),
424
        .altpcs_errdetect(led_char_err_gx),
425
        .altpcs_rmfifodatadeleted(pcs_rx_rmfifodatadeleted),
426
        .altpcs_rmfifodatainserted(pcs_rx_rmfifodatainserted),
427
        .altpcs_carrierdetect(pcs_rx_carrierdetected)
428
 
429
       ) ;
430
       defparam
431
           the_altera_tse_gxb_aligned_rxsync.DEVICE_FAMILY = DEVICE_FAMILY;
432
 
433
 
434
 
435
    // Altgxb in GIGE mode
436
    // --------------------
437
    altera_tse_gxb_gige_inst the_altera_tse_gxb_gige_inst
438
      (
439
        .cal_blk_clk (gxb_cal_blk_clk),
440
        .gxb_powerdown (gxb_pwrdn_in_sig),
441
        .pll_inclk (ref_clk),
442
        .reconfig_clk(reconfig_clk),
443
        .reconfig_togxb(reconfig_togxb),
444
        .reconfig_fromgxb(reconfig_fromgxb),
445
        .rx_analogreset (rx_analogreset_sqcnr),
446
        .rx_cruclk (ref_clk),
447
        .rx_ctrldetect (rx_kchar),
448
        .rx_clkout (rx_pcs_clk),
449
        .rx_datain (rxp),
450
        .rx_dataout (rx_frame),
451
        .rx_digitalreset (rx_digitalreset_sqcnr_rx_clk),
452
        .rx_disperr (rx_disp_err),
453
        .rx_errdetect (rx_char_err_gx),
454
        .rx_patterndetect (rx_patterndetect),
455
        .rx_rlv (rx_runlengthviolation),
456
        .rx_seriallpbken (sd_loopback),
457
        .rx_syncstatus (rx_syncstatus),
458
        .rx_recovclkout(rx_recovclkout),
459
        .tx_clkout (tx_pcs_clk),
460
        .tx_ctrlenable (tx_kchar),
461
        .tx_datain (tx_frame),
462
        .rx_freqlocked (rx_freqlocked),
463
        .tx_dataout (txp),
464
        .tx_digitalreset (tx_digitalreset_sqcnr_tx_clk),
465
        .rx_rmfifodatadeleted(rx_rmfifodatadeleted),
466
        .rx_rmfifodatainserted(rx_rmfifodatainserted),
467
        .rx_runningdisp(rx_runningdisp),
468
        .pll_powerdown(gxb_pwrdn_in_sig),
469
        .pll_locked(pll_locked)
470
 
471
      );
472
      defparam
473
          the_altera_tse_gxb_gige_inst.ENABLE_ALT_RECONFIG = ENABLE_ALT_RECONFIG,
474
          the_altera_tse_gxb_gige_inst.STARTING_CHANNEL_NUMBER = STARTING_CHANNEL_NUMBER,
475
          the_altera_tse_gxb_gige_inst.DEVICE_FAMILY = DEVICE_FAMILY,
476
          the_altera_tse_gxb_gige_inst.ENABLE_SGMII = ENABLE_SGMII;
477
 
478
 
479
 
480
 
481
endmodule
482
 

powered by: WebSVN 2.1.0

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