| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: xpcs_tx_randomizer.v |
| 4 | // Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved |
| 5 | // 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
| 6 | // |
| 7 | // * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 8 | // |
| 9 | // This program is free software; you can redistribute it and/or modify |
| 10 | // it under the terms of the GNU General Public License as published by |
| 11 | // the Free Software Foundation; version 2 of the License. |
| 12 | // |
| 13 | // This program is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | // GNU General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU General Public License |
| 19 | // along with this program; if not, write to the Free Software |
| 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | // |
| 22 | // For the avoidance of doubt, and except that if any non-GPL license |
| 23 | // choice is available it will apply instead, Sun elects to use only |
| 24 | // the General Public License version 2 (GPLv2) at this time for any |
| 25 | // software where a choice of GPL license versions is made |
| 26 | // available with the language indicating that GPLv2 or any later version |
| 27 | // may be used, or where a choice of which version of the GPL is applied is |
| 28 | // otherwise unspecified. |
| 29 | // |
| 30 | // Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 31 | // CA 95054 USA or visit www.sun.com if you need additional information or |
| 32 | // have any questions. |
| 33 | // |
| 34 | // ========== Copyright Header End ============================================ |
| 35 | /**********************************************************************/ |
| 36 | /* Project Name : Vega */ |
| 37 | /* Module Name : xpcs_tx_randomizer */ |
| 38 | /* Description : Randomizer to generate the flag for random idle */ |
| 39 | /* generation and timer for align pattern generation.*/ |
| 40 | /* Randomizer and timer are compliant per Clause 48 */ |
| 41 | /* of IEEE802.3ae (see fig. 48-5 PCS Idle Randomizer */ |
| 42 | /* */ |
| 43 | /* Polynomial 1 + x^3 + x^7 */ |
| 44 | /* */ |
| 45 | /* Assumptions : none. */ |
| 46 | /* */ |
| 47 | /* Parent module : xpcs_tx_randomizer.v */ |
| 48 | /* Child modules : none. */ |
| 49 | /* Author Name : Carlos Castil */ |
| 50 | /* Date Created : 11/10/02 */ |
| 51 | /* */ |
| 52 | /* Copyright (c) 2002, Sun Microsystems, Inc. */ |
| 53 | /* Sun Proprietary and Confidential */ |
| 54 | /* */ |
| 55 | /* Modifications : */ |
| 56 | /**********************************************************************/ |
| 57 | |
| 58 | module xpcs_tx_randomizer (tx_clk, |
| 59 | reset, |
| 60 | align_count_exp, |
| 61 | clr_align_count, |
| 62 | code_sel); |
| 63 | |
| 64 | input tx_clk; // 156 MHz clock |
| 65 | input reset; |
| 66 | |
| 67 | input clr_align_count; // Align transmitted |
| 68 | |
| 69 | output align_count_exp;// High at the end of the loadable timer. |
| 70 | // Will go low after ||A|| is trasmitted. |
| 71 | |
| 72 | output code_sel; // 0: LSB of randomizer = 0 for even |
| 73 | // 1: LSB of randomizer = 1 for odd |
| 74 | |
| 75 | |
| 76 | reg [6:0] pat; // pseudo random pattern generated by LFSR |
| 77 | reg [4:0] align_count; // Align counter |
| 78 | |
| 79 | wire feedback; // feedback loop to input of LFSR |
| 80 | wire [6:0] del_pat; // delay for hold time for lfsr |
| 81 | |
| 82 | |
| 83 | assign feedback = pat[0]; |
| 84 | assign code_sel = pat[0]; |
| 85 | |
| 86 | assign align_count_exp = (align_count == 5'b00000); |
| 87 | |
| 88 | |
| 89 | /* |
| 90 | ** Primitive polynomial 1 + x^3 + x^7 |
| 91 | */ |
| 92 | always @(posedge tx_clk) |
| 93 | if |
| 94 | (reset) pat <= 7'h1; |
| 95 | else |
| 96 | begin |
| 97 | pat[0] <= del_pat[0]; |
| 98 | pat[1] <= del_pat[1]; |
| 99 | pat[2] <= del_pat[2]; |
| 100 | pat[3] <= del_pat[3]; |
| 101 | pat[4] <= del_pat[4]; |
| 102 | pat[5] <= del_pat[5]; |
| 103 | pat[6] <= del_pat[6]; |
| 104 | end |
| 105 | |
| 106 | /* |
| 107 | ** Delay For hold time requirement |
| 108 | */ |
| 109 | xpcs_tx_del delay_pattern ( |
| 110 | .Z(del_pat), |
| 111 | .A({feedback, // x^7 |
| 112 | pat[6], |
| 113 | pat[5], |
| 114 | pat[4] ^ feedback, // x^3 |
| 115 | pat[3], |
| 116 | pat[2], |
| 117 | pat[1]}) ); |
| 118 | |
| 119 | /* |
| 120 | ** Align counter |
| 121 | */ |
| 122 | |
| 123 | always @ (posedge tx_clk) |
| 124 | if (reset) |
| 125 | align_count <= 5'b10000; |
| 126 | else if (clr_align_count) |
| 127 | align_count <= {1'b1,pat[3:0]}; |
| 128 | else if (align_count == 5'b00000) |
| 129 | align_count <= align_count; |
| 130 | else |
| 131 | align_count <= align_count - 5'b00001; |
| 132 | |
| 133 | |
| 134 | |
| 135 | endmodule |
| 136 | |
| 137 | |