Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / bl / lib / ecc / src / BL_CKSyndrome.cc
CommitLineData
920dae64
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: BL_CKSyndrome.cc
4// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21/************************************************************************
22**
23** Copyright (C) 2006, Sun Microsystems, Inc.
24**
25** Sun considers its source code as an unpublished, proprietary
26** trade secret and it is available only under strict license provisions.
27** This copyright notice is placed here only to protect Sun in the event
28** the source is deemed a published work. Disassembly, decompilation,
29** or other means of reducing the object code to human readable form
30** is prohibited by the license agreement under which this code is
31** provided to the user or company in possession of this copy.
32**
33*************************************************************************/
34#include "BL_CKSyndrome.h"
35
36using namespace std;
37
38// The following 2 Dimensional Matrix implements Table A-12 of BL PRM rev1.1
39// First dimension is Syndrome0. Second dimension is Syndrome1
40// The values contained in the matrix are the possible values for Syndrome3 in hexadecimal
41// for a given [synd0,synd1], the value of synd3 should exactly match the value present in this table for the data bit error
42// to be correctable (single bit) otherwise it is an uncorrectable (multibit) error
43const uint32_t BL_CKSyndrome::a0bcErrorValidationMatrix[16][16] = {
44 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
45 /* 0 */ { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,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0x2, 0x8, 0x4, },
57 /* c */ { 0x0, 0xf, 0xe, 0x5, 0x7, 0x3, 0xb, 0x4, 0xa, 0xd, 0x8, 0x6, 0xc, 0x9, 0x2, 0x1, },
58 /* d */ { 0x0, 0xe, 0x7, 0xb, 0xa, 0x8, 0xc, 0x2, 0x5, 0xf, 0x4, 0x3, 0x6, 0xd, 0x1, 0x9, },
59 /* e */ { 0x0, 0xb, 0xc, 0x8, 0x6, 0x9, 0x4, 0xf, 0x3, 0x5, 0xd, 0x1, 0x2, 0xa, 0xe, 0x7, },
60 /* f */ { 0x0, 0xa, 0x5, 0x6, 0xb, 0x2, 0x3, 0x9, 0xc, 0x7, 0x1, 0x4, 0x8, 0xe, 0xd, 0xf, },
61};
62
63// The following 2 Dimensional Matrix implements Table A-11 of BL PRM rev1.1
64// First dimension is Syndrome0. Second dimension is Syndrome1
65// The data present at the intersection [synd0,synd1], represents the Data Nibble that has the correctable error!
66// The correction mask is the value of Syndrome1
67const uint32_t BL_CKSyndrome::a0bcErrorNibbleIdentityMatrix[16][16] = {
68 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
69 /* 0 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
70 /* 1 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, },
71 /* 2 */ { 0, 8, 0, 7, 1, 10, 2, 9, 3, 12, 4, 11, 5, 14, 6, 13, },
72 /* 3 */ { 0, 13, 14, 0, 12, 2, 1, 11, 8, 6, 5, 7, 3, 9, 10, 4, },
73 /* 4 */ { 0, 12, 8, 3, 0, 11, 7, 4, 1, 14, 10, 5, 2, 13, 9, 6, },
74 /* 5 */ { 0, 10, 4, 13, 9, 0, 14, 3, 6, 11, 1, 8, 12, 5, 7, 2, },
75 /* 6 */ { 0, 6, 13, 8, 14, 7, 0, 5, 12, 9, 2, 3, 1, 4, 11, 10, },
76 /* 7 */ { 0, 5, 11, 9, 10, 12, 6, 0, 4, 2, 8, 14, 13, 7, 1, 3, },
77 /* 8 */ { 0, 14, 12, 1, 8, 5, 3, 10, 0, 13, 11, 2, 7, 6, 4, 9, },
78 /* 9 */ { 0, 1, 3, 5, 7, 9, 11, 13, 2, 0, 6, 4, 10, 8, 14, 12, },
79 /* a */ { 0, 11, 10, 6, 4, 8, 13, 1, 9, 5, 0, 12, 14, 2, 3, 7, },
80 /* b */ { 0, 4, 9, 14, 6, 1, 12, 7, 13, 10, 3, 0, 8, 11, 2, 5, },
81 /* c */ { 0, 9, 6, 12, 13, 3, 8, 2, 14, 4, 7, 1, 0, 10, 5, 11, },
82 /* d */ { 0, 3, 7, 11, 2, 6, 10, 14, 5, 1, 13, 9, 4, 0, 12, 8, },
83 /* e */ { 0, 2, 5, 4, 11, 14, 9, 8, 10, 7, 12, 13, 6, 3, 0, 1, },
84 /* f */ { 0, 7, 2, 10, 5, 13, 4, 12, 11, 3, 14, 6, 9, 1, 8, 0, },
85};
86
87// The following 2 Dimensional Matrix implements Table A-14 of BL PRM rev1.1
88// First dimension is Syndrome0. Second dimension is Syndrome2
89// The values contained in the matrix are the possible values for Syndrome3 in hexadecimal
90// for a given [synd0,synd2], the value of synd3 should exactly match the value present in this table for the data bit error
91// to be correctable (single bit) otherwise it is an uncorrectable (multibit) error
92const uint32_t BL_CKSyndrome::ab0cErrorValidationMatrix[16][16] = {
93 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
94 /* 0 */ { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, },
95 /* 1 */ { 0x0, 0x1, 0x9, 0xe, 0xd, 0xb, 0x7, 0x6, 0xf, 0x2, 0xc, 0x5, 0xa, 0x4, 0x3, 0x8, },
96 /* 2 */ { 0x0, 0x4, 0x2, 0xd, 0x1, 0xa, 0xf, 0xb, 0x9, 0x8, 0x5, 0x7, 0xe, 0x3, 0xc, 0x6, },
97 /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 0x8, 0x6, 0x9, 0x4, 0xf, 0x3, 0x5, 0xd, 0x1, 0x2, 0xa, 0xe, 0x7, },
109 /* f */ { 0x0, 0xa, 0x5, 0x6, 0xb, 0x2, 0x3, 0x9, 0xc, 0x7, 0x1, 0x4, 0x8, 0xe, 0xd, 0xf, },
110};
111
112// The following 2 Dimensional Matrix implements Table A-13 of BL PRM rev1.1
113// First dimension is Syndrome0. Second dimension is Syndrome2
114// The data present at the intersection [synd0,synd2], represents the Data Nibble that has the correctable error!
115// The correction mask is the value of Syndrome2
116const uint32_t BL_CKSyndrome::ab0cErrorNibbleIdentityMatrix[16][16] = {
117 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
118 /* 0 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
119 /* 1 */ { 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, },
120 /* 2 */ { 0, 23, 15, 22, 16, 25, 17, 24, 18, 27, 19, 26, 20, 29, 21, 28, },
121 /* 3 */ { 0, 28, 29, 15, 27, 17, 16, 26, 23, 21, 20, 22, 18, 24, 25, 19, },
122 /* 4 */ { 0, 27, 23, 18, 15, 26, 22, 19, 16, 29, 25, 20, 17, 28, 24, 21, },
123 /* 5 */ { 0, 25, 19, 28, 24, 15, 29, 18, 21, 26, 16, 23, 27, 20, 22, 17, },
124 /* 6 */ { 0, 21, 28, 23, 29, 22, 15, 20, 27, 24, 17, 18, 16, 19, 26, 25, },
125 /* 7 */ { 0, 20, 26, 24, 25, 27, 21, 15, 19, 17, 23, 29, 28, 22, 16, 18, },
126 /* 8 */ { 0, 29, 27, 16, 23, 20, 18, 25, 15, 28, 26, 17, 22, 21, 19, 24, },
127 /* 9 */ { 0, 16, 18, 20, 22, 24, 26, 28, 17, 15, 21, 19, 25, 23, 29, 27, },
128 /* a */ { 0, 26, 25, 21, 19, 23, 28, 16, 24, 20, 15, 27, 29, 17, 18, 22, },
129 /* b */ { 0, 19, 24, 29, 21, 16, 27, 22, 28, 25, 18, 15, 23, 26, 17, 20, },
130 /* c */ { 0, 24, 21, 27, 28, 18, 23, 17, 29, 19, 22, 16, 15, 25, 20, 26, },
131 /* d */ { 0, 18, 22, 26, 17, 21, 25, 29, 20, 16, 28, 24, 19, 15, 27, 23, },
132 /* e */ { 0, 17, 20, 19, 26, 29, 24, 23, 25, 22, 27, 28, 21, 18, 15, 16, },
133 /* f */ { 0, 22, 17, 25, 20, 28, 19, 27, 26, 18, 29, 21, 24, 16, 23, 15, },
134};