Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / bl / lib / ecc / src / BL_HammingEcc.h
/*
* ========== Copyright Header Begin ==========================================
*
* OpenSPARC T2 Processor File: BL_HammingEcc.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) 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.
**
*************************************************************************/
#ifndef __BL_HammingEcc_h__
#define __BL_HammingEcc_h__
#include "BL_BitUtility.h"
#include "BL_BaseEcc.h"
#include <unistd.h>
class BL_HammingEcc
{
public:
friend class BL_Hamming_22_6_Synd;
friend class BL_Hamming_32_7_Synd;
friend class BL_Hamming_64_8_Synd;
BL_HammingEcc() {}
~BL_HammingEcc() {}
protected:
static BL_Hamming_22_6_Synd get_hamming_22_6_synd(uint32_t data,
uint32_t stored_ecc_val);
static BL_Hamming_32_7_Synd get_hamming_32_7_synd(uint32_t data,
uint32_t stored_ecc_val);
static BL_Hamming_64_8_Synd get_hamming_64_8_synd(uint64_t data,
uint64_t stored_ecc_val);
typedef enum {
BL_Hamming_22_6,
BL_Hamming_32_7,
BL_Hamming_64_8
} BL_HammingEccTypes;
static BL_EccBits calc_check_bits(BL_HammingEccTypes type,
uint64_t data);
static uint64_t hamming_22_6_ecc_masks[];
static uint64_t hamming_32_7_ecc_masks[];
static uint64_t hamming_64_8_ecc_masks[];
};
#endif