Ensure simulator does not re-initialize same chip type

Change-Id: I4bf3dd45ca30a977dd629acf8e4654c5385fac30
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
diff --git a/src/hei_chip.hpp b/src/hei_chip.hpp
index 3b17164..20b0b8c 100644
--- a/src/hei_chip.hpp
+++ b/src/hei_chip.hpp
@@ -12,14 +12,6 @@
 class Chip
 {
   public: // Constructors, destructors, assignment, etc.
-    Chip() = default;
-
-    ~Chip() = default;
-
-    Chip(const Chip&) = default;
-
-    Chip& operator=(const Chip&) = default;
-
     /**
      * @brief Constructor.
      * @param i_chip See description for iv_chip.
@@ -29,6 +21,12 @@
         iv_chip(i_chip), iv_type(i_type)
     {}
 
+    ~Chip() = default;
+
+    Chip(const Chip&) = default;
+
+    Chip& operator=(const Chip&) = default;
+
   public: // Accessors
     const void* getChip() const
     {
@@ -60,14 +58,14 @@
      * purpose is to eventually get passed back to the user application with
      * information associated with each chip.
      */
-    const void* iv_chip = nullptr;
+    const void* iv_chip;
 
     /**
      * When doing analysis on a chip, the isolator will need to know the chip
      * type in order to look up the correct information from the Chip Data
      * Files.
      */
-    ChipType_t iv_type = CHIP_TYPE_INVALID;
+    ChipType_t iv_type;
 
 }; // end class Chip
 
diff --git a/src/hei_types.hpp b/src/hei_types.hpp
index df3f2ff..7cb853a 100644
--- a/src/hei_types.hpp
+++ b/src/hei_types.hpp
@@ -23,16 +23,11 @@
  *   The values are determined by the chip manufacturer. The isolator does not
  *   need to know the possible values because the user application controls
  *   both the Chip Data Files and the input into the isolation function.
- *   Therefore, no values will be listed in this enum except for the default
- *   invalid type.
  *
  * Range:
  *   A 4-byte field should be sufficient.
  */
-enum ChipType_t : uint32_t
-{
-    CHIP_TYPE_INVALID = 0, ///< invalid/unsupported type
-};
+using ChipType_t = uint32_t;
 
 /**
  * Different chips will contain different types of registers. Also, a single
diff --git a/test/hei_operator_register_testcase.cpp b/test/hei_operator_register_testcase.cpp
index 803bd39..47cb53e 100644
--- a/test/hei_operator_register_testcase.cpp
+++ b/test/hei_operator_register_testcase.cpp
@@ -17,7 +17,7 @@
 int main()
 {
 
-    Chip my_chip;
+    Chip my_chip{nullptr, 0};
     size_t constant1 = CONSTANT1;
     size_t constant2 = CONSTANT2;
 
diff --git a/test/simulator/sample_test_case.cpp b/test/simulator/sample_test_case.cpp
index 7cf0c26..662720b 100644
--- a/test/simulator/sample_test_case.cpp
+++ b/test/simulator/sample_test_case.cpp
@@ -3,6 +3,7 @@
 START_TEST_CASE(SampleTestSet1)
 
 CHIP(proc0, SAMPLE)
+CHIP(proc1, SAMPLE)
 
 START_ITERATION
 
diff --git a/test/simulator/simulator.cpp b/test/simulator/simulator.cpp
index 236bfc6..3f21eef 100644
--- a/test/simulator/simulator.cpp
+++ b/test/simulator/simulator.cpp
@@ -8,7 +8,7 @@
 //------------------------------------------------------------------------------
 
 // Paths are relative from the build/ directory
-const std::map<SimulatorData::ChipType, const char*>
+const std::map<SimulatorData::SimChipType, const char*>
     SimulatorData::cv_chipPath = {
         {SAMPLE, "../test/simulator/sample_data/sample.cdb"},
 };
@@ -18,14 +18,25 @@
 void SimulatorData::addChip(const Chip& i_chip)
 {
     // First check if this entry already exists.
-    auto itr1 = std::find(iv_chipList.begin(), iv_chipList.end(), i_chip);
-    ASSERT_EQ(iv_chipList.end(), itr1);
+    auto chip_itr = std::find(iv_chipList.begin(), iv_chipList.end(), i_chip);
+    ASSERT_EQ(iv_chipList.end(), chip_itr);
 
     // Add the new entry.
     iv_chipList.push_back(i_chip);
 
+    // Check if this chip type has been initialized.
+    ChipType_t chipType = i_chip.getType();
+    auto type_itr = std::find(iv_typeList.begin(), iv_typeList.end(), chipType);
+    if (iv_typeList.end() != type_itr)
+    {
+        return; // No need to continue.
+    }
+
+    // Add the new entry.
+    iv_typeList.push_back(chipType);
+
     // Look for the file path
-    auto itr2 = cv_chipPath.find(static_cast<ChipType>(i_chip.getType()));
+    auto itr2 = cv_chipPath.find(static_cast<SimChipType>(chipType));
     ASSERT_NE(cv_chipPath.end(), itr2);
     const char* path = itr2->second;
 
diff --git a/test/simulator/simulator.hpp b/test/simulator/simulator.hpp
index e5526d8..7d25160 100644
--- a/test/simulator/simulator.hpp
+++ b/test/simulator/simulator.hpp
@@ -37,18 +37,21 @@
 
   public:
     /** The list of supported chip types for the simulator. */
-    enum ChipType
+    enum SimChipType
     {
         SAMPLE = 0xdeadbeef,
     };
 
   private:
     /** The Chip Data file paths for each support chip type. */
-    static const std::map<ChipType, const char*> cv_chipPath;
+    static const std::map<SimChipType, const char*> cv_chipPath;
 
     /** The list of configured chips used throughout a test case. */
     std::vector<Chip> iv_chipList;
 
+    /** The list of configured chip types used throughout a test case. */
+    std::vector<ChipType_t> iv_typeList;
+
     /** The contents of all the SCOM registers used for an iteration of
      *  isolation. */
     std::map<Chip, std::map<uint32_t, uint64_t>> iv_scomRegData;