Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / bl / lib / ecc / src / BL_CKEcc.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: BL_CKEcc.h
* 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) 2007, 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.
**
*************************************************************************/
#ifndef __BL_CkEccFile_h__
#define __BL_CkEccFile_h__
#include <iostream.h>
//This class models the chip-kill ECC algorithim based on
//Appexdix 6 of the Niagara PRM.
class BL_CKEccFile
{
public:
// the data payload of a Chip-Kill Line (128-bits)
class ChipKillLine
{
public:
ChipKillLine() {}
virtual ~ChipKillLine() {}
uint64_t msdw;
uint64_t lsdw;
};
// calculates the ECC for a Chip-Kill line
static uint32_t generateChipkillECC(ChipKillLine line);
private:
// Constructor declaration
BL_CKEccFile();
// Destructor declaration
~BL_CKEccFile();
// Precalculated syndrome [0] - nibble order matches PRM. [1] -
// nibble order matches DESR.SYND
const static int syndrome[1024][2];
const static unsigned long long synd_exp_data [1024][2];
// Galois field multiplication table. Gives a 16 value by 16
// value result. This table was created by galois.perl, the
// perl script used to calculate tables in the PRM
const static uint8_t galois[16][16];
// Factor table. Gives the nibble to be added in to the result,
// and the multiplication to be performed on it.
struct mulfact
{
uint8_t mult; // multipler
uint8_t nibble_num; // nibble number to multiply and add
};
// nibble factor tables
const static struct mulfact nibbles[];
};
#endif //__BL_CkEccFile_h__