Hoa Nguyen has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/33117 )
Change subject: base: Tag API methods in sat_counter.hh
......................................................................
base: Tag API methods in sat_counter.hh
Change-Id: Id5da647f35cca30276bb34b745999f4571a47d89
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/33117
Maintainer: Bobby R. Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
---
M src/base/sat_counter.hh
1 file changed, 77 insertions(+), 13 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Daniel Carvalho: Looks good to me, approved
Bobby R. Bruce: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/base/sat_counter.hh b/src/base/sat_counter.hh
index 40b55f6..d257cda 100644
--- a/src/base/sat_counter.hh
+++ b/src/base/sat_counter.hh
@@ -65,6 +65,8 @@
*
* @param bits How many bits the counter will have.
* @param initial_val Starting value for the counter.
+ *
+ * @ingroup api_sat_counter
*/
explicit SatCounter(unsigned bits, uint8_t initial_val = 0)
: initialVal(initial_val), maxVal((1 << bits) - 1),
@@ -76,14 +78,22 @@
"Saturating counter's Initial value exceeds max value.");
}
- /** Copy constructor. */
+ /**
+ * Copy constructor.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter(const SatCounter& other)
: initialVal(other.initialVal), maxVal(other.maxVal),
counter(other.counter)
{
}
- /** Copy assignment. */
+ /**
+ * Copy assignment.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter& operator=(const SatCounter& other) {
if (this != &other) {
SatCounter temp(other);
@@ -92,7 +102,11 @@
return *this;
}
- /** Move constructor. */
+ /**
+ * Move constructor.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter(SatCounter&& other)
{
initialVal = other.initialVal;
@@ -102,7 +116,11 @@
other.swap(temp);
}
- /** Move assignment. */
+ /**
+ * Move assignment.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter& operator=(SatCounter&& other) {
if (this != &other) {
initialVal = other.initialVal;
@@ -119,6 +137,8 @@
* copy-assignment created by the compiler.
*
* @param other The other object to swap contents with.
+ *
+ * @ingroup api_sat_counter
*/
void
swap(SatCounter& other)
@@ -128,7 +148,11 @@
std::swap(counter, other.counter);
}
- /** Pre-increment operator. */
+ /**
+ * Pre-increment operator.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter&
operator++()
{
@@ -138,7 +162,11 @@
return *this;
}
- /** Post-increment operator. */
+ /**
+ * Post-increment operator.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter
operator++(int)
{
@@ -147,7 +175,11 @@
return old_counter;
}
- /** Pre-decrement operator. */
+ /**
+ * Pre-decrement operator.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter&
operator--()
{
@@ -157,7 +189,11 @@
return *this;
}
- /** Post-decrement operator. */
+ /**
+ * Post-decrement operator.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter
operator--(int)
{
@@ -166,7 +202,11 @@
return old_counter;
}
- /** Shift-right-assignment. */
+ /**
+ * Shift-right-assignment.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter&
operator>>=(const int& shift)
{
@@ -175,7 +215,11 @@
return *this;
}
- /** Shift-left-assignment. */
+ /**
+ * Shift-left-assignment.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter&
operator<<=(const int& shift)
{
@@ -187,7 +231,11 @@
return *this;
}
- /** Add-assignment. */
+ /**
+ * Add-assignment.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter&
operator+=(const int& value)
{
@@ -203,7 +251,11 @@
return *this;
}
- /** Subtract-assignment. */
+ /**
+ * Subtract-assignment.
+ *
+ * @ingroup api_sat_counter
+ */
SatCounter&
operator-=(const int& value)
{
@@ -221,10 +273,16 @@
/**
* Read the counter's value.
+ *
+ * @ingroup api_sat_counter
*/
operator uint8_t() const { return counter; }
- /** Reset the counter to its initial value. */
+ /**
+ * Reset the counter to its initial value.
+ *
+ * @ingroup api_sat_counter
+ */
void reset() { counter = initialVal; }
/**
@@ -233,6 +291,8 @@
*
* @return A value between 0.0 and 1.0 to indicate which percentile of
* the maximum value the current value is.
+ *
+ * @ingroup api_sat_counter
*/
double calcSaturation() const { return (double) counter / maxVal; }
@@ -240,6 +300,8 @@
* Whether the counter has achieved its maximum value or not.
*
* @return True if the counter saturated.
+ *
+ * @ingroup api_sat_counter
*/
bool isSaturated() const { return counter == maxVal; }
@@ -247,6 +309,8 @@
* Saturate the counter.
*
* @return The value added to the counter to reach saturation.
+ *
+ * @ingroup api_sat_counter
*/
uint8_t saturate()
{
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33117
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id5da647f35cca30276bb34b745999f4571a47d89
Gerrit-Change-Number: 33117
Gerrit-PatchSet: 2
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s