Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: sioniu_err_mon.vr | |
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 | #include <vera_defines.vrh> | |
36 | #include <VeraListProgram.vrh> | |
37 | #include <ListMacros.vrh> | |
38 | #include "ios_err_packet.vrh" | |
39 | #include "ios_rasmon.if.vrh" | |
40 | #include "ios_rasmon_ports_binds.vrh" | |
41 | #include "std_display_class.vrh" | |
42 | #include "siu_common.vrh" | |
43 | ||
44 | ExternVeraList(ios_err_packet); | |
45 | ||
46 | class sioniu_err_mon { | |
47 | sioniu_errmon_port sioniu; | |
48 | ||
49 | local VeraList_ios_err_packet err_list; | |
50 | ||
51 | StandardDisplay dbg; | |
52 | local string myname; | |
53 | ||
54 | task new(sioniu_errmon_port sioniu, StandardDisplay dbg); | |
55 | ||
56 | task input_mon(); | |
57 | task report_mon(); | |
58 | ||
59 | function integer errlist_size() { errlist_size = err_list.size(); } | |
60 | } | |
61 | ||
62 | task sioniu_err_mon::new(sioniu_errmon_port sioniu, StandardDisplay dbg) | |
63 | { | |
64 | integer i; | |
65 | ||
66 | this.sioniu = sioniu; | |
67 | this.dbg = dbg; | |
68 | this.myname = "sio-niu rasmon"; | |
69 | ||
70 | err_list = new(); | |
71 | ||
72 | fork { input_mon(); } join none | |
73 | fork { report_mon(); } join none | |
74 | } | |
75 | ||
76 | task sioniu_err_mon::report_mon() | |
77 | { | |
78 | ios_err_packet err_pkt; | |
79 | SocErr_Type err_type[3]; | |
80 | string err_msg[3]; | |
81 | bit [2:0] niuncu_rpt; | |
82 | integer i, found; | |
83 | integer monitor_on = 1; | |
84 | VeraListIterator_ios_err_packet list_ptr; | |
85 | ||
86 | err_type[0] = SIONIU_DP; err_msg[0] = "data pe"; | |
87 | err_type[1] = SIONIU_CCE; err_msg[1] = "ctag ce"; | |
88 | err_type[2] = SIONIU_CUE; err_msg[2] = "ctag ue"; | |
89 | ||
90 | if (get_plus_arg(CHECK, "sio_niu_ras_chk_off")){ | |
91 | monitor_on = 0; | |
92 | } | |
93 | ||
94 | while (monitor_on) | |
95 | { | |
96 | @(posedge sioniu.$clk); | |
97 | niuncu_rpt = {sioniu.$ctag_ue, sioniu.$ctag_ce, sioniu.$d_pe}; | |
98 | if (niuncu_rpt !== 3'b000 && niuncu_rpt !== 3'bxxx) | |
99 | { | |
100 | if (err_list.empty()) | |
101 | dbg.dispmon(myname, MON_ERR, psprintf("niu report unexpected errors!")); | |
102 | else | |
103 | for (i=0; i<3; i++) | |
104 | if (niuncu_rpt[i] !== 0) | |
105 | { | |
106 | list_ptr = err_list.start(); | |
107 | err_pkt = list_ptr.data(); | |
108 | found = 0; | |
109 | while (err_pkt != null && !found) | |
110 | { | |
111 | if (err_pkt.type == err_type[i]) | |
112 | { | |
113 | list_ptr = err_list.erase(list_ptr); | |
114 | dbg.dispmon(myname, MON_NORMAL, psprintf("matched! niu report %s!", err_msg[i])); | |
115 | found = 1; | |
116 | } | |
117 | else | |
118 | list_ptr.next(); | |
119 | if (list_ptr != null) | |
120 | err_pkt = list_ptr.data(); | |
121 | } | |
122 | if (!found) | |
123 | dbg.dispmon(myname, MON_NORMAL, psprintf("niu report unexpected %s!", err_msg[i])); | |
124 | } | |
125 | } | |
126 | } | |
127 | } | |
128 | ||
129 | task sioniu_err_mon::input_mon() | |
130 | { | |
131 | bit [15:0] cur_ctag; | |
132 | bit [5:0] cur_cecc; | |
133 | bit [5:0] my_cecc; | |
134 | bit [127:0] cur_data; | |
135 | bit [127:0] tmp_data; | |
136 | bit [7:0] tmp_parity; | |
137 | integer i, j, cce, cue, dpe; | |
138 | ios_err_packet err_pkt; | |
139 | ||
140 | while (1) | |
141 | { | |
142 | @(posedge sioniu.$clk); | |
143 | if (sioniu.$req === 1'b1) | |
144 | { | |
145 | cce = 0; | |
146 | cue = 0; | |
147 | dpe = 0; | |
148 | dbg.dispmon(myname, MON_INFO, psprintf("capture sio-niu valid")); | |
149 | // verify the ecc | |
150 | cur_ctag = sioniu.$data[79:64]; | |
151 | my_cecc = gen_ctag_ecc(cur_ctag); | |
152 | cur_cecc = sioniu.$data[61:56]; | |
153 | for (i=0; i<6 && cce<2; i++) | |
154 | cce += (cur_cecc[i] !== my_cecc[i]) ? 1 : 0; | |
155 | if (cce == 1) | |
156 | { | |
157 | dbg.dispmon(myname, MON_NORMAL, psprintf("capture sio-niu ctag ce get %x, exp %x", cur_cecc, my_cecc)); | |
158 | err_pkt = new(SIONIU_CCE, cur_ctag, 40'h8000000000); | |
159 | err_list.push_back(err_pkt); | |
160 | } | |
161 | if (cce > 1) | |
162 | { | |
163 | dbg.dispmon(myname, MON_NORMAL, psprintf("capture sio-niu ctag ue get %x, exp %x", cur_cecc, my_cecc)); | |
164 | err_pkt = new(SIONIU_CUE, cur_ctag, 40'h8000000000); | |
165 | err_list.push_back(err_pkt); | |
166 | } | |
167 | ||
168 | // for read, verify the data parity | |
169 | if (sioniu.$data[125] === 1'b1) | |
170 | { | |
171 | for (i=0; i<4 && !dpe; i++) | |
172 | { | |
173 | @(posedge sioniu.$clk); | |
174 | cur_data = sioniu.$data; | |
175 | tmp_parity[7:6] = interleave_parity(cur_data[127:96], 32); | |
176 | tmp_parity[5:4] = interleave_parity(cur_data[95:64], 32); | |
177 | tmp_parity[3:2] = interleave_parity(cur_data[63:32], 32); | |
178 | tmp_parity[1:0] = interleave_parity(cur_data[31:0], 32); | |
179 | if (tmp_parity !== sioniu.$parity) | |
180 | { | |
181 | dpe = 1; | |
182 | dbg.dispmon(myname, MON_NORMAL, psprintf("capture sio-niu data parity error get %x exp %x", sioniu.$parity, tmp_parity)); | |
183 | err_pkt = new(SIONIU_DP, cur_ctag, 40'h8000000000); | |
184 | err_list.push_back(err_pkt); | |
185 | } | |
186 | } | |
187 | } | |
188 | } | |
189 | } | |
190 | } |