Added getScomReg, getIdScomReg, & associated calls

Added getScomReg and getIdScomReg to simulator.hpp.  These lookup the
register values from a map and return the value.

In user_interface.cpp and the registerRead function, added case stanzas that
call the above functions, take care of endianness, and pass the data back
to the caller through the o_buffer and io_bufSize parameters.

Signed-off-by: Paul Greenwood <Paul.Greenwood@ibm.com>
Change-Id: Ie07e97d23a2f0a9b0073d99d8744fef91c8586a0
diff --git a/test/simulator/simulator.hpp b/test/simulator/simulator.hpp
index 9fe5c2b..29d1ef6 100644
--- a/test/simulator/simulator.hpp
+++ b/test/simulator/simulator.hpp
@@ -58,6 +58,18 @@
      */
     void addChip(const Chip& i_chip);
 
+    /** @brief Retrieve ScomReg from map and return its value */
+    uint64_t getScomReg(const Chip& i_chip, uint32_t i_address)
+    {
+        return iv_scomRegData[i_chip][i_address];
+    }
+
+    /** @breif Retrieve idScomReg from map and return its value */
+    uint64_t getIdScomReg(const Chip& i_chip, uint64_t i_address)
+    {
+        return iv_idScomRegData[i_chip][i_address];
+    }
+
     /** @brief Adds a SCOM register to iv_scomRegData. */
     void addScomReg(const Chip& i_chip, uint32_t i_address, uint64_t i_value)
     {
diff --git a/test/simulator/user_interface.cpp b/test/simulator/user_interface.cpp
index 7ed998a..2bcc2af 100644
--- a/test/simulator/user_interface.cpp
+++ b/test/simulator/user_interface.cpp
@@ -22,20 +22,29 @@
     HEI_ASSERT(nullptr != o_buffer);
     HEI_ASSERT(0 != io_bufSize);
 
+    // Get access to data through the singleton
+    SimulatorData& theSimData = SimulatorData::getSingleton();
+
     switch (i_regType)
     {
-        // BEGIN temporary code
-        // TODO: add cases for REG_TYPE_SCOM and REG_TYPE_ID_SCOM
         case REG_TYPE_SCOM:
         {
-            uint64_t x = htobe64(0x8800000000000000);
-            memcpy(o_buffer, &x, sizeof(x));
+            // Get the register value and change its endianness
+            uint64_t regValue =
+                htobe64(theSimData.getScomReg(i_chip, (uint32_t)i_address));
+            // Get size of register value for calling code and memcopy
+            io_bufSize = sizeof(regValue);
+            memcpy(o_buffer, &regValue, io_bufSize);
             break;
         }
         case REG_TYPE_ID_SCOM:
         {
-            uint64_t x = htobe64(0x8000);
-            memcpy(o_buffer, &x, sizeof(x));
+            // Get the register value and change its endianness
+            uint64_t regValue =
+                htobe64(theSimData.getIdScomReg(i_chip, i_address));
+            // Get size of register value for calling code and memcopy
+            io_bufSize = sizeof(regValue);
+            memcpy(o_buffer, &regValue, io_bufSize);
             break;
         }
         // END temporary code