summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sim/clocked_object.hh13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/sim/clocked_object.hh b/src/sim/clocked_object.hh
index 5df404dba..d41f71a17 100644
--- a/src/sim/clocked_object.hh
+++ b/src/sim/clocked_object.hh
@@ -144,12 +144,23 @@ class Clocked
tick = elapsedCycles * clockPeriod();
}
+ /**
+ * A hook subclasses can implement so they can do any extra work that's
+ * needed when the clock rate is changed.
+ */
+ virtual void clockPeriodUpdated() {}
+
public:
/**
* Update the tick to the current tick.
*/
- void updateClockPeriod() const { update(); }
+ void
+ updateClockPeriod()
+ {
+ update();
+ clockPeriodUpdated();
+ }
/**
* Determine the tick when a cycle begins, by default the current one, but