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.v] - Blame information for rev 9

Go to most recent revision | 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.v,v $
7
// $Source: /ipbu/cvs/sio/projects/TriSpeedEthernet/src/RTL/Top_level_modules/altera_tse_pcs_pma.v,v $
8
//
9
// $Revision: #1 $
10
// $Date: 2011/11/10 $
11
// Check in by : $Author: max $
12
// 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" } *)
41
module altera_tse_pcs_pma /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=\"R102,R105,D102,D101,D103\"" */(
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
    ref_clk,
55
    reset,
56
    reset_rx_clk,
57
    reset_tx_clk,
58
    rxp,
59
    write,
60
    writedata,
61
 
62
    // outputs:
63
    gmii_rx_d,
64
    gmii_rx_dv,
65
    gmii_rx_err,
66
    hd_ena,
67
    led_an,
68
    led_char_err,
69
    led_col,
70
    led_crs,
71
    led_disp_err,
72
    led_link,
73
    mii_col,
74
    mii_crs,
75
    mii_rx_d,
76
    mii_rx_dv,
77
    mii_rx_err,
78
    pcs_pwrdn_out,
79
    readdata,
80
    rx_clk,
81
        rx_clkena,
82
        tx_clkena,
83
    set_10,
84
    set_100,
85
    set_1000,
86
    tx_clk,
87
    txp,
88
    rx_recovclkout,
89
    waitrequest
90
);
91
 
92
 
93
//  Parameters to configure the core for different variations
94
//  ---------------------------------------------------------
95
 
96
parameter PHY_IDENTIFIER        = 32'h 00000000; //  PHY Identifier 
97
parameter DEV_VERSION           = 16'h 0001 ;    //  Customer Phy's Core Version
98
parameter ENABLE_SGMII          = 1;             //  Enable SGMII logic for synthesis
99
parameter EXPORT_PWRDN          = 1'b0;          //  Option to export the Alt2gxb powerdown signal
100
parameter DEVICE_FAMILY         = "ARRIAGX";     //  The device family the the core is targetted for.
101
parameter TRANSCEIVER_OPTION    = 1'b1;          //  Option to select transceiver block for MAC PCS PMA Instantiation. Valid Values are 0 and 1:  0 - GXB (GIGE Mode) 1 - LVDS I/O
102
parameter ENABLE_ALT_RECONFIG   = 0;             //  Option to have the Alt_Reconfig ports exposed
103
parameter SYNCHRONIZER_DEPTH    = 3;             //  Number of synchronizer
104
 
105
  output  [7:0] gmii_rx_d;
106
  output  gmii_rx_dv;
107
  output  gmii_rx_err;
108
  output  hd_ena;
109
  output  led_an;
110
  output  led_char_err;
111
  output  led_col;
112
  output  led_crs;
113
  output  led_disp_err;
114
  output  led_link;
115
  output  mii_col;
116
  output  mii_crs;
117
  output  [3:0] mii_rx_d;
118
  output  mii_rx_dv;
119
  output  mii_rx_err;
120
  output  pcs_pwrdn_out;
121
  output  [15:0] readdata;
122
  output  rx_clk;
123
  output  set_10;
124
  output  set_100;
125
  output  set_1000;
126
  output  tx_clk;
127
  output  rx_clkena;
128
  output  tx_clkena;
129
  output  txp;
130
  output  rx_recovclkout;
131
  output  waitrequest;
132
 
133
  input   [4:0] address;
134
  input   clk;
135
  input   [7:0] gmii_tx_d;
136
  input   gmii_tx_en;
137
  input   gmii_tx_err;
138
  input   gxb_pwrdn_in;
139
  input   gxb_cal_blk_clk;
140
  input   [3:0] mii_tx_d;
141
  input   mii_tx_en;
142
  input   mii_tx_err;
143
  input   read;
144
  input   ref_clk;
145
  input   reset;
146
  input   reset_rx_clk;
147
  input   reset_tx_clk;
148
  input   rxp;
149
  input   write;
150
  input   [15:0] writedata;
151
 
152
 
153
  wire    PCS_rx_reset;
154
  wire    PCS_tx_reset;
155
  wire    PCS_reset;
156
  wire    [7:0] gmii_rx_d;
157
  wire    gmii_rx_dv;
158
  wire    gmii_rx_err;
159
  wire    hd_ena;
160
  wire    led_an;
161
  wire    led_char_err;
162
  wire    led_col;
163
  wire    led_crs;
164
  wire    led_disp_err;
165
  wire    led_link;
166
  wire    mii_col;
167
  wire    mii_crs;
168
  wire    [3:0] mii_rx_d;
169
  wire    mii_rx_dv;
170
  wire    mii_rx_err;
171
 
172
  wire    [15:0] readdata;
173
  wire    rx_clk;
174
  wire    set_10;
175
  wire    set_100;
176
  wire    set_1000;
177
  wire    tbi_rx_clk;
178
  wire    [9:0] tbi_rx_d;
179
  wire    [9:0] tbi_tx_d;
180
  wire    tx_clk;
181
  wire    rx_clkena;
182
  wire    tx_clkena;
183
  wire    txp;
184
  wire    waitrequest;
185
  wire    sd_loopback;
186
  wire    pcs_pwrdn_out_sig;
187
  wire    gxb_pwrdn_in_sig;
188
  wire    [9:0] tbi_rx_d_lvds;
189
 
190
  reg     [9:0] tbi_rx_d_flip;
191
  reg     [9:0] tbi_tx_d_flip;
192
 
193
  wire    pll_areset,rx_cda_reset,rx_channel_data_align,rx_locked;
194
  wire    reset_pma_tx_clk,reset_pma_rx_clk,rx_reset;
195
// Export receive recovered clock
196
assign rx_recovclkout = tbi_rx_clk;
197
 
198
// Reset logic used to reset the PMA blocks
199
// ----------------------------------------
200
 
201
 
202
//  Assign the digital reset of the PMA to the PCS logic
203
//  --------------------------------------------------------
204
 
205
altera_tse_reset_synchronizer reset_sync_tx (
206
        .clk(tx_clk),
207
        .reset_in(rx_reset),
208
        .reset_out(reset_pma_tx_clk)
209
        );
210
 
211
altera_tse_reset_synchronizer reset_sync_rx (
212
        .clk(rx_clk),
213
        .reset_in(rx_reset),
214
        .reset_out(reset_pma_rx_clk)
215
        );
216
 
217
assign PCS_rx_reset = reset_rx_clk | reset_pma_rx_clk;
218
assign PCS_tx_reset = reset_tx_clk | reset_pma_tx_clk;
219
assign PCS_reset = reset | rx_reset;
220
 
221
 
222
 
223
 
224
// Instantiation of the PCS core that connects to a PMA
225
// --------------------------------------------------------
226
  altera_tse_top_1000_base_x altera_tse_top_1000_base_x_inst
227
    (
228
        .gmii_rx_d (gmii_rx_d),
229
        .gmii_rx_dv (gmii_rx_dv),
230
        .gmii_rx_err (gmii_rx_err),
231
        .gmii_tx_d (gmii_tx_d),
232
        .gmii_tx_en (gmii_tx_en),
233
        .gmii_tx_err (gmii_tx_err),
234
        .hd_ena (hd_ena),
235
        .led_an (led_an),
236
        .led_char_err (led_char_err),
237
        .led_col (led_col),
238
        .led_crs (led_crs),
239
        .led_disp_err (led_disp_err),
240
        .led_link (led_link),
241
        .mii_col (mii_col),
242
        .mii_crs (mii_crs),
243
        .mii_rx_d (mii_rx_d),
244
        .mii_rx_dv (mii_rx_dv),
245
        .mii_rx_err (mii_rx_err),
246
        .mii_tx_d (mii_tx_d),
247
        .mii_tx_en (mii_tx_en),
248
        .mii_tx_err (mii_tx_err),
249
        .reg_addr (address),
250
        .reg_busy (waitrequest),
251
        .reg_clk (clk),
252
        .reg_data_in (writedata),
253
        .reg_data_out (readdata),
254
        .reg_rd (read),
255
        .reg_wr (write),
256
        .reset_reg_clk (PCS_reset),
257
        .reset_rx_clk (PCS_rx_reset),
258
        .reset_tx_clk (PCS_tx_reset),
259
        .rx_clk (rx_clk),
260
                .rx_clkena(rx_clkena),
261
                .tx_clkena(tx_clkena),
262
                .ref_clk(1'b0),
263
        .set_10 (set_10),
264
        .set_100 (set_100),
265
        .set_1000 (set_1000),
266
        .sd_loopback(sd_loopback),
267
        .powerdown(pcs_pwrdn_out_sig),
268
        .tbi_rx_clk (tbi_rx_clk),
269
        .tbi_rx_d (tbi_rx_d),
270
        .tbi_tx_clk (tbi_tx_clk),
271
        .tbi_tx_d (tbi_tx_d),
272
        .tx_clk (tx_clk)
273
    );
274
 
275
    defparam
276
        altera_tse_top_1000_base_x_inst.PHY_IDENTIFIER = PHY_IDENTIFIER,
277
        altera_tse_top_1000_base_x_inst.DEV_VERSION = DEV_VERSION,
278
        altera_tse_top_1000_base_x_inst.ENABLE_SGMII = ENABLE_SGMII;
279
 
280
 
281
 
282
// Export powerdown signal or wire it internally
283
// ---------------------------------------------
284
generate if (EXPORT_PWRDN == 1)
285
    begin
286
        assign gxb_pwrdn_in_sig = gxb_pwrdn_in;
287
        assign pcs_pwrdn_out = pcs_pwrdn_out_sig;
288
    end
289
else
290
    begin
291
        assign gxb_pwrdn_in_sig = pcs_pwrdn_out_sig;
292
                assign pcs_pwrdn_out = 1'b0;
293
    end
294
endgenerate
295
 
296
 
297
 
298
// Either one of these blocks below will be instantiated depending on the parameterization 
299
// that is chosen.
300
// ---------------------------------------------------------------------------------------
301
 
302
// Instantiation of the Alt2gxb block as the PMA for Stratix II GX devices
303
// ----------------------------------------------------------------------- 
304
// Instantiation of the Alt2gxb block as the PMA for ArriaGX device
305
// ---------------------------------------------------------------- 
306
 
307
 
308
 
309
// Instantiation of the LVDS SERDES block as the PMA for Stratix III devices
310
//
311
// IEEE 802.3 Clause 36 PCS requires that bit 0 of TBI_DATA to be transmitted 
312
// first.  However, ALTLVDS had bit 9 transmit first.  hence, we need a bit
313
// reversal algorithm.  
314
// -------------------------------------------------------------------------
315
 
316
generate if (DEVICE_FAMILY != "ARRIAGX" && TRANSCEIVER_OPTION == 1)
317
    begin
318
 
319
    assign tbi_tx_clk = ref_clk;
320
    assign tbi_rx_d = tbi_rx_d_flip;
321
 
322
    // Reset Synchronizer
323
    altera_tse_reset_synchronizer reset_sync_0 (
324
        .clk(ref_clk),
325
        .reset_in(reset),
326
        .reset_out(reset_ref_clk_int)
327
        );
328
 
329
    altera_tse_reset_synchronizer reset_sync_1 (
330
        .clk(tbi_rx_clk),
331
        .reset_in(reset),
332
        .reset_out(reset_tbi_rx_clk_int)
333
        );
334
 
335
    always @(posedge tbi_rx_clk or posedge reset_tbi_rx_clk_int)
336
        begin
337
        if (reset_tbi_rx_clk_int == 1)
338
            tbi_rx_d_flip <= 0;
339
        else
340
            begin
341
            tbi_rx_d_flip[0] <= tbi_rx_d_lvds[9];
342
            tbi_rx_d_flip[1] <= tbi_rx_d_lvds[8];
343
            tbi_rx_d_flip[2] <= tbi_rx_d_lvds[7];
344
            tbi_rx_d_flip[3] <= tbi_rx_d_lvds[6];
345
            tbi_rx_d_flip[4] <= tbi_rx_d_lvds[5];
346
            tbi_rx_d_flip[5] <= tbi_rx_d_lvds[4];
347
            tbi_rx_d_flip[6] <= tbi_rx_d_lvds[3];
348
            tbi_rx_d_flip[7] <= tbi_rx_d_lvds[2];
349
            tbi_rx_d_flip[8] <= tbi_rx_d_lvds[1];
350
            tbi_rx_d_flip[9] <= tbi_rx_d_lvds[0];
351
            end
352
        end
353
 
354
    always @(posedge ref_clk or posedge reset_ref_clk_int)
355
        begin
356
        if (reset_ref_clk_int == 1)
357
            tbi_tx_d_flip <= 0;
358
        else
359
            begin
360
            tbi_tx_d_flip[0] <= tbi_tx_d[9];
361
            tbi_tx_d_flip[1] <= tbi_tx_d[8];
362
            tbi_tx_d_flip[2] <= tbi_tx_d[7];
363
            tbi_tx_d_flip[3] <= tbi_tx_d[6];
364
            tbi_tx_d_flip[4] <= tbi_tx_d[5];
365
            tbi_tx_d_flip[5] <= tbi_tx_d[4];
366
            tbi_tx_d_flip[6] <= tbi_tx_d[3];
367
            tbi_tx_d_flip[7] <= tbi_tx_d[2];
368
            tbi_tx_d_flip[8] <= tbi_tx_d[1];
369
            tbi_tx_d_flip[9] <= tbi_tx_d[0];
370
            end
371
        end
372
 
373
    altera_tse_pma_lvds_rx the_altera_tse_pma_lvds_rx
374
     (
375
         .pll_areset ( reset ),
376
         .rx_cda_reset ( rx_cda_reset ),
377
         .rx_channel_data_align ( rx_channel_data_align ),
378
         .rx_locked ( rx_locked ),
379
         .rx_divfwdclk (tbi_rx_clk),
380
         .rx_in (rxp),
381
         .rx_inclock (ref_clk),
382
         .rx_out (tbi_rx_d_lvds),
383
         .rx_outclock (),
384
         .rx_reset (rx_reset)
385
     );
386
 
387
    altera_tse_lvds_reset_sequencer the_altera_tse_lvds_reset_sequencer (
388
                .clk ( clk ),
389
                .reset ( reset ),
390
                .rx_locked ( rx_locked ),
391
                .rx_channel_data_align ( rx_channel_data_align ),
392
                .pll_areset ( pll_areset ),
393
                .rx_reset ( rx_reset ),
394
                .rx_cda_reset ( rx_cda_reset )
395
        );
396
 
397
 
398
    altera_tse_pma_lvds_tx the_altera_tse_pma_lvds_tx
399
    (
400
        .tx_in (tbi_tx_d_flip),
401
                .pll_areset ( reset ),
402
        .tx_inclock (ref_clk),
403
        .tx_out (txp)
404
    );
405
 
406
    end
407
endgenerate
408
 
409
endmodule
410
 

powered by: WebSVN 2.1.0

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