Update field types for Chip Data Files
Change-Id: I5cc76401f97121a1fa4f9cb669d7241113075d8b
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/src/hei_signature.hpp b/src/hei_signature.hpp
index 4f824db..d4b40f4 100644
--- a/src/hei_signature.hpp
+++ b/src/hei_signature.hpp
@@ -25,9 +25,8 @@
* @param i_bit The target bit within this register.
* @param i_attnType The attention type reported by this bit.
*/
- Signature(const Chip& i_chip, RegisterId_t i_id,
- RegisterInstance_t i_instance, RegisterBit_t i_bit,
- AttentionType_t i_attnType) :
+ Signature(const Chip& i_chip, RegisterId_t i_id, Instance_t i_instance,
+ BitPosition_t i_bit, AttentionType_t i_attnType) :
iv_chip(i_chip),
iv_id(i_id), iv_instance(i_instance), iv_bit(i_bit),
iv_attnType(i_attnType)
@@ -43,11 +42,11 @@
Signature& operator=(const Signature&) = default;
private:
- Chip iv_chip; ///< Chip containing this register.
- RegisterId_t iv_id; ///< Register ID.
- RegisterInstance_t iv_instance; ///< Instance of this register.
- RegisterBit_t iv_bit; ///< Target bit within this register.
- AttentionType_t iv_attnType; ///< Attention type reported by this bit.
+ Chip iv_chip; ///< Chip containing this register.
+ RegisterId_t iv_id; ///< Register ID.
+ Instance_t iv_instance; ///< Instance of this register.
+ BitPosition_t iv_bit; ///< Target bit within this register.
+ AttentionType_t iv_attnType; ///< Attention type reported by this bit.
public: // Member functions
/** @return The chip containing this register. */
@@ -63,13 +62,13 @@
}
/** @return The instance of this register. */
- RegisterInstance_t getInstance() const
+ Instance_t getInstance() const
{
return iv_instance;
}
/** @return The target bit within this register. */
- RegisterBit_t getBit() const
+ BitPosition_t getBit() const
{
return iv_bit;
}
diff --git a/src/hei_types.hpp b/src/hei_types.hpp
index 7cb853a..13bc72f 100644
--- a/src/hei_types.hpp
+++ b/src/hei_types.hpp
@@ -25,7 +25,7 @@
* both the Chip Data Files and the input into the isolation function.
*
* Range:
- * A 4-byte field should be sufficient.
+ * This is defined as a 4-byte field in the Chip Data Files.
*/
using ChipType_t = uint32_t;
@@ -39,68 +39,58 @@
* The supported register types are listed in this enum.
*
* Range:
- * Power Systems only have a couple different types that would be accessed by
- * the isolator. The minimum 1-byte field should be sufficient.
+ * This is defined as the minimum 1-byte field in the Chip Data Files.
*/
enum RegisterType_t : uint8_t
{
- REG_TYPE_INVALID = 0, ///< invalid/unsupported type
- REG_TYPE_SCOM = 1, ///< Power Systems SCOM register.
- REG_TYPE_ID_SCOM = 2, ///< Power Systems Indirect SCOM register.
+ REG_TYPE_SCOM = 0x01, ///< Power Systems SCOM register.
+ REG_TYPE_ID_SCOM = 0x02, ///< Power Systems Indirect SCOM register.
};
/**
* Each register within a chip must have a unique ID. These IDs (combined with
* other information) will be passed back to the user application to identify
- * all of the active errors reported by this chip. Note that some registers will
- * have multiple instances within a chip. An ID will be used for all instances
- * of a register. See enum RegisterInstance_t for details on the register
- * instance value.
+ * register contents captured for debugging purposes. Note that some registers
+ * will have multiple instances within a chip. An ID will be used for all
+ * instances of a register. See Instance_t for details on the register instance
+ * value.
*
* Values:
* The isolator does not need to know the possible values because the values
- * are passed from the Chip Data Files to the user application. Therefore, no
- * values will be listed in this enum except for the default invalid type.
+ * are passed from the Chip Data Files to the user application.
*
* Range:
- * A 2-byte field should be sufficient to support up to 65535 registers on a
- * chip.
+ * This is defined as a 3-byte field in the Chip Data Files, which should be
+ * sufficient to support all the registers on a typical chip.
*/
-enum RegisterId_t : uint16_t
-{
- REG_ID_INVALID = 0, ///< invalid/unsupported type
-};
+using RegisterId_t = uint32_t; // IMPORTANT: see range note above.
/**
- * A chip could contain more than one instance of a register. For example, a
- * register could exist for each instance of a core on a processor chip.
- * This field will be used to differeniate multiple instances of a register in
- * order to avoid repeating common information for every instance.
+ * A chip could contain more than one instance of a register or node. For
+ * example, a register could exist for each instance of a core on a processor
+ * chip. This field will be used to differeniate multiple instances of a
+ * register in order to avoid repeating common information for every instance.
*
* Values:
- * Not all registers will have multiple instances. So the default instance
- * value is 0, which always indicates the first (or only) logical instance.
- * Then a value of 1-255 can be used for each subsequent instance.
+ * Not all registers or nodes will have multiple instances. So the default
+ * instance value is 0, which always indicates the first (or only) logical
+ * instance. Then a value of 1-255 can be used for each subsequent instance.
*
* Range:
- * The 1-byte field should be sufficient.
+ * This is defined as a 1-byte field in the Chip Data Files.
*/
-enum RegisterInstance_t : uint8_t
-{
- REG_INST_DEFAULT = 0, ///< indicates the first (or only) logical instance
-};
+using Instance_t = uint8_t;
/**
- * This is used to defined a bit field for a register. It is mainly used in the
- * Signature class to indicate which bit on a register had an active attention.
+ * This is used to defined a bit field for a register or node.
*
* Values:
- * The widest supported register is only 64-bits (value 0-63).
+ * The widest supported register type is only 64-bits (value 0-63).
*
* Range:
- * Only the minimum 1-byte field is necessary.
+ * This is defined as a 1-byte field in the Chip Data Files.
*/
-typedef uint8_t RegisterBit_t;
+using BitPosition_t = uint8_t;
/**
* The hardware address of a register (right justified).
@@ -111,10 +101,7 @@
* Range:
* The maximum supported address requires an 8-byte field.
*/
-enum RegisterAddress_t : uint64_t
-{
- REG_ADDR_INVALID = 0, ///< invalid/unsupported address
-};
+using RegisterAddress_t = uint64_t;
/**
* The hardware access level of a register.
@@ -123,7 +110,7 @@
* The supported access levels are listed in this enum.
*
* Range:
- * Only the minimum 1-byte field is necessary.
+ * This is defined as a 1-byte field in the Chip Data Files.
*/
enum RegisterAccessLevel_t : uint8_t
{
@@ -143,7 +130,7 @@
* The supported attention types are listed in this enum.
*
* Range:
- * Only the minimum 1-byte field is necessary.
+ * This is defined as a 1-byte field in the Chip Data Files.
*/
enum AttentionType_t : uint8_t
{
diff --git a/src/isolator/hei_isolation_node.cpp b/src/isolator/hei_isolation_node.cpp
index e2bf61a..f5c58db 100644
--- a/src/isolator/hei_isolation_node.cpp
+++ b/src/isolator/hei_isolation_node.cpp
@@ -21,10 +21,10 @@
const BitString* bs = rule_itr->second->getBitString(i_chip);
// Ensure this BitString is not longer than the maximum bit field.
- HEI_ASSERT(bs->getBitLen() <= (1 << (sizeof(RegisterBit_t) * 8)));
+ HEI_ASSERT(bs->getBitLen() <= (1 << (sizeof(BitPosition_t) * 8)));
// Find all active bits for this rule.
- for (RegisterBit_t bit = 0; bit < bs->getBitLen(); bit++)
+ for (BitPosition_t bit = 0; bit < bs->getBitLen(); bit++)
{
// Continue to the next bit if not active.
if (!bs->isBitSet(bit))
diff --git a/src/isolator/hei_isolation_node.hpp b/src/isolator/hei_isolation_node.hpp
index eedde91..782ac7f 100644
--- a/src/isolator/hei_isolation_node.hpp
+++ b/src/isolator/hei_isolation_node.hpp
@@ -89,7 +89,7 @@
* Each bit (key) in this map indicates that an attention was driven from
* another register (value).
*/
- std::map<RegisterBit_t, const IsolationNode*> iv_children;
+ std::map<BitPosition_t, const IsolationNode*> iv_children;
public: // Member functions
/**
@@ -136,7 +136,7 @@
* @param The target bit on this register.
* @param The child register to analyze for the given bit.
*/
- void addChild(RegisterBit_t i_bit, const IsolationNode* i_child);
+ void addChild(BitPosition_t i_bit, const IsolationNode* i_child);
public: // Operators
/** @brief Equals operator. */
diff --git a/src/register/hei_hardware_register.hpp b/src/register/hei_hardware_register.hpp
index 40e0f82..81fb79b 100644
--- a/src/register/hei_hardware_register.hpp
+++ b/src/register/hei_hardware_register.hpp
@@ -49,7 +49,7 @@
* @param i_accessLevel Hardware access level for this register.
*/
HardwareRegister(ChipType_t i_chipType, RegisterId_t i_id,
- RegisterInstance_t i_instance,
+ Instance_t i_instance,
RegisterAccessLevel_t i_accessLevel) :
Register(),
iv_chipType(i_chipType), iv_id(i_id), iv_instance(i_instance),
@@ -66,7 +66,7 @@
/** A register may have multiple instances. All of which will have the same
* ID. This variable is used to distinguish between each instance of the
* register. */
- const RegisterInstance_t iv_instance;
+ const Instance_t iv_instance;
/** The hardware access level of this register (read/write, read-only,
* write-only, etc.). */
@@ -86,7 +86,7 @@
}
/* @return The instance of this register. */
- RegisterInstance_t getInstance() const
+ Instance_t getInstance() const
{
return iv_instance;
}
diff --git a/src/register/hei_scom_register.hpp b/src/register/hei_scom_register.hpp
index 3723a58..b93674a 100644
--- a/src/register/hei_scom_register.hpp
+++ b/src/register/hei_scom_register.hpp
@@ -25,8 +25,8 @@
* @param i_address A 4-byte address for this SCOM register.
*/
ScomRegister(ChipType_t i_chipType, RegisterId_t i_id,
- RegisterInstance_t i_instance,
- RegisterAccessLevel_t i_accessLevel, uint32_t i_address) :
+ Instance_t i_instance, RegisterAccessLevel_t i_accessLevel,
+ uint32_t i_address) :
HardwareRegister(i_chipType, i_id, i_instance, i_accessLevel),
iv_address(i_address)
{}
@@ -106,8 +106,8 @@
* @param i_address An 8-byte address for this Indirect SCOM register.
*/
IdScomRegister(ChipType_t i_chipType, RegisterId_t i_id,
- RegisterInstance_t i_instance,
- RegisterAccessLevel_t i_accessLevel, uint64_t i_address) :
+ Instance_t i_instance, RegisterAccessLevel_t i_accessLevel,
+ uint64_t i_address) :
HardwareRegister(i_chipType, i_id, i_instance, i_accessLevel),
iv_address(i_address)
{}
diff --git a/test/simulator/simulator.hpp b/test/simulator/simulator.hpp
index ccb998a..0a22911 100644
--- a/test/simulator/simulator.hpp
+++ b/test/simulator/simulator.hpp
@@ -221,8 +221,8 @@
#define EXP_SIG(CHIP, ID, INST, BIT, TYPE) \
simData.addSignature(libhei::Signature{ \
CHIP, static_cast<libhei::RegisterId_t>(ID), \
- static_cast<libhei::RegisterInstance_t>(INST), \
- static_cast<libhei::RegisterBit_t>(BIT), libhei::ATTN_TYPE_##TYPE});
+ static_cast<libhei::Instance_t>(INST), \
+ static_cast<libhei::BitPosition_t>(BIT), libhei::ATTN_TYPE_##TYPE});
/**
* This is the end of an iteration that began with START_ITERATION. All of the