blob: 5c225b1adced3f7fd2784c97a9dff0c58953886d [file] [log] [blame]
Zane Shelley871adec2019-07-30 11:01:39 -05001#pragma once
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -05002
Zane Shelley52cb1a92019-08-21 14:38:31 -05003#include <register/hei_register.hpp>
4
Paul Greenwooddc47e0a2019-11-01 16:22:57 -05005/**
6 * @file hei_operator_register.hpp
7 *
8 * A library of useful classes used to perform logical or bitwise math on or
9 * between other registers. The classes implemented here include NotRegister,
10 * LeftShiftRegister, RightShiftRegister, AndRegister, OrRegister, and
11 * ConstantRegister.
12 *
13 * Accompanied with other Register classes and the getBitString() function, it
14 * is possible to perform operations like:
15 *
16 * AndRegister reg{<register1>,<register2>};
17 * result = reg.getBitString(<someChip>);
18 *
19 * This example will return a BitString containing the result of the bitwise
20 * AND operation applied to register1 and register2.
21 */
Zane Shelley871adec2019-07-30 11:01:39 -050022namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050023{
24
Zane Shelleyb0559b92019-12-05 22:18:20 -060025/**
26 * @brief An abstract class for all operator registers.
27 *
28 * Contains member functions and variables that are required for all child
29 * classes.
30 */
31class OperatorRegister : public Register
32{
33 public:
34 /** @brief Pure virtual destructor. */
35 virtual ~OperatorRegister() = 0;
36
37 protected:
38 /**
39 * @brief Constructor from components.
40 * @param i_size Size (in bytes) of this register.
41 */
42 explicit OperatorRegister(size_t i_size) : Register(), iv_result(i_size * 8)
43 {}
44
45 protected: // Instance variables
46 /** When getBitString() is called on an operator, the resulting value of the
47 * operation will be stored in this instance variable. */
48 BitStringBuffer iv_result;
49
50 public:
51 /** @brief Overloaded from parent class. */
Zane Shelleyd0659242020-05-15 23:02:29 -050052 size_t getSize() const override
Zane Shelleyb0559b92019-12-05 22:18:20 -060053 {
54 return (BitString::getMinBytes(iv_result.getBitLen()));
55 }
56};
57
58// Pure virtual destructor must be defined.
59inline OperatorRegister::~OperatorRegister() {}
60
Paul Greenwooddc47e0a2019-11-01 16:22:57 -050061/**
62 * @brief Using getBitString(), performs a bitwise NOT operation on a register.
63 *
64 * Example:
65 * NotRegister reg{someRegister};
66 * result = reg.getBitString(someChip);
67 */
Zane Shelleyb0559b92019-12-05 22:18:20 -060068class NotRegister : public OperatorRegister
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050069{
70 public:
Zane Shelley48aa8602019-12-05 21:41:21 -060071 /**
72 * @brief Constructor from components.
73 * @param i_arg Target register for operation.
74 */
Zane Shelley6eb61902020-05-15 22:25:58 -050075 explicit NotRegister(Register::ConstPtr i_arg) :
76 OperatorRegister(i_arg->getSize()), iv_child(i_arg)
Zane Shelleyd4c0e982019-12-05 21:27:41 -060077 {}
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050078
Zane Shelley6eb61902020-05-15 22:25:58 -050079 /** @brief Destructor. */
Zane Shelley48aa8602019-12-05 21:41:21 -060080 ~NotRegister() = default;
81
Zane Shelley6eb61902020-05-15 22:25:58 -050082 /** @brief Copy constructor. */
83 NotRegister(const NotRegister&) = delete;
Zane Shelley48aa8602019-12-05 21:41:21 -060084
Zane Shelley6eb61902020-05-15 22:25:58 -050085 /** @brief Assignment operator. */
86 NotRegister& operator=(const NotRegister& r) = delete;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050087
Zane Shelleyb0559b92019-12-05 22:18:20 -060088 /** @brief Overloaded from parent class. */
Zane Shelleyd0659242020-05-15 23:02:29 -050089 const BitString* getBitString(const Chip& i_chip) const override
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050090 {
Zane Shelleyd4c0e982019-12-05 21:27:41 -060091 const auto* bs = iv_child->getBitString(i_chip);
92
Zane Shelleyb0559b92019-12-05 22:18:20 -060093 (const_cast<NotRegister*>(this))->iv_result = ~(*bs);
Zane Shelleyd4c0e982019-12-05 21:27:41 -060094
Zane Shelleyb0559b92019-12-05 22:18:20 -060095 return &iv_result;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050096 }
97
Zane Shelleyec06f822019-12-05 22:23:19 -060098 /** @brief Comparison operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -060099 bool operator==(const NotRegister& r) const
100 {
Zane Shelleyec06f822019-12-05 22:23:19 -0600101 return iv_child == r.iv_child;
Zane Shelleycaee69f2019-12-05 13:42:58 -0600102 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500103
Zane Shelleyec06f822019-12-05 22:23:19 -0600104 /** @brief Less-than operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600105 bool operator<(const NotRegister& r) const
106 {
107 return iv_child < r.iv_child;
108 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500109
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500110 private:
Zane Shelley6eb61902020-05-15 22:25:58 -0500111 const Register::ConstPtr iv_child;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500112};
113
Paul Greenwooddc47e0a2019-11-01 16:22:57 -0500114/**
115 * @brief Using getBitString(), performs a left shift operation on a register.
116 *
117 * Example:
118 * LeftShiftRegister reg{someRegister1, shiftValue};
119 * result = reg.getBitString(someChip);
120 */
Zane Shelleyb0559b92019-12-05 22:18:20 -0600121class LeftShiftRegister : public OperatorRegister
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500122{
123 public:
Zane Shelley48aa8602019-12-05 21:41:21 -0600124 /**
125 * @brief Constructor from components.
126 * @param i_arg Target register for operation.
127 * @param i_amount The shift value.
128 */
Zane Shelley6eb61902020-05-15 22:25:58 -0500129 LeftShiftRegister(Register::ConstPtr i_arg, size_t i_amount) :
130 OperatorRegister(i_arg->getSize()), iv_child(i_arg), iv_amount(i_amount)
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600131 {}
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500132
Zane Shelley6eb61902020-05-15 22:25:58 -0500133 /** @brief Destructor. */
Zane Shelley48aa8602019-12-05 21:41:21 -0600134 ~LeftShiftRegister() = default;
135
Zane Shelley6eb61902020-05-15 22:25:58 -0500136 /** @brief Copy constructor. */
137 LeftShiftRegister(const LeftShiftRegister&) = delete;
Zane Shelley48aa8602019-12-05 21:41:21 -0600138
Zane Shelley6eb61902020-05-15 22:25:58 -0500139 /** @brief Assignment operator. */
140 LeftShiftRegister& operator=(const LeftShiftRegister& r) = delete;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500141
Zane Shelleyb0559b92019-12-05 22:18:20 -0600142 /** @brief Overloaded from parent class. */
Zane Shelleyd0659242020-05-15 23:02:29 -0500143 const BitString* getBitString(const Chip& i_chip) const override
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500144 {
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600145 const auto* bs = iv_child->getBitString(i_chip);
146
Zane Shelleyb0559b92019-12-05 22:18:20 -0600147 (const_cast<LeftShiftRegister*>(this))->iv_result = (*bs) << iv_amount;
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600148
Zane Shelleyb0559b92019-12-05 22:18:20 -0600149 return &iv_result;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500150 }
151
Zane Shelleyec06f822019-12-05 22:23:19 -0600152 /** @brief Comparison operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600153 bool operator==(const LeftShiftRegister& r) const
154 {
Zane Shelleyec06f822019-12-05 22:23:19 -0600155 return (iv_child == r.iv_child) && (iv_amount == r.iv_amount);
Zane Shelleycaee69f2019-12-05 13:42:58 -0600156 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500157
Zane Shelleyec06f822019-12-05 22:23:19 -0600158 /** @brief Less-than operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600159 bool operator<(const LeftShiftRegister& r) const
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500160 {
161 if (iv_child == r.iv_child)
162 return iv_amount < r.iv_amount;
163 return iv_child < r.iv_child;
164 }
165
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500166 private:
Zane Shelley6eb61902020-05-15 22:25:58 -0500167 const Register::ConstPtr iv_child;
168 const size_t iv_amount;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500169};
170
Paul Greenwooddc47e0a2019-11-01 16:22:57 -0500171/**
172 * @brief Using getBitString(), performs a right shift operation on a register.
173 *
174 * Example:
175 * RightShiftRegister reg{someRegister1, shiftValue};
176 * result = reg.getBitString(someChip);
177 */
Zane Shelleyb0559b92019-12-05 22:18:20 -0600178class RightShiftRegister : public OperatorRegister
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500179{
180 public:
Zane Shelley48aa8602019-12-05 21:41:21 -0600181 /**
182 * @brief Constructor from components.
183 * @param i_arg Target register for operation.
184 * @param i_amount The shift value.
185 */
Zane Shelley6eb61902020-05-15 22:25:58 -0500186 RightShiftRegister(Register::ConstPtr i_arg, size_t i_amount) :
187 OperatorRegister(i_arg->getSize()), iv_child(i_arg), iv_amount(i_amount)
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600188 {}
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500189
Zane Shelley6eb61902020-05-15 22:25:58 -0500190 /** @brief Destructor. */
Zane Shelley48aa8602019-12-05 21:41:21 -0600191 ~RightShiftRegister() = default;
192
Zane Shelley6eb61902020-05-15 22:25:58 -0500193 /** @brief Copy constructor. */
194 RightShiftRegister(const RightShiftRegister&) = delete;
Zane Shelley48aa8602019-12-05 21:41:21 -0600195
Zane Shelley6eb61902020-05-15 22:25:58 -0500196 /** @brief Assignment operator. */
197 RightShiftRegister& operator=(const RightShiftRegister& r) = delete;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500198
Zane Shelleyb0559b92019-12-05 22:18:20 -0600199 /** @brief Overloaded from parent class. */
Zane Shelleyd0659242020-05-15 23:02:29 -0500200 const BitString* getBitString(const Chip& i_chip) const override
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500201 {
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600202 const auto* bs = iv_child->getBitString(i_chip);
203
Zane Shelleyb0559b92019-12-05 22:18:20 -0600204 (const_cast<RightShiftRegister*>(this))->iv_result = (*bs) >> iv_amount;
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600205
Zane Shelleyb0559b92019-12-05 22:18:20 -0600206 return &iv_result;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500207 }
208
Zane Shelleyec06f822019-12-05 22:23:19 -0600209 /** @brief Comparison operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600210 bool operator==(const RightShiftRegister& r) const
211 {
Zane Shelleyec06f822019-12-05 22:23:19 -0600212 return (iv_child == r.iv_child) && (iv_amount == r.iv_amount);
Zane Shelleycaee69f2019-12-05 13:42:58 -0600213 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500214
Zane Shelleyec06f822019-12-05 22:23:19 -0600215 /** @brief Less-than operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600216 bool operator<(const RightShiftRegister& r) const
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500217 {
218 if (iv_child == r.iv_child)
219 return iv_amount < r.iv_amount;
220 return iv_child < r.iv_child;
221 }
222
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500223 private:
Zane Shelley6eb61902020-05-15 22:25:58 -0500224 const Register::ConstPtr iv_child;
225 const size_t iv_amount;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500226};
227
Paul Greenwooddc47e0a2019-11-01 16:22:57 -0500228/**
229 * @brief Using getBitString(), performs a bitwise AND operation on a pair
230 * of registers.
231 *
232 * Example:
233 * AndRegister reg{someRegister1, someRegister2};
234 * result = reg.getBitString(someChip);
235 */
Zane Shelleyb0559b92019-12-05 22:18:20 -0600236class AndRegister : public OperatorRegister
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500237{
238 public:
Zane Shelley48aa8602019-12-05 21:41:21 -0600239 /**
240 * @brief Constructor from components.
241 * @param i_left Target register for operation.
242 * @param i_right Target register for operation.
243 */
Zane Shelley6eb61902020-05-15 22:25:58 -0500244 AndRegister(Register::ConstPtr i_left, Register::ConstPtr i_right) :
245 OperatorRegister(i_left->getSize()), iv_left(i_left), iv_right(i_right)
246 {
247 // The two registers must be the same sizes or it makes for some weird
248 // results.
249 HEI_ASSERT(iv_left->getSize() == iv_right->getSize());
250 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500251
Zane Shelley6eb61902020-05-15 22:25:58 -0500252 /** @brief Destructor. */
Zane Shelley48aa8602019-12-05 21:41:21 -0600253 ~AndRegister() = default;
254
Zane Shelley6eb61902020-05-15 22:25:58 -0500255 /** @brief Copy constructor. */
256 AndRegister(const AndRegister&) = delete;
Zane Shelley48aa8602019-12-05 21:41:21 -0600257
Zane Shelley6eb61902020-05-15 22:25:58 -0500258 /** @brief Assignment operator. */
259 AndRegister& operator=(const AndRegister& r) = delete;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500260
Zane Shelleyb0559b92019-12-05 22:18:20 -0600261 /** @brief Overloaded from parent class. */
Zane Shelleyd0659242020-05-15 23:02:29 -0500262 const BitString* getBitString(const Chip& i_chip) const override
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500263 {
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600264 const auto* l_bs = iv_left->getBitString(i_chip);
265 const auto* r_bs = iv_right->getBitString(i_chip);
266
Zane Shelleyb0559b92019-12-05 22:18:20 -0600267 (const_cast<AndRegister*>(this))->iv_result = (*l_bs) & (*r_bs);
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600268
Zane Shelleyb0559b92019-12-05 22:18:20 -0600269 return &iv_result;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500270 }
271
Zane Shelleyec06f822019-12-05 22:23:19 -0600272 /** @brief Comparison operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600273 bool operator==(const AndRegister& r) const
274 {
Zane Shelleyec06f822019-12-05 22:23:19 -0600275 return (iv_left == r.iv_left) && (iv_right == r.iv_right);
Zane Shelleycaee69f2019-12-05 13:42:58 -0600276 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500277
Zane Shelleyec06f822019-12-05 22:23:19 -0600278 /** @brief Less-than operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600279 bool operator<(const AndRegister& r) const
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500280 {
281 if (iv_left == r.iv_left)
282 return iv_right < r.iv_right;
283 return iv_left < r.iv_left;
284 }
285
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500286 private:
Zane Shelley6eb61902020-05-15 22:25:58 -0500287 const Register::ConstPtr iv_left;
288 const Register::ConstPtr iv_right;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500289};
290
Paul Greenwooddc47e0a2019-11-01 16:22:57 -0500291/**
292 * @brief Using getBitString(), performs a bitwise OR operation on a pair
293 * of registers.
294 *
295 * Example:
296 * OrRegister reg{someRegister1, someRegister2};
297 * result = reg.getBitString(someChip);
298 */
Zane Shelleyb0559b92019-12-05 22:18:20 -0600299class OrRegister : public OperatorRegister
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500300{
301 public:
Zane Shelley48aa8602019-12-05 21:41:21 -0600302 /**
303 * @brief Constructor from components.
304 * @param i_left Target register for operation.
305 * @param i_right Target register for operation.
306 */
Zane Shelley6eb61902020-05-15 22:25:58 -0500307 OrRegister(Register::ConstPtr i_left, Register::ConstPtr i_right) :
308 OperatorRegister(i_left->getSize()), iv_left(i_left), iv_right(i_right)
309 {
310 // The two registers must be the same sizes or it makes for some weird
311 // results.
312 HEI_ASSERT(iv_left->getSize() == iv_right->getSize());
313 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500314
Zane Shelley6eb61902020-05-15 22:25:58 -0500315 /** @brief Destructor. */
Zane Shelley48aa8602019-12-05 21:41:21 -0600316 ~OrRegister() = default;
317
Zane Shelley6eb61902020-05-15 22:25:58 -0500318 /** @brief Copy constructor. */
319 OrRegister(const OrRegister&) = delete;
Zane Shelley48aa8602019-12-05 21:41:21 -0600320
Zane Shelley6eb61902020-05-15 22:25:58 -0500321 /** @brief Assignment operator. */
322 OrRegister& operator=(const OrRegister& r) = delete;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500323
Zane Shelleyb0559b92019-12-05 22:18:20 -0600324 /** @brief Overloaded from parent class. */
Zane Shelleyd0659242020-05-15 23:02:29 -0500325 const BitString* getBitString(const Chip& i_chip) const override
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500326 {
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600327 const auto* l_bs = iv_left->getBitString(i_chip);
328 const auto* r_bs = iv_right->getBitString(i_chip);
329
Zane Shelleyb0559b92019-12-05 22:18:20 -0600330 (const_cast<OrRegister*>(this))->iv_result = (*l_bs) | (*r_bs);
Zane Shelleyd4c0e982019-12-05 21:27:41 -0600331
Zane Shelleyb0559b92019-12-05 22:18:20 -0600332 return &iv_result;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500333 }
334
Zane Shelleyec06f822019-12-05 22:23:19 -0600335 /** @brief Comparison operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600336 bool operator==(const OrRegister& r) const
337 {
Zane Shelleyec06f822019-12-05 22:23:19 -0600338 return (iv_left == r.iv_left) && (iv_right == r.iv_right);
Zane Shelleycaee69f2019-12-05 13:42:58 -0600339 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500340
Zane Shelleyec06f822019-12-05 22:23:19 -0600341 /** @brief Less-than operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600342 bool operator<(const OrRegister& r) const
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500343 {
344 if (iv_left == r.iv_left)
345 return iv_right < r.iv_right;
346 return iv_left < r.iv_left;
347 }
348
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500349 private:
Zane Shelley6eb61902020-05-15 22:25:58 -0500350 const Register::ConstPtr iv_left;
351 const Register::ConstPtr iv_right;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500352};
353
Paul Greenwooddc47e0a2019-11-01 16:22:57 -0500354/**
355 * @brief Contains a constant value that can be used within any of the other
356 * register operators. The value can be retrieved using the
357 * getBitString() function.
Zane Shelley6eb61902020-05-15 22:25:58 -0500358 */
Zane Shelleyb0559b92019-12-05 22:18:20 -0600359class ConstantRegister : public OperatorRegister
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500360{
361 public:
Zane Shelley48aa8602019-12-05 21:41:21 -0600362 /**
363 * @brief Constructor from components.
Zane Shelley6eb61902020-05-15 22:25:58 -0500364 * @param i_val An unsigned integer value. iv_result will be initialized to
365 * the size of type T and this value will be copied into that
366 * buffer.
Zane Shelley48aa8602019-12-05 21:41:21 -0600367 */
Zane Shelley6eb61902020-05-15 22:25:58 -0500368 template <class T>
369 explicit ConstantRegister(T i_val) : OperatorRegister(sizeof(i_val))
Zane Shelleyb0559b92019-12-05 22:18:20 -0600370 {
Zane Shelley6eb61902020-05-15 22:25:58 -0500371 iv_result.setFieldRight(0, iv_result.getBitLen(), i_val);
Zane Shelleyb0559b92019-12-05 22:18:20 -0600372 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500373
Zane Shelley6eb61902020-05-15 22:25:58 -0500374 /** @brief Destructor. */
Zane Shelley48aa8602019-12-05 21:41:21 -0600375 ~ConstantRegister() = default;
376
Zane Shelley6eb61902020-05-15 22:25:58 -0500377 /** @brief Copy constructor. */
378 ConstantRegister(const ConstantRegister&) = delete;
Zane Shelley48aa8602019-12-05 21:41:21 -0600379
Zane Shelley6eb61902020-05-15 22:25:58 -0500380 /** @brief Assignment operator. */
381 ConstantRegister& operator=(const ConstantRegister& r) = delete;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500382
Zane Shelleyb0559b92019-12-05 22:18:20 -0600383 /** @brief Overloaded from parent class. */
Zane Shelleyd0659242020-05-15 23:02:29 -0500384 const BitString* getBitString(const Chip& i_chip) const override
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500385 {
Zane Shelleyb0559b92019-12-05 22:18:20 -0600386 return &iv_result;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500387 }
388
Zane Shelleyec06f822019-12-05 22:23:19 -0600389 /** @brief Comparison operator. */
Zane Shelleycaee69f2019-12-05 13:42:58 -0600390 bool operator==(const ConstantRegister& r) const
391 {
Zane Shelleyec06f822019-12-05 22:23:19 -0600392 return iv_result == r.iv_result;
393 }
394
395 /** @brief Less-than operator. */
396 bool operator<(const ConstantRegister& r) const
397 {
398 return iv_result < r.iv_result;
Zane Shelleycaee69f2019-12-05 13:42:58 -0600399 }
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500400};
401
Zane Shelley871adec2019-07-30 11:01:39 -0500402} // end namespace libhei