summaryrefslogtreecommitdiffstats
path: root/src/usr/diag
diff options
context:
space:
mode:
authorZane Shelley <zshelle@us.ibm.com>2017-01-31 16:32:29 -0600
committerZane C. Shelley <zshelle@us.ibm.com>2017-02-13 12:57:59 -0500
commit3192051cd7b428aa85469525ce1595ab669332fe (patch)
treeaf44715961dee8846358a0ae435a3d431c2097b0 /src/usr/diag
parent6553e4a7f5008da02255b489f4ddc7c8e4d9fd1c (diff)
downloadtalos-hostboot-3192051cd7b428aa85469525ce1595ab669332fe.tar.gz
talos-hostboot-3192051cd7b428aa85469525ce1595ab669332fe.zip
PRD: clean various BitString functions
Change-Id: Id10ac2c18792336103b3d132c263fab87904b925 RTC: 167819 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35693 Reviewed-by: Benjamin J. Weisenbeck <bweisenb@us.ibm.com> Reviewed-by: Caleb N. Palmer <cnpalmer@us.ibm.com> Reviewed-by: Brian J. Stegmiller <bjs@us.ibm.com> Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Tested-by: Zane C. Shelley <zshelle@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36318 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Diffstat (limited to 'src/usr/diag')
-rwxr-xr-xsrc/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h4
-rwxr-xr-xsrc/usr/diag/prdf/common/framework/register/iipscr.C4
-rwxr-xr-xsrc/usr/diag/prdf/common/framework/register/iipscr.h10
-rwxr-xr-xsrc/usr/diag/prdf/common/framework/register/prdfCaptureData.C2
-rwxr-xr-xsrc/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H4
-rwxr-xr-xsrc/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C2
-rwxr-xr-xsrc/usr/diag/prdf/common/framework/register/prdfResetOperators.H2
-rw-r--r--src/usr/diag/prdf/common/plat/p9/prdfP9ProcDomain.C16
-rw-r--r--src/usr/diag/prdf/common/plat/pegasus/prdfLaneRepair.C10
-rw-r--r--src/usr/diag/prdf/common/rule/prdfRuleMetaData.C2
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfBitKey.C14
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfBitString.C160
-rwxr-xr-xsrc/usr/diag/prdf/common/util/prdfBitString.H100
-rw-r--r--src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H2
14 files changed, 113 insertions, 219 deletions
diff --git a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h
index e74bdb6e3..9d615f18a 100755
--- a/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h
+++ b/src/usr/diag/prdf/common/framework/register/iipErrorRegisterMask.h
@@ -134,7 +134,7 @@ public:
<br><b>Parameters: </b> bit position
<br><b>Returns: </b> None.
<br><b>Requirements:</b> None.
- <br><b>Promises: </b> bitStringMask.IsSet(bitPosition) == true.
+ <br><b>Promises: </b> bitStringMask.isBitSet(bitPosition) == true.
<br><b>Exceptions: </b> None.
<br><b>Notes: </b> The bitstring read from hardware during Read()
@@ -215,7 +215,7 @@ private: // Data
};
inline void ErrorRegisterMask::SetMaskBit(uint32_t bitPosition)
-{ bitStringMask.Set(bitPosition); }
+{ bitStringMask.setBit(bitPosition); }
inline void ErrorRegisterMask::SetMaskBits(const BIT_STRING_CLASS & bitString)
{ bitStringMask.setString(bitString); }
diff --git a/src/usr/diag/prdf/common/framework/register/iipscr.C b/src/usr/diag/prdf/common/framework/register/iipscr.C
index 30537d131..e8eda7881 100755
--- a/src/usr/diag/prdf/common/framework/register/iipscr.C
+++ b/src/usr/diag/prdf/common/framework/register/iipscr.C
@@ -150,7 +150,7 @@ void SCAN_COMM_REGISTER_CLASS::SetBit
{
BIT_STRING_CLASS & bitString = AccessBitString();
- bitString.Set(bit_position);
+ bitString.setBit(bit_position);
}
// Function Specification //////////////////////////////////////////
@@ -176,7 +176,7 @@ void SCAN_COMM_REGISTER_CLASS::ClearBit
/*!o No value returned */
{
BIT_STRING_CLASS & bitString = AccessBitString();
- bitString.Clear(bit_position);
+ bitString.clearBit(bit_position);
}
diff --git a/src/usr/diag/prdf/common/framework/register/iipscr.h b/src/usr/diag/prdf/common/framework/register/iipscr.h
index a51920aca..0eaf3e9ba 100755
--- a/src/usr/diag/prdf/common/framework/register/iipscr.h
+++ b/src/usr/diag/prdf/common/framework/register/iipscr.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2015 */
+/* Contributors Listed Below - COPYRIGHT 2012,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -308,7 +308,7 @@ class SCAN_COMM_REGISTER_CLASS
<br><b>Parameters: </b> Position of bit to set (= 1)
<br><b>Returns: </b> None.
<br><b>Requirements:</b> bit position < GetBitString()->Length()
- <br><b>Promises: </b> GetBitString()->IsSet(bit_position) == true
+ <br><b>Promises: </b> GetBitString()->isBitSet(bit_position) == true
<br><b>Exceptions: </b> None.
<br><b> Notes: </b> Register value is not reflected in hardware until
Write() is called
@@ -322,7 +322,7 @@ class SCAN_COMM_REGISTER_CLASS
<br><b>Parameters: </b> Position of bit to clear (= 0)
<br><b>Returns: </b> None.
<br><b>Requirements:</b> bit position < GetBitString()->Length()
- <br><b>Promises: </b> GetBitString()->IsSet(bit_position) == false
+ <br><b>Promises: </b> GetBitString()->isBitSet(bit_position) == false
<br><b>Exceptions: </b> None.
<br><b> Notes: </b> Register value is not reflected in hardware until
Write() is called
@@ -337,7 +337,7 @@ class SCAN_COMM_REGISTER_CLASS
* @return TRUE if the bit is set, FALSE otherwise.
*/
bool IsBitSet( uint32_t i_bitPos )
- { return GetBitString()->IsSet(i_bitPos); }
+ { return GetBitString()->isBitSet(i_bitPos); }
/** @brief Flushes all bits to 0. */
void clearAllBits();
@@ -375,7 +375,7 @@ class SCAN_COMM_REGISTER_CLASS
</ul><br>
*/
bool BitStringIsZero()
- { return GetBitString()->IsZero(); }
+ { return GetBitString()->isZero(); }
/**
*@brief Returns TYPE_NA as type of Target associated with register.Actual
diff --git a/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C b/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C
index bec75cd9c..4990e2323 100755
--- a/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C
+++ b/src/usr/diag/prdf/common/framework/register/prdfCaptureData.C
@@ -87,7 +87,7 @@ void CaptureData::AddDataElement( TargetHandle_t i_trgt, int i_scomId,
size_t sz_buf = 0;
// Add buffer only if the value is non-zero.
- if ( !i_bs->IsZero() )
+ if ( !i_bs->isZero() )
{
// Get the size of i_bs and ensure byte alignment.
sz_buf = (i_bs->getBitLen() + 8-1) / 8;
diff --git a/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H
index 093205985..edfc46a30 100755
--- a/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H
+++ b/src/usr/diag/prdf/common/framework/register/prdfOperatorRegister.H
@@ -127,9 +127,9 @@ class SummaryRegister : public SCAN_COMM_REGISTER_CLASS
PRDF::BitString tmp = *iv_child->GetBitString(i_type);
//if any bits are set in iv_child, then set the iv_amount bit
- if (0 != tmp.GetSetCount())
+ if (0 != tmp.getSetCount())
{
- iv_bs->Set(0);
+ iv_bs->setBit(0);
*iv_bs = *iv_bs >> iv_amount;
}
return iv_bs;
diff --git a/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C b/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C
index 2c50bdda8..7a35fd39a 100755
--- a/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C
+++ b/src/usr/diag/prdf/common/framework/register/prdfResetErrorRegister.C
@@ -194,7 +194,7 @@ int32_t AndResetErrorRegister::Reset(const BitKey & bit_list,
uint32_t i;
for(i = 0; i < bl_length; ++i) // Turn off all bits used to isolate problem
{
- bs.Clear(bit_list.getListValue(i));
+ bs.clearBit(bit_list.getListValue(i));
}
xAndResetScr.SetBitString(&bs); // copy bs to SCR bit string
rc = xAndResetScr.Write(); // Write hardware (result = Hareware value ANDed with bs)
diff --git a/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H b/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H
index d31ad9556..3b8fafa80 100755
--- a/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H
+++ b/src/usr/diag/prdf/common/framework/register/prdfResetOperators.H
@@ -193,7 +193,7 @@ class AndOperator : public RegisterResetOperator
uint32_t i;
for(i = 0; i < bl_length; ++i) // Turn off all bits specified
{
- bs.Clear(bl.getListValue(i));
+ bs.clearBit(bl.getListValue(i));
}
writeReg->SetBitString(&bs); // Copy bit-string to register.
rc = writeReg->Write(); // Write hardware
diff --git a/src/usr/diag/prdf/common/plat/p9/prdfP9ProcDomain.C b/src/usr/diag/prdf/common/plat/p9/prdfP9ProcDomain.C
index 1b4be2591..3bebe36ed 100644
--- a/src/usr/diag/prdf/common/plat/p9/prdfP9ProcDomain.C
+++ b/src/usr/diag/prdf/common/plat/p9/prdfP9ProcDomain.C
@@ -185,7 +185,7 @@ void ProcDomain::SortForXstop()
{
for (uint32_t k = 0; k < GetSize(); k++)
if ((*j) == LookUp(k)->GetChipHandle())
- l_externalChips.Set(k);
+ l_externalChips.setBit(k);
};
// Check if is internal.
@@ -221,29 +221,29 @@ void ProcDomain::SortForXstop()
BIT_STRING_BUFFER_CLASS l_prev(GetSize());
l_prev.clearAll();
- while ((!(l_current == l_prev)) && (!l_current.IsZero()))
+ while ((!(l_current == l_prev)) && (!l_current.isZero()))
{
l_prev = l_current;
l_current.clearAll();
for (uint32_t i = 0; i < GetSize(); i++)
{
- if (l_prev.IsSet(i)) // skip if this chip isn't in the pool.
+ if (l_prev.isBitSet(i)) // skip if this chip isn't in the pool.
for (uint32_t j = 0; j < GetSize(); j++)
{
ptr.u = &l_externalDrivers[i]; // zs01
- if ( BitString(GetSize(), ptr.c).IsSet(j) )
- l_current.Set(j);
+ if ( BitString(GetSize(), ptr.c).isBitSet(j) )
+ l_current.setBit(j);
}
}
}
// Hopefully, we got just one chip left...
- if (1 == l_prev.GetSetCount())
+ if (1 == l_prev.getSetCount())
{
// Now find it.
for (uint32_t i = 0; i < GetSize(); i++)
- if ((l_prev.IsSet(i)) &&
+ if ((l_prev.isBitSet(i)) &&
(l_internalCS[i] || (0 == l_internalOnlyCount)))
{
MoveToFront(i);
@@ -421,7 +421,7 @@ int32_t ProcDomain::OrderTheseChips(ATTENTION_TYPE attentionType,
{
for (uint32_t k = 0; k < i_chips.size(); k++)
if ((*j) == LookUp(k)->GetChipHandle())
- l_externalChips.Set(k);
+ l_externalChips.setBit(k);
};
// Check if is internal.
diff --git a/src/usr/diag/prdf/common/plat/pegasus/prdfLaneRepair.C b/src/usr/diag/prdf/common/plat/pegasus/prdfLaneRepair.C
index a3d19b576..1d9ff4822 100644
--- a/src/usr/diag/prdf/common/plat/pegasus/prdfLaneRepair.C
+++ b/src/usr/diag/prdf/common/plat/pegasus/prdfLaneRepair.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2015 */
+/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -111,9 +111,9 @@ int32_t handleLaneRepairEvent( ExtensibleChip * i_chip,
PRDF_INF( PRDF_FUNC "New failed lane on RX HUID 0x%08x: %d",
getHuid(rxBusTgt), *lane);
if (*lane < 64)
- l_newLaneMap0to63.Set(*lane);
+ l_newLaneMap0to63.setBit(*lane);
else if (*lane < 127)
- l_newLaneMap64to127.Set(*lane - 64);
+ l_newLaneMap64to127.setBit(*lane - 64);
else
{
PRDF_ERR( PRDF_FUNC "Invalid lane number %d: rxBusTgt=0x%08x",
@@ -153,9 +153,9 @@ int32_t handleLaneRepairEvent( ExtensibleChip * i_chip,
lane != rx_vpdLanes.end(); ++lane)
{
if (*lane < 64)
- l_vpdLaneMap0to63.Set(*lane);
+ l_vpdLaneMap0to63.setBit(*lane);
else if (*lane < 127)
- l_vpdLaneMap64to127.Set(*lane - 64);
+ l_vpdLaneMap64to127.setBit(*lane - 64);
else
{
PRDF_ERR( PRDF_FUNC "Invalid VPD lane number %d: "
diff --git a/src/usr/diag/prdf/common/rule/prdfRuleMetaData.C b/src/usr/diag/prdf/common/rule/prdfRuleMetaData.C
index fc7843189..5f35f0415 100644
--- a/src/usr/diag/prdf/common/rule/prdfRuleMetaData.C
+++ b/src/usr/diag/prdf/common/rule/prdfRuleMetaData.C
@@ -569,7 +569,7 @@ int32_t RuleMetaData::CaptureErrorData( CaptureData & io_cap,
{
const BIT_STRING_CLASS *l_bitStringPtr =
l_primReg->GetBitString();
- if(l_bitStringPtr->IsZero())
+ if(l_bitStringPtr->isZero())
{
//skip capture data if corresponding primary FIR is
//zero.
diff --git a/src/usr/diag/prdf/common/util/prdfBitKey.C b/src/usr/diag/prdf/common/util/prdfBitKey.C
index 79f648572..ab9f36fbc 100755
--- a/src/usr/diag/prdf/common/util/prdfBitKey.C
+++ b/src/usr/diag/prdf/common/util/prdfBitKey.C
@@ -274,7 +274,7 @@ uint32_t BitKey::getListValue(uint32_t n) const
BitString bs(iv_Capacity,(CPU_WORD *)cDataPtr());
for(uint32_t i = 0; i < iv_Capacity; ++i)
{
- if(bs.IsSet(i)) ++setCount;
+ if(bs.isBitSet(i)) ++setCount;
if(setCount == n)
{
bitPos = i;
@@ -289,7 +289,7 @@ uint32_t BitKey::getListValue(uint32_t n) const
uint32_t BitKey::size(void) const
{
const BitString bs(iv_Capacity,(CPU_WORD *)cDataPtr());
- return bs.GetSetCount();
+ return bs.getSetCount();
}
//------------------------------------------------------------------------------
@@ -299,7 +299,7 @@ void BitKey::removeBit(uint32_t n)
if(n < size())
{
BitString bs(iv_Capacity,DataPtr());
- bs.Clear(getListValue(n));
+ bs.clearBit(getListValue(n));
}
}
@@ -312,9 +312,9 @@ void BitKey::removeBit(void)
while(i != 0)
{
--i;
- if(bs.IsSet(i))
+ if(bs.isBitSet(i))
{
- bs.Clear(i);
+ bs.clearBit(i);
break;
}
}
@@ -338,7 +338,7 @@ void BitKey::setBit(uint32_t i_bitValue)
ReAllocate(i_bitValue+1);
}
BitString bs(iv_Capacity,DataPtr());
- bs.Set(i_bitValue);
+ bs.setBit(i_bitValue);
}
//------------------------------------------------------------------------------
@@ -362,7 +362,7 @@ void BitKey::ReAllocate(uint32_t i_len)
BitString dbs(iv_Capacity,newBuffer);
dbs.clearAll();
BitString sbs(oldSize,oldPtr);
- if ( !sbs.IsZero() ) dbs.setString(sbs);
+ if ( !sbs.isZero() ) dbs.setString(sbs);
iv_storage1 = 0;
if(!wasDirect) // from indirect
{
diff --git a/src/usr/diag/prdf/common/util/prdfBitString.C b/src/usr/diag/prdf/common/util/prdfBitString.C
index 9420c3277..51b4ffe22 100755
--- a/src/usr/diag/prdf/common/util/prdfBitString.C
+++ b/src/usr/diag/prdf/common/util/prdfBitString.C
@@ -221,151 +221,53 @@ void BitString::maskString( const BitString & i_mask )
//------------------------------------------------------------------------------
-uint32_t BitString::GetSetCount(uint32_t bit_position,
- uint32_t leng
- ) const
+bool BitString::isEqual( const BitString & i_str ) const
{
- uint32_t end_position = bit_position + leng;
-
- PRDF_ASSERT(end_position <= iv_bitLen);
-
- uint32_t count = 0;
+ if ( getBitLen() != i_str.getBitLen() )
+ return false; // size not equal
- while(bit_position < end_position)
- {
- if(IsSet(bit_position))
+ for ( uint32_t pos = 0; pos < getBitLen(); pos += CPU_WORD_BIT_LEN )
{
- count++;
- }
-
- bit_position++;
- }
-
- return(count);
-}
+ uint32_t len = std::min( getBitLen() - pos, CPU_WORD_BIT_LEN );
-// Function Specification //////////////////////////////////////////
-//
-// Title: Is Set
-//
-// Purpose: This function determines if the specified bit position
-// in the string is set(1).
-//
-// Side-effects: None.
-//
-// Dependencies: bit_position must be in the string
-//
-// End Function Specification //////////////////////////////////////
+ if ( getField(pos, len) != i_str.getField(pos, len) )
+ return false; // bit strings do not match
+ }
-bool BitString::IsSet
-(
- uint32_t bit_position
- ) const
-{
- return (getField(bit_position,1) != 0);
+ return true; // bit strings match
}
-// Function Specification //////////////////////////////////////////////
-//
-// Title: Set
-//
-// Purpose: This function sets(1) the specified bit position in
-// the string.
-//
-// Side-effects: Bit String may be modified.
-//
-// Dependencies: bit_position must be in the string
-//
-// End Function Specification //////////////////////////////////////////
+//------------------------------------------------------------------------------
-void BitString::Set
-(
- uint32_t bit_position
- )
+bool BitString::isZero() const
{
- setField(bit_position,1,CPU_WORD_MASK);
-}
+ for ( uint32_t pos = 0; pos < getBitLen(); pos += CPU_WORD_BIT_LEN )
+ {
+ uint32_t len = std::min( getBitLen() - pos, CPU_WORD_BIT_LEN );
-// Function Specification //////////////////////////////////////////////
-//
-// Title: Clear
-//
-// Purpose: This function clears(0) the specified bit position in
-// the string.
-//
-// Side-effects: Bit String may be modified.
-//
-// Dependencies: bit_position must be in the string
-//
-// End Function Specification //////////////////////////////////////////
+ if ( 0 != getField(pos, len) )
+ return false; // something is non-zero
+ }
-void BitString::Clear
-(
- uint32_t bit_position
- )
-{
- setField(bit_position,1,0);
+ return true; // everything was zero
}
-// Function Specification //////////////////////////////////////////
-//
-// Title: Is Equal
-//
-// Purpose: This function compares the values of the Bit String
-// memory for each bit position in the string. If the
-// Bit String lengths do not match, then the Bit Strings
-// are not equal.
-//
-// Side-effects: None.
-//
-// Dependencies: None.
-//
-// Time Complexity: O(m) where m is the length
-//
-// End Function Specification //////////////////////////////////////
+//------------------------------------------------------------------------------
-bool BitString::IsEqual( const BitString & i_string ) const
+uint32_t BitString::getSetCount( uint32_t i_pos, uint32_t i_len ) const
{
- if ( iv_bitLen != i_string.iv_bitLen )
- return false; // size not equal
-
- for ( uint32_t pos = 0; pos < iv_bitLen; pos += CPU_WORD_BIT_LEN )
- {
- uint32_t len = std::min( iv_bitLen - pos, (uint32_t)CPU_WORD_BIT_LEN );
-
- if ( getField(pos, len) != i_string.getField(pos, len) )
- return false; // bit strings do not match
- }
+ uint32_t endPos = i_pos + i_len;
- return true; // bit strings match
-}
+ PRDF_ASSERT( endPos <= getBitLen() );
-// Function Specification //////////////////////////////////////////
-//
-// Title: Is Zero
-//
-// Purpose: This function compares the values of the Bit String
-// with zero.
-//
-// Side-effects: None.
-//
-// Dependencies: None.
-//
-// Time Complexity: O(m) where m is the length
-//
-// End Function Specification //////////////////////////////////////
+ uint32_t count = 0;
-bool BitString::IsZero() const
-{
- for ( uint32_t pos = 0; pos < iv_bitLen; pos += CPU_WORD_BIT_LEN )
+ for ( uint32_t i = i_pos; i < endPos; i++ )
{
- uint32_t len = std::min( iv_bitLen - pos, (uint32_t)CPU_WORD_BIT_LEN );
-
- if ( 0 != getField(pos, len) )
- return false; // something is non-zero
+ if ( isBitSet(i) ) count++;
}
- return true; // everything was zero
+ return count;
}
//-------------------------------------------------------------------------------------------------
@@ -503,7 +405,7 @@ BitStringBuffer::BitStringBuffer( const BitString & i_bs ) :
BitString( i_bs.getBitLen(), nullptr )
{
initBuffer();
- if ( !i_bs.IsZero() ) setString( i_bs );
+ if ( !i_bs.isZero() ) setString( i_bs );
}
//------------------------------------------------------------------------------
@@ -512,7 +414,7 @@ BitStringBuffer::BitStringBuffer( const BitStringBuffer & i_bsb ) :
BitString( i_bsb.getBitLen(), nullptr )
{
initBuffer();
- if ( !i_bsb.IsZero() ) setString( i_bsb );
+ if ( !i_bsb.isZero() ) setString( i_bsb );
}
//------------------------------------------------------------------------------
@@ -521,7 +423,7 @@ BitStringBuffer & BitStringBuffer::operator=( const BitString & i_bs )
{
setBitLen( i_bs.getBitLen() );
initBuffer();
- if ( !i_bs.IsZero() ) setString( i_bs );
+ if ( !i_bs.isZero() ) setString( i_bs );
return *this;
}
@@ -534,7 +436,7 @@ BitStringBuffer & BitStringBuffer::operator=( const BitStringBuffer & i_bsb )
{
setBitLen( i_bsb.getBitLen() );
initBuffer();
- if ( !i_bsb.IsZero() ) setString( i_bsb );
+ if ( !i_bsb.isZero() ) setString( i_bsb );
}
return *this;
@@ -551,7 +453,7 @@ void BitStringBuffer::initBuffer()
setBufAddr( new CPU_WORD[ getNumCpuWords(getBitLen()) ] );
// Clear the new buffer.
- if ( !IsZero() ) clearAll();
+ if ( !isZero() ) clearAll();
}
/*--------------------------------------------------------------------*/
diff --git a/src/usr/diag/prdf/common/util/prdfBitString.H b/src/usr/diag/prdf/common/util/prdfBitString.H
index 9c82b2384..061486717 100755
--- a/src/usr/diag/prdf/common/util/prdfBitString.H
+++ b/src/usr/diag/prdf/common/util/prdfBitString.H
@@ -199,9 +199,30 @@ class BitString
setField( i_pos, i_len, i_val << (CPU_WORD_BIT_LEN - i_len) );
}
+ /**
+ * @param i_pos The target position.
+ * @return True if the bit at the given position is set(1), false otherwise.
+ * @pre i_pos < getBitLen().
+ */
+ bool isBitSet( uint32_t i_pos ) const { return 0 != getField(i_pos, 1); }
+
+ /**
+ * @brief Sets the target position to 1.
+ * @param i_pos The target position.
+ * @pre i_pos < getBitLen().
+ */
+ void setBit( uint32_t i_pos ) { setFieldJustify( i_pos, 1, 1 ); }
+
/** @brief Sets the entire bit string to 1's. */
void setAll() { setPattern(CPU_WORD_MASK); }
+ /**
+ * @brief Sets the target position to 0.
+ * @param i_pos The target position.
+ * @pre i_pos < getBitLen().
+ */
+ void clearBit( uint32_t i_pos ) { setFieldJustify( i_pos, 1, 0 ); }
+
/** @brief Sets the entire bit string to 0's. */
void clearAll() { setPattern(0); }
@@ -300,64 +321,40 @@ class BitString
*/
void maskString( const BitString & i_mask );
+ /**
+ * @param i_str The string to compare.
+ * @return True if the strings are equivalent, false otherwise.
+ * @pre Both strings must be of equal length and have same values to be
+ * equal.
+ */
+ bool isEqual( const BitString & i_str ) const;
+
+ /** @return True if there are no bit set(1) in this bit string, false
+ * otherwise. */
+ bool isZero() const;
+
+ /**
+ * @param i_pos The starting position of the target range.
+ * @param i_len The length of the target range.
+ * @return The number of bits that are set(1) in given range of this string.
+ * @pre nullptr != getBufAddr()
+ * @pre i_pos + i_len <= getBitLen()
+ */
+ uint32_t getSetCount( uint32_t i_pos, uint32_t i_len ) const;
+
+ /** @return The number of bits that are set(1) in this string. */
+ uint32_t getSetCount() const { return getSetCount( 0, getBitLen() ); }
+
/*!
Comparison
\remarks The bitstrings must be the same length and have the same bits set to be equal
*/
int operator==(const BitString & string) const
{
- return(IsEqual(string));
+ return(isEqual(string));
}
/*!
- Get the number of bits that are set ("1")
- */
- uint32_t GetSetCount(void) const;
-
- /*!
- Get the number of bits that are set ("1") in a specific range
- \param starting bit position
- \param # of bits in the range
- \pre bit_position + leng <= getBitLen();
- \post none
- */
- uint32_t GetSetCount(uint32_t bit_position, uint32_t leng) const;
-
- /*!
- Query if bit is set (1)
- \returns [true|false]
- \param iPos: bit position to test
- */
- bool IsSet(uint32_t iPos) const;
-
- /*!
- Set a bit (1) at the specified position
- \param iPos: bit position to test
- \post IsSet(iPos) == true
- */
- void Set( uint32_t iPos);
-
- /*!
- Clear or ReSet a bit (0) at the specified position
- \param iPos: bit position to clear
- \post IsSet(iPos) == false
- */
- void Clear(uint32_t bit_position);
-
- /*!
- Test equivalence
- \returns [true | false]
- \notes Both strings must be of equal length and have same values to be equal
- */
- bool IsEqual( const BitString & string) const;
-
- /*!
- Query state of no bits set(1)
- \returns [true | false]
- */
- bool IsZero(void) const;
-
- /*!
bitwise NOT
\returns a bit-wise inverted copy of the specified bit string
*/
@@ -513,11 +510,6 @@ BitString & BitString::operator=
return(*this);
}
-inline uint32_t BitString::GetSetCount(void) const
-{
- return(GetSetCount(0, getBitLen()));
-}
-
} // end namespace PRDF
#endif
diff --git a/src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H b/src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H
index e1c04c709..4e337e14c 100644
--- a/src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H
+++ b/src/usr/diag/prdf/test/prdfTest_ScomAccessInterface.H
@@ -88,7 +88,7 @@ public:
}
//spare bit in OCC fir
- bs.Set(61);
+ bs.setBit(61);
rc = PRDF::PlatServices::putScom(target, bs, address);
OpenPOWER on IntegriCloud