Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: polling_state_fsm.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 | `ifdef AXIS_FBDIMM_NO_FSR | |
36 | `else | |
37 | module polling_state_fsm(ps_bit,link_clk,amb_id,polling_state_start,polling_state_end,amb_id_ok); | |
38 | ||
39 | ||
40 | parameter DS=0; | |
41 | ||
42 | input ps_bit; | |
43 | input link_clk; | |
44 | output [3:0] amb_id; | |
45 | input polling_state_start; | |
46 | output polling_state_end; | |
47 | output amb_id_ok; | |
48 | ||
49 | reg [2:0] SB2NB_Map; | |
50 | reg [11:0] tr_reg; | |
51 | reg [4:0] tr_state; | |
52 | reg [4:0] tr_count; | |
53 | reg [11:0] clk_trn_ptrn; | |
54 | reg [3:0] clk_grp; | |
55 | reg ts2_ready_reg; | |
56 | reg [3:0] amb_id_reg; | |
57 | reg [23:0] test_param_reg; | |
58 | reg [7:8] test_param_count; | |
59 | reg polling_state_start_reg,polling_state_end_reg; | |
60 | assign amb_id=amb_id_reg; | |
61 | reg [35:0] end_del_reg; | |
62 | reg first_frame_enddelimeter_ok; | |
63 | ||
64 | assign amb_id_ok = ( amb_id_reg == DS ) ? 1'b1 : 1'b0; | |
65 | ||
66 | initial begin | |
67 | tr_state=0; | |
68 | tr_count=5'h0; | |
69 | amb_id_reg=0; | |
70 | test_param_count=0; | |
71 | first_frame_enddelimeter_ok=0; | |
72 | end | |
73 | ||
74 | assign polling_state_end=polling_state_end_reg; | |
75 | ||
76 | always@(negedge link_clk) if ( polling_state_start ) | |
77 | begin | |
78 | case(tr_state) | |
79 | `IDLE: begin | |
80 | ||
81 | end_del_reg[35:0] <= 36'h0; | |
82 | ts2_ready_reg=0; | |
83 | tr_reg[11:0] <= {ps_bit, tr_reg[11:1] }; | |
84 | ||
85 | if (( {ps_bit, tr_reg[11:1]} == 12'b001111111110 ) & | |
86 | first_frame_enddelimeter_ok ) | |
87 | polling_state_end_reg<=1; | |
88 | else | |
89 | polling_state_end_reg<=0; | |
90 | ||
91 | ||
92 | if ( {ps_bit, tr_reg[11:1]} == 12'b011111111110 ) begin | |
93 | tr_state<=`TS_TEST_1; | |
94 | `ifdef FBD_DBG | |
95 | `PR_ALWAYS ("amb_init",`DBG_0,"AMB Detected POLLING"); | |
96 | `endif | |
97 | end | |
98 | ||
99 | end | |
100 | `TS_TEST_1: begin | |
101 | case(tr_count) | |
102 | 4'b0000: begin tr_reg[0] <= ps_bit; tr_count=tr_count+5'h1; end | |
103 | 4'b0001: begin tr_reg[1] <= ps_bit; tr_count=tr_count+5'h1; end | |
104 | 4'b0010: begin tr_reg[2] <= ps_bit; tr_count=tr_count+5'h1;end | |
105 | 4'b0011: begin tr_reg[3] <= ps_bit; tr_count=tr_count+5'h1; end | |
106 | 4'b0100: begin tr_reg[4] <= ps_bit; tr_count=tr_count+5'h1; end | |
107 | 4'b0101: begin tr_reg[5] <= ps_bit; tr_count=tr_count+5'h1; end | |
108 | 4'b0110: begin tr_reg[6] <= ps_bit; tr_count=tr_count+5'h1; end | |
109 | 4'b0111: begin tr_reg[7] <= ps_bit; tr_count=tr_count+5'h1; end | |
110 | 4'b1000: begin tr_reg[8] <= ps_bit; tr_count=tr_count+5'h1; end | |
111 | 4'b1001: begin tr_reg[9] <= ps_bit; tr_count=tr_count+5'h1; end | |
112 | 4'b1010: begin tr_reg[10] <= ps_bit; tr_count=tr_count+5'h1; end | |
113 | 4'b1011: begin tr_reg[11] <= ps_bit; tr_state<=`TS_TEST_2; | |
114 | tr_count=1;clk_grp=0; amb_id_reg[3:0]=tr_reg[3:0];SB2NB_Map=tr_reg[6:4]; | |
115 | `ifdef FBD_DBG | |
116 | `PR_ALWAYS ("amb_init",`DBG_4,"POLLING Control values: ambid=%h sb2nbmap %h",tr_reg[3:0],tr_reg[6:4]); | |
117 | `endif | |
118 | end | |
119 | endcase | |
120 | end | |
121 | ||
122 | `TS_TEST_2: begin | |
123 | end_del_reg[35:0] <= { ps_bit, end_del_reg[35:1]}; | |
124 | if ( {ps_bit, end_del_reg[35:1]} == {12'b101010101010,12'b101010101010,12'b101010101010} ) | |
125 | begin | |
126 | `ifdef FBD_DBG | |
127 | `PR_ALWAYS ("amb_init",`DBG_0,"AMB_INIT polling sequence end detected"); | |
128 | ||
129 | `endif | |
130 | first_frame_enddelimeter_ok<=1'b1; | |
131 | ||
132 | tr_state<=`IDLE; | |
133 | end | |
134 | ||
135 | ||
136 | end | |
137 | ||
138 | endcase | |
139 | ||
140 | ||
141 | end | |
142 | ||
143 | ||
144 | endmodule | |
145 | ||
146 | ||
147 | module polling_state_fsm_chk(ps_bit,link_clk,polling_state_start); | |
148 | ||
149 | ||
150 | parameter DS=0; | |
151 | ||
152 | input ps_bit; | |
153 | input link_clk; | |
154 | input polling_state_start; | |
155 | ||
156 | reg [2:0] SB2NB_Map; | |
157 | reg [71:0] tr_reg; | |
158 | reg [4:0] tr_state; | |
159 | reg [9:0] tr_count; | |
160 | reg [11:0] clk_trn_ptrn; | |
161 | reg [3:0] clk_grp; | |
162 | reg ts2_ready_reg; | |
163 | reg [3:0] amb_id_reg; | |
164 | reg [23:0] test_param_reg; | |
165 | reg [7:8] test_param_count; | |
166 | reg polling_state_start_reg,polling_state_end_reg; | |
167 | reg [35:0] end_del_reg; | |
168 | ||
169 | ||
170 | ||
171 | initial begin | |
172 | tr_state=0; | |
173 | tr_count=10'h0; | |
174 | amb_id_reg=0; | |
175 | test_param_count=0; | |
176 | end | |
177 | ||
178 | ||
179 | always@(posedge link_clk) if ( polling_state_start ) | |
180 | begin | |
181 | case(tr_state) | |
182 | `IDLE: begin | |
183 | ts2_ready_reg=0; | |
184 | tr_reg[71:0] <= {ps_bit,tr_reg[71:1]}; | |
185 | ||
186 | if (tr_reg[71:60] == 12'b011111111110 ) begin | |
187 | tr_state <= `TS_TEST_1; | |
188 | end | |
189 | ||
190 | end | |
191 | `TS_TEST_1: begin | |
192 | tr_reg[71:0] = {ps_bit,tr_reg[71:1]}; | |
193 | tr_count=tr_count+10'h1; | |
194 | ||
195 | if ( (tr_count == 10'h3b) && (tr_reg[71:0] != 0 ) ) begin | |
196 | `ifdef AXIS_FBDIMM_HW | |
197 | `else | |
198 | ||
199 | `PR_ALWAYS ("ch_mon",`DBG_0,"pol_reg: %h ",tr_reg); | |
200 | ||
201 | /* This is checked indirectly | |
202 | if ( tr_reg[11:0] != 12'h7fe ) | |
203 | `PR_ALWAYS ("ch_mon",`DBG_0,"ERROR: 7fe pattern not found for polling state "); | |
204 | ||
205 | */ | |
206 | if ( {tr_reg[23:18]} != {6'b00000} ) | |
207 | `PR_ALWAYS ("ch_mon",`DBG_0,"ERROR: grp1 pattern in polling is wrong! "); | |
208 | ||
209 | if ( {tr_reg[34:29]} != {4'b0000} ) | |
210 | `PR_ALWAYS ("ch_mon",`DBG_0,"ERROR: NBwidthcapability pattern in polling is wrong! "); | |
211 | `endif | |
212 | ||
213 | tr_count=10'h0; | |
214 | tr_state=`IDLE; | |
215 | end | |
216 | ||
217 | ||
218 | end | |
219 | ||
220 | endcase | |
221 | ||
222 | ||
223 | end | |
224 | ||
225 | ||
226 | endmodule | |
227 | ||
228 | `endif // AXIS_FBDIMM_NO_FSR |