| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: l2cpx_checker.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 | module l2cpx_checker(); |
| 36 | parameter SMPLE = 3; |
| 37 | |
| 38 | wire cpx_valid,cpx_nc,cpx_atomic,cpx_pf; |
| 39 | wire [3:0] cpx_rtntyp; |
| 40 | wire [1:0] cpx_err; |
| 41 | reg l2cpx_mon,l2cpx_errmon; |
| 42 | |
| 43 | initial |
| 44 | begin |
| 45 | l2cpx_mon = 1; |
| 46 | l2cpx_errmon = 1; |
| 47 | if($test$plusargs("l2cpx_mon_off")) |
| 48 | begin |
| 49 | if($test$plusargs("l2cpx_errmon_off")) |
| 50 | begin |
| 51 | l2cpx_errmon = 0; |
| 52 | `PR_ALWAYS("L2-CPX Err Packet Checker", `ALWAYS, "L2-CPX Err PACKET CHKR Disabled"); |
| 53 | end |
| 54 | l2cpx_mon = 0; |
| 55 | `PR_ALWAYS("L2 CPX Packet Checker", `ALWAYS, "L2 CPX PACKET CHKR Disabled"); |
| 56 | end |
| 57 | else if($test$plusargs("l2cpx_errmon_off")) |
| 58 | begin |
| 59 | l2cpx_errmon = 0; |
| 60 | `PR_ALWAYS("L2-CPX Err Packet Checker", `ALWAYS, "L2-CPX Err PACKET CHKR Disabled"); |
| 61 | end |
| 62 | else |
| 63 | begin |
| 64 | `PR_ALWAYS("L2 CPX Packet Checker", `ALWAYS, "L2 CPX PACKET CHKR Enabled"); |
| 65 | `PR_ALWAYS("L2-CPX Err Packet Checker", `ALWAYS, "L2-CPX Err PACKET CHKR Enabled"); |
| 66 | end |
| 67 | end |
| 68 | |
| 69 | assign cpx_valid = tb_top.cpu.l2t0.l2t_cpx_data_ca[145]; |
| 70 | assign cpx_rtntyp = tb_top.cpu.l2t0.l2t_cpx_data_ca[144:141]; |
| 71 | assign cpx_err = tb_top.cpu.l2t0.l2t_cpx_data_ca[139:138]; |
| 72 | assign cpx_nc = tb_top.cpu.l2t0.l2t_cpx_data_ca[137]; |
| 73 | assign cpx_atomic = tb_top.cpu.l2t0.l2t_cpx_data_ca[129]; |
| 74 | assign cpx_pf = tb_top.cpu.l2t0.l2t_cpx_data_ca[128]; |
| 75 | |
| 76 | /* |
| 77 | ******** Start of Illegal CPX Packet Checker ****** |
| 78 | */ |
| 79 | |
| 80 | |
| 81 | always @(posedge tb_top.cpu.l2clk) |
| 82 | begin |
| 83 | if(l2cpx_mon == 1) |
| 84 | begin |
| 85 | #(SMPLE) |
| 86 | case(cpx_rtntyp) |
| 87 | 4'b1000: |
| 88 | begin |
| 89 | if(cpx_valid == 1) |
| 90 | begin |
| 91 | if(cpx_nc != 1 || cpx_atomic != 0 || cpx_pf != 0) |
| 92 | begin |
| 93 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 94 | end |
| 95 | end |
| 96 | end |
| 97 | 4'b0100: |
| 98 | begin |
| 99 | if(cpx_valid == 1) |
| 100 | begin |
| 101 | if(cpx_atomic == 0 && cpx_pf == 0 && cpx_err != 0) |
| 102 | begin |
| 103 | //`PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 104 | `PR_ALWAYS("l2cpx_mon",`ALWAYS,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 105 | `PR_ALWAYS("l2cpx_mon",`ALWAYS,"PACKET FOR DCACHE/ICACHE INV,STORE ACK"); |
| 106 | end |
| 107 | else if(cpx_atomic == 0 && cpx_pf == 1) |
| 108 | begin |
| 109 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 110 | end |
| 111 | else if(cpx_atomic == 1 && cpx_pf == 1) |
| 112 | begin |
| 113 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 114 | end |
| 115 | end |
| 116 | end |
| 117 | 4'b1001: |
| 118 | begin |
| 119 | if(cpx_valid == 1) |
| 120 | begin |
| 121 | if(cpx_nc != 1 || cpx_atomic != 0 || cpx_pf != 0) |
| 122 | begin |
| 123 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 124 | end |
| 125 | end |
| 126 | end |
| 127 | 4'b0010: |
| 128 | begin |
| 129 | if(cpx_valid == 1) |
| 130 | begin |
| 131 | if(cpx_nc != 1 || cpx_atomic != 0 || cpx_pf != 0) |
| 132 | begin |
| 133 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 134 | end |
| 135 | end |
| 136 | end |
| 137 | 4'b0110: |
| 138 | begin |
| 139 | if(cpx_valid == 1) |
| 140 | begin |
| 141 | if(cpx_pf != 0 || cpx_err != 0) |
| 142 | begin |
| 143 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 144 | end |
| 145 | end |
| 146 | end |
| 147 | 4'b0101: |
| 148 | begin |
| 149 | if(cpx_valid == 1) |
| 150 | begin |
| 151 | if(cpx_nc != 1 || cpx_atomic != 0 || cpx_pf != 0) |
| 152 | begin |
| 153 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 154 | end |
| 155 | end |
| 156 | end |
| 157 | 4'b0111: |
| 158 | begin |
| 159 | if(cpx_valid == 1) |
| 160 | begin |
| 161 | if(cpx_nc != 1 || cpx_err != 0 || cpx_pf != 0) |
| 162 | begin |
| 163 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 164 | end |
| 165 | end |
| 166 | end |
| 167 | 4'b0011: |
| 168 | begin |
| 169 | if(cpx_valid == 1) |
| 170 | begin |
| 171 | if(cpx_pf != 0 || cpx_err != 0) |
| 172 | begin |
| 173 | `PR_ERROR("l2cpx_mon",`ERROR,"ILLEGAL L2 CPX PACKET: rtntyp[144:141] :%0h, err[139:138] :%h, nc[137] :%0h, atomic[129] :%0h, pf[128] :%0h",cpx_rtntyp,cpx_err,cpx_nc,cpx_atomic,cpx_pf); |
| 174 | end |
| 175 | end |
| 176 | end |
| 177 | |
| 178 | endcase |
| 179 | end |
| 180 | |
| 181 | end |
| 182 | |
| 183 | /* |
| 184 | ******* End of Illegal CPX Packet Checker ****** |
| 185 | */ |
| 186 | |
| 187 | |
| 188 | /* |
| 189 | ******* Start of Error CPX Packet Checker ****** |
| 190 | */ |
| 191 | |
| 192 | |
| 193 | always @(posedge tb_top.cpu.l2clk) |
| 194 | begin |
| 195 | if(l2cpx_errmon == 1 && cpx_valid == 1 && cpx_err != 0) |
| 196 | begin |
| 197 | case(cpx_rtntyp) |
| 198 | 4'b0000: |
| 199 | begin |
| 200 | if(cpx_pf == 0) |
| 201 | begin |
| 202 | if(cpx_err == 1) |
| 203 | begin |
| 204 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in L2 Load Return Packet"); |
| 205 | end |
| 206 | else if(cpx_err == 2) |
| 207 | begin |
| 208 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in L2 Load Return Packet"); |
| 209 | end |
| 210 | else |
| 211 | begin |
| 212 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in L2 Load Return Packet"); |
| 213 | end |
| 214 | end |
| 215 | else |
| 216 | begin |
| 217 | if(cpx_err == 1) |
| 218 | begin |
| 219 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in L2 Prefetch Return Packet"); |
| 220 | end |
| 221 | else if(cpx_err == 2) |
| 222 | begin |
| 223 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in L2 Prefetch Return Packet"); |
| 224 | end |
| 225 | else |
| 226 | begin |
| 227 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in L2 Prefetch Return Packet"); |
| 228 | end |
| 229 | |
| 230 | end |
| 231 | end |
| 232 | 4'b1000: |
| 233 | begin |
| 234 | if(cpx_err == 1) |
| 235 | begin |
| 236 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in NCU Load Return Packet From L2"); |
| 237 | end |
| 238 | else if(cpx_err == 2) |
| 239 | begin |
| 240 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in NCU Load Return Packet From L2"); |
| 241 | end |
| 242 | else |
| 243 | begin |
| 244 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in NCU Load Return Packet From L2"); |
| 245 | end |
| 246 | end |
| 247 | 4'b0001: |
| 248 | begin |
| 249 | if(cpx_err == 1) |
| 250 | begin |
| 251 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in iFill Return Packet From L2"); |
| 252 | end |
| 253 | else if(cpx_err == 2) |
| 254 | begin |
| 255 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in iFill Return Packet From L2"); |
| 256 | end |
| 257 | else |
| 258 | begin |
| 259 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in iFill Return Packet From L2"); |
| 260 | end |
| 261 | end |
| 262 | 4'b1001: |
| 263 | begin |
| 264 | if(cpx_err == 1) |
| 265 | begin |
| 266 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in NCU iFill Return Packet From L2"); |
| 267 | end |
| 268 | else if(cpx_err == 2) |
| 269 | begin |
| 270 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in NCU iFill Return Packet From L2"); |
| 271 | end |
| 272 | else |
| 273 | begin |
| 274 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in NCU iFill Return Packet From L2"); |
| 275 | end |
| 276 | end |
| 277 | 4'b0100: |
| 278 | begin |
| 279 | if(cpx_err == 1) |
| 280 | begin |
| 281 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in CAS/Swap Ack Return Packet From L2"); |
| 282 | end |
| 283 | else if(cpx_err == 2) |
| 284 | begin |
| 285 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in CAS/Swap Ack Return Packet From L2"); |
| 286 | end |
| 287 | else |
| 288 | begin |
| 289 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in CAS/Swap Ack Return Packet From L2"); |
| 290 | end |
| 291 | end |
| 292 | 4'b0010: |
| 293 | begin |
| 294 | if(cpx_err == 1) |
| 295 | begin |
| 296 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in Stream Load Return Packet From L2"); |
| 297 | end |
| 298 | else if(cpx_err == 2) |
| 299 | begin |
| 300 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in Stream Load Return Packet From L2"); |
| 301 | end |
| 302 | else |
| 303 | begin |
| 304 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in Stream Load Return Packet From L2"); |
| 305 | end |
| 306 | end |
| 307 | 4'b0101: |
| 308 | begin |
| 309 | if(cpx_err == 1) |
| 310 | begin |
| 311 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error in MMU Load Return Packet From L2"); |
| 312 | end |
| 313 | else if(cpx_err == 2) |
| 314 | begin |
| 315 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error in MMU Load Return Packet From L2"); |
| 316 | end |
| 317 | else |
| 318 | begin |
| 319 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error in MMU Load Return Packet From L2"); |
| 320 | end |
| 321 | end |
| 322 | 4'b1100: |
| 323 | begin |
| 324 | if(cpx_err == 1) |
| 325 | begin |
| 326 | `PR_ERROR("l2cpx_errmon",`ERROR,"Correctable Error Indication Packet From L2"); |
| 327 | end |
| 328 | else if(cpx_err == 2) |
| 329 | begin |
| 330 | `PR_ERROR("l2cpx_errmon",`ERROR,"Un-Correctable Error Indication Packet From L2"); |
| 331 | end |
| 332 | else |
| 333 | begin |
| 334 | `PR_ERROR("l2cpx_errmon",`ERROR,"NotData Error Indication Packet From L2"); |
| 335 | end |
| 336 | end |
| 337 | 4'b1100: |
| 338 | begin |
| 339 | if(cpx_err == 1) |
| 340 | begin |
| 341 | `PR_ERROR("l2cpx_errmon",`ERROR,"Soc Correctable Error Indication Packet From L2"); |
| 342 | end |
| 343 | else if(cpx_err == 2) |
| 344 | begin |
| 345 | `PR_ERROR("l2cpx_errmon",`ERROR,"Soc Un-Correctable Error Indication Packet From L2"); |
| 346 | end |
| 347 | else |
| 348 | begin |
| 349 | `PR_ERROR("l2cpx_errmon",`ERROR,"Soc NotData Error Indication Packet From L2"); |
| 350 | end |
| 351 | end |
| 352 | endcase |
| 353 | end // end if(l2cpx_errmon == 1 && cpx_valid == 1 && cpx_err != 0) |
| 354 | end // end always block |
| 355 | |
| 356 | /* |
| 357 | ******* End of Error CPX Packet Checker ****** |
| 358 | */ |
| 359 | |
| 360 | |
| 361 | |
| 362 | endmodule |