| 1 | // ========== Copyright Header Begin ========================================== |
| 2 | // |
| 3 | // OpenSPARC T2 Processor File: l2err_scrbrd.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 l2err_scrbrd(cpx_pckt,desr_cnt,err_cnt); |
| 36 | |
| 37 | input [23:0]cpx_pckt,desr_cnt,err_cnt; |
| 38 | |
| 39 | `define SIM_END_TRAP tb_top.cpu.spc0.tlu.trl0_trap_type[8:0] |
| 40 | reg scrbd_on,err_fwd_on; |
| 41 | |
| 42 | initial |
| 43 | begin |
| 44 | scrbd_on = 0; |
| 45 | err_fwd_on = 0; |
| 46 | if($test$plusargs("L2DA_BIT_STUCK_TO0")) |
| 47 | scrbd_on = 1; |
| 48 | else if ($test$plusargs("L2DA_BIT_STUCK_TO1")) |
| 49 | scrbd_on = 1; |
| 50 | //else if ($test$plusargs("L2DA_ERR_ENABLE_FWD")) |
| 51 | else if ($test$plusargs("L2DA_ERR_ENABLE") || $test$plusargs("L2DA_INJECT_UE_ALLBANKS")) |
| 52 | begin |
| 53 | err_fwd_on = 1; |
| 54 | scrbd_on = 1; |
| 55 | end |
| 56 | /*else if ($test$plusargs("L2DA_ERR_ENABLE")) |
| 57 | scrbd_on = 1; |
| 58 | else if ($test$plusargs("L2DA_RAND_ERR_ENABLE")) |
| 59 | scrbd_on = 1; */ |
| 60 | end |
| 61 | |
| 62 | |
| 63 | always @(`SIM_END_TRAP or err_cnt or cpx_pckt or err_fwd_on) |
| 64 | begin |
| 65 | if(err_fwd_on == 1) |
| 66 | begin |
| 67 | if(`SIM_END_TRAP == 12'h1a0 || `SIM_END_TRAP == 12'h100) |
| 68 | begin |
| 69 | if(err_cnt == cpx_pckt) |
| 70 | `PR_ALWAYS("l2err_mon",`ALWAYS,"L2t.cpx_packet = L2.InjectedError"); |
| 71 | else |
| 72 | `PR_ALWAYS("l2err_mon",`ALWAYS,"L2t.cpx_packet != L2.InjectedError, MISMATCH !!"); |
| 73 | // `PR_ERROR("l2err_mon",`ERROR,"L2t.cpx_packet != L2.InjectedError, MISMATCH !!"); |
| 74 | end |
| 75 | end |
| 76 | end |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | always @(`SIM_END_TRAP or err_cnt or cpx_pckt or scrbd_on) |
| 82 | begin |
| 83 | if(scrbd_on == 1) |
| 84 | begin |
| 85 | if(`SIM_END_TRAP == 12'h1a0 || `SIM_END_TRAP == 12'h100 || `SIM_END_TRAP == 12'h101 || `SIM_END_TRAP == 12'h1a1) |
| 86 | begin |
| 87 | `PR_ALWAYS("l2err_mon",`ALWAYS,"Errs INJECTED IN L2 DATA ARRAY = %0d",err_cnt); |
| 88 | `PR_ALWAYS("l2err_mon",`ALWAYS," L2t.CPX_PACKETS SENT = %d",cpx_pckt); |
| 89 | end |
| 90 | end |
| 91 | end |
| 92 | |
| 93 | |
| 94 | |
| 95 | task SetTrapCount; |
| 96 | input [8:0] count; |
| 97 | reg [8:0] count; |
| 98 | begin |
| 99 | |
| 100 | if(count == cpx_pckt) |
| 101 | `PR_ALWAYS("l2err_mon",`ALWAYS,"L2t.CPX_PACKETS = L2.TRAPS_TAKEN_BY_CORE"); |
| 102 | else `PR_ALWAYS("l2err_mon",`ALWAYS,"L2t.CPX_PACKETS != L2.TRAPS_TAKEN_BY_CORE, MISMATCH !!"); |
| 103 | //else `PR_ERROR("l2err_mon",`ERROR,"L2t.CPX_PACKETS != L2.TRAPS_TAKEN_BY_CORE, MISMATCH !!"); |
| 104 | |
| 105 | |
| 106 | end |
| 107 | endtask |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | endmodule |