* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: BL_BaseSynd.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_BaseSynd_h__
#define __BL_BaseSynd_h__
#include "BL_BitUtility.h"
BL_BaseSynd(uint32_t syndrome
) :
* @param rhs The right hand side of the assignment operator.
* @return The lvalue of the assignment.
const BL_BaseSynd
& operator=( const BL_BaseSynd
&rhs
)
syndrome_
= rhs
.syndrome_
;
uint32_t getSyndrome() const { return syndrome_
; }
bool noError() const { return (syndrome_
== 0); }
virtual bool isDoubleBitError() const = 0;
virtual bool isSingleBitError() const = 0;
virtual bool isDataBitError() const = 0;
// Can only be called on data bit error, else exception.
virtual uint32_t getDataBit() const = 0;
virtual bool isCheckBitError() const = 0;
// Can only be called on check bit error, else exception.
virtual uint32_t getCheckBit() const = 0;
virtual bool isMultipleBitError() const = 0;
bool isUncorrectableError() const
return isDoubleBitError() || isMultipleBitError();
// Used to calculate the most significant bit of a syndrome
// as the parity of the data and check bits. Returns the
static uint32_t maskedSyndrome(uint32_t syndrome
, uint64_t data
,
uint32_t ecc
, uint32_t MSBShift
)
syndrome
%= (1<<MSBShift
);
uint32_t parity
= BL_BitUtility::calc_parity(data
^ ecc
);
return syndrome
| (parity
<<MSBShift
);