blob: 6eb5c6b142129c97410d7e460fe7fe1a5632c446 [file] [log] [blame]
Zane Shelley8deb0902019-10-14 15:52:27 -05001#pragma once
2
3#include <register/hei_hardware_register.hpp>
Zane Shelley2f341bf2019-10-16 11:19:36 -05004#include <util/hei_flyweight.hpp>
Zane Shelley8deb0902019-10-14 15:52:27 -05005
6namespace libhei
7{
8
9/**
10 * @brief A Power Systems SCOM register.
11 *
12 * Address width: 4 bytes
13 * Register width: 8 bytes
14 * Bit order: Ascending (0-63 left to right)
15 */
16class ScomRegister : public HardwareRegister
17{
18 public: // Constructor, destructors, assignment, etc.
Zane Shelley8deb0902019-10-14 15:52:27 -050019 /**
20 * @brief Constructor from components.
Zane Shelley7667b712020-05-11 20:45:40 -050021 * @param i_id Unique ID for this register.
22 * @param i_instance Instance of this register
23 * @param i_flags Attribute flags for this register.
24 * @param i_address A 4-byte address for this SCOM register.
Zane Shelley8deb0902019-10-14 15:52:27 -050025 */
Zane Shelley5ec88102020-05-11 21:08:25 -050026 ScomRegister(RegisterId_t i_id, Instance_t i_instance,
27 RegisterAttributeFlags_t i_flags, uint32_t i_address) :
Patrick Williams8db65db2024-08-16 15:22:30 -040028 HardwareRegister(i_id, i_instance, i_flags), iv_address(i_address)
Zane Shelley8deb0902019-10-14 15:52:27 -050029 {}
30
31 /** @brief Destructor. */
32 ~ScomRegister() = default;
33
Zane Shelley2f341bf2019-10-16 11:19:36 -050034 private:
Zane Shelley981e56a2020-05-11 21:24:20 -050035 /** @brief Copy constructor. */
36 ScomRegister(const ScomRegister&) = delete;
Zane Shelley2f341bf2019-10-16 11:19:36 -050037
Zane Shelley981e56a2020-05-11 21:24:20 -050038 /** @brief Assignment operator. */
Zane Shelleyfe27b652019-10-28 11:33:07 -050039 ScomRegister& operator=(const ScomRegister&) = delete;
Zane Shelley8deb0902019-10-14 15:52:27 -050040
41 public: // Accessor functions
Zane Shelley8deb0902019-10-14 15:52:27 -050042 /** Function overloaded from parent HardwareRegister class. */
Zane Shelley5a78fa82022-09-16 16:49:58 -050043 RegisterType_t getType() const override
Zane Shelley7f7a42d2019-10-28 13:28:31 -050044 {
45 return REG_TYPE_SCOM;
46 }
Zane Shelley8deb0902019-10-14 15:52:27 -050047
48 /** Function overloaded from parent HardwareRegister class. */
Zane Shelley5a78fa82022-09-16 16:49:58 -050049 RegisterAddress_t getAddress() const override
Zane Shelley8deb0902019-10-14 15:52:27 -050050 {
Zane Shelley83da2452019-10-25 15:45:34 -050051 return static_cast<RegisterAddress_t>(iv_address);
Zane Shelley8deb0902019-10-14 15:52:27 -050052 }
53
54 /** Function overloaded from parent HardwareRegister class. */
Zane Shelley5a78fa82022-09-16 16:49:58 -050055 size_t getSize() const override
Zane Shelley7f7a42d2019-10-28 13:28:31 -050056 {
57 return 8;
58 }
Zane Shelley8deb0902019-10-14 15:52:27 -050059
Zane Shelley8deb0902019-10-14 15:52:27 -050060 private: // Instance variables
Zane Shelley8deb0902019-10-14 15:52:27 -050061 /** This register's address. */
62 const uint32_t iv_address;
63
64}; // end class ScomRegister
65
66/**
67 * @brief A Power Systems Indirect SCOM register.
68 *
69 * Address width: 8 bytes
70 * Register width: 2* bytes (see note below)
71 * Bit order: Ascending (0-63 left to right)
72 *
73 * IMPORTANT NOTE:
74 * Technically, only two bytes of data are actually used. However, the bit
75 * definition of these registers put the two bytes at the end of the returned
76 * value (bit 48-63). Therefore, this class will be made to look like the
77 * width is 8 bytes in order to make the bit indexing work in the returned
78 * BitString.
79 */
80class IdScomRegister : public HardwareRegister
81{
82 public: // Constructor, destructors, assignment, etc.
Zane Shelley8deb0902019-10-14 15:52:27 -050083 /**
84 * @brief Constructor from components.
Zane Shelley7667b712020-05-11 20:45:40 -050085 * @param i_id Unique ID for this register.
86 * @param i_instance Instance of this register
87 * @param i_flags Attribute flags for this register.
88 * @param i_address An 8-byte address for this Indirect SCOM register.
Zane Shelley8deb0902019-10-14 15:52:27 -050089 */
Zane Shelley5ec88102020-05-11 21:08:25 -050090 IdScomRegister(RegisterId_t i_id, Instance_t i_instance,
91 RegisterAttributeFlags_t i_flags, uint64_t i_address) :
Patrick Williams8db65db2024-08-16 15:22:30 -040092 HardwareRegister(i_id, i_instance, i_flags), iv_address(i_address)
Zane Shelley8deb0902019-10-14 15:52:27 -050093 {}
94
95 /** @brief Destructor. */
96 ~IdScomRegister() = default;
97
Zane Shelley2f341bf2019-10-16 11:19:36 -050098 private:
Zane Shelley981e56a2020-05-11 21:24:20 -050099 /** @brief Copy constructor. */
100 IdScomRegister(const IdScomRegister&) = delete;
Zane Shelley2f341bf2019-10-16 11:19:36 -0500101
Zane Shelley981e56a2020-05-11 21:24:20 -0500102 /** @brief Assignment operator. */
Zane Shelleyfe27b652019-10-28 11:33:07 -0500103 IdScomRegister& operator=(const IdScomRegister&) = delete;
Zane Shelley8deb0902019-10-14 15:52:27 -0500104
105 public: // Accessor functions
Zane Shelley8deb0902019-10-14 15:52:27 -0500106 /** Function overloaded from parent HardwareRegister class. */
Zane Shelley5a78fa82022-09-16 16:49:58 -0500107 RegisterType_t getType() const override
Zane Shelley7f7a42d2019-10-28 13:28:31 -0500108 {
109 return REG_TYPE_ID_SCOM;
110 }
Zane Shelley8deb0902019-10-14 15:52:27 -0500111
112 /** Function overloaded from parent HardwareRegister class. */
Zane Shelley5a78fa82022-09-16 16:49:58 -0500113 RegisterAddress_t getAddress() const override
Zane Shelley8deb0902019-10-14 15:52:27 -0500114 {
Zane Shelley83da2452019-10-25 15:45:34 -0500115 return static_cast<RegisterAddress_t>(iv_address);
Zane Shelley8deb0902019-10-14 15:52:27 -0500116 }
117
118 /** Function overloaded from parent HardwareRegister class. */
Zane Shelley5a78fa82022-09-16 16:49:58 -0500119 size_t getSize() const override
Zane Shelley7f7a42d2019-10-28 13:28:31 -0500120 {
121 return 8; // See note in class documentation.
122 }
Zane Shelley8deb0902019-10-14 15:52:27 -0500123
Zane Shelley8deb0902019-10-14 15:52:27 -0500124 private: // Instance variables
Zane Shelley8deb0902019-10-14 15:52:27 -0500125 /** This register's address. */
126 const uint64_t iv_address;
127
128}; // end class IdScomRegister
129
130} // end namespace libhei