Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / bl / lib / ecc / src / BL_CKSyndrome.cc
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T2 Processor File: BL_CKSyndrome.cc
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License version 2 as published by the Free Software Foundation.
//
// The above named program is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this work; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
// ========== Copyright Header End ============================================
/************************************************************************
**
** Copyright (C) 2006, Sun Microsystems, Inc.
**
** Sun considers its source code as an unpublished, proprietary
** trade secret and it is available only under strict license provisions.
** This copyright notice is placed here only to protect Sun in the event
** the source is deemed a published work. Disassembly, decompilation,
** or other means of reducing the object code to human readable form
** is prohibited by the license agreement under which this code is
** provided to the user or company in possession of this copy.
**
*************************************************************************/
#include "BL_CKSyndrome.h"
using namespace std;
// The following 2 Dimensional Matrix implements Table A-12 of BL PRM rev1.1
// First dimension is Syndrome0. Second dimension is Syndrome1
// The values contained in the matrix are the possible values for Syndrome3 in hexadecimal
// for a given [synd0,synd1], the value of synd3 should exactly match the value present in this table for the data bit error
// to be correctable (single bit) otherwise it is an uncorrectable (multibit) error
const uint32_t BL_CKSyndrome::a0bcErrorValidationMatrix[16][16] = {
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, },
/* 1 */ { 0x0, 0x1, 0x9, 0xe, 0xd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, 0x9, 0x2, 0x1, },
/* d */ { 0x0, 0xe, 0x7, 0xb, 0xa, 0x8, 0xc, 0x2, 0x5, 0xf, 0x4, 0x3, 0x6, 0xd, 0x1, 0x9, },
/* e */ { 0x0, 0xb, 0xc, 0x8, 0x6, 0x9, 0x4, 0xf, 0x3, 0x5, 0xd, 0x1, 0x2, 0xa, 0xe, 0x7, },
/* f */ { 0x0, 0xa, 0x5, 0x6, 0xb, 0x2, 0x3, 0x9, 0xc, 0x7, 0x1, 0x4, 0x8, 0xe, 0xd, 0xf, },
};
// The following 2 Dimensional Matrix implements Table A-11 of BL PRM rev1.1
// First dimension is Syndrome0. Second dimension is Syndrome1
// The data present at the intersection [synd0,synd1], represents the Data Nibble that has the correctable error!
// The correction mask is the value of Syndrome1
const uint32_t BL_CKSyndrome::a0bcErrorNibbleIdentityMatrix[16][16] = {
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
/* 1 */ { 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, },
/* 2 */ { 0, 8, 0, 7, 1, 10, 2, 9, 3, 12, 4, 11, 5, 14, 6, 13, },
/* 3 */ { 0, 13, 14, 0, 12, 2, 1, 11, 8, 6, 5, 7, 3, 9, 10, 4, },
/* 4 */ { 0, 12, 8, 3, 0, 11, 7, 4, 1, 14, 10, 5, 2, 13, 9, 6, },
/* 5 */ { 0, 10, 4, 13, 9, 0, 14, 3, 6, 11, 1, 8, 12, 5, 7, 2, },
/* 6 */ { 0, 6, 13, 8, 14, 7, 0, 5, 12, 9, 2, 3, 1, 4, 11, 10, },
/* 7 */ { 0, 5, 11, 9, 10, 12, 6, 0, 4, 2, 8, 14, 13, 7, 1, 3, },
/* 8 */ { 0, 14, 12, 1, 8, 5, 3, 10, 0, 13, 11, 2, 7, 6, 4, 9, },
/* 9 */ { 0, 1, 3, 5, 7, 9, 11, 13, 2, 0, 6, 4, 10, 8, 14, 12, },
/* a */ { 0, 11, 10, 6, 4, 8, 13, 1, 9, 5, 0, 12, 14, 2, 3, 7, },
/* b */ { 0, 4, 9, 14, 6, 1, 12, 7, 13, 10, 3, 0, 8, 11, 2, 5, },
/* c */ { 0, 9, 6, 12, 13, 3, 8, 2, 14, 4, 7, 1, 0, 10, 5, 11, },
/* d */ { 0, 3, 7, 11, 2, 6, 10, 14, 5, 1, 13, 9, 4, 0, 12, 8, },
/* e */ { 0, 2, 5, 4, 11, 14, 9, 8, 10, 7, 12, 13, 6, 3, 0, 1, },
/* f */ { 0, 7, 2, 10, 5, 13, 4, 12, 11, 3, 14, 6, 9, 1, 8, 0, },
};
// The following 2 Dimensional Matrix implements Table A-14 of BL PRM rev1.1
// First dimension is Syndrome0. Second dimension is Syndrome2
// The values contained in the matrix are the possible values for Syndrome3 in hexadecimal
// for a given [synd0,synd2], the value of synd3 should exactly match the value present in this table for the data bit error
// to be correctable (single bit) otherwise it is an uncorrectable (multibit) error
const uint32_t BL_CKSyndrome::ab0cErrorValidationMatrix[16][16] = {
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, },
/* 1 */ { 0x0, 0x1, 0x9, 0xe, 0xd, 0xb, 0x7, 0x6, 0xf, 0x2, 0xc, 0x5, 0xa, 0x4, 0x3, 0x8, },
/* 2 */ { 0x0, 0x4, 0x2, 0xd, 0x1, 0xa, 0xf, 0xb, 0x9, 0x8, 0x5, 0x7, 0xe, 0x3, 0xc, 0x6, },
/* 3 */ { 0x0, 0x5, 0xb, 0x3, 0xc, 0x1, 0x8, 0xd, 0x6, 0xa, 0x9, 0x2, 0x4, 0x7, 0xf, 0xe, },
/* 4 */ { 0x0, 0x3, 0x8, 0x1, 0x4, 0xe, 0x9, 0xa, 0x2, 0x6, 0x7, 0x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-13 of BL PRM rev1.1
// First dimension is Syndrome0. Second dimension is Syndrome2
// The data present at the intersection [synd0,synd2], represents the Data Nibble that has the correctable error!
// The correction mask is the value of Syndrome2
const uint32_t BL_CKSyndrome::ab0cErrorNibbleIdentityMatrix[16][16] = {
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
/* 0 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
/* 1 */ { 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, },
/* 2 */ { 0, 23, 15, 22, 16, 25, 17, 24, 18, 27, 19, 26, 20, 29, 21, 28, },
/* 3 */ { 0, 28, 29, 15, 27, 17, 16, 26, 23, 21, 20, 22, 18, 24, 25, 19, },
/* 4 */ { 0, 27, 23, 18, 15, 26, 22, 19, 16, 29, 25, 20, 17, 28, 24, 21, },
/* 5 */ { 0, 25, 19, 28, 24, 15, 29, 18, 21, 26, 16, 23, 27, 20, 22, 17, },
/* 6 */ { 0, 21, 28, 23, 29, 22, 15, 20, 27, 24, 17, 18, 16, 19, 26, 25, },
/* 7 */ { 0, 20, 26, 24, 25, 27, 21, 15, 19, 17, 23, 29, 28, 22, 16, 18, },
/* 8 */ { 0, 29, 27, 16, 23, 20, 18, 25, 15, 28, 26, 17, 22, 21, 19, 24, },
/* 9 */ { 0, 16, 18, 20, 22, 24, 26, 28, 17, 15, 21, 19, 25, 23, 29, 27, },
/* a */ { 0, 26, 25, 21, 19, 23, 28, 16, 24, 20, 15, 27, 29, 17, 18, 22, },
/* b */ { 0, 19, 24, 29, 21, 16, 27, 22, 28, 25, 18, 15, 23, 26, 17, 20, },
/* c */ { 0, 24, 21, 27, 28, 18, 23, 17, 29, 19, 22, 16, 15, 25, 20, 26, },
/* d */ { 0, 18, 22, 26, 17, 21, 25, 29, 20, 16, 28, 24, 19, 15, 27, 23, },
/* e */ { 0, 17, 20, 19, 26, 29, 24, 23, 25, 22, 27, 28, 21, 18, 15, 16, },
/* f */ { 0, 22, 17, 25, 20, 28, 19, 27, 26, 18, 29, 21, 24, 16, 23, 15, },
};