sim: Add an option to forward work items to Python
[gem5.git] / src / sim / voltage_domain.hh
index 3904c80c9907c7c17be5dccf7d98152158aa871e..e7e4f8180f3307145f2754dc907e278e184c8f74 100644 (file)
@@ -60,6 +60,8 @@ class VoltageDomain : public SimObject
     typedef VoltageDomainParams Params;
     VoltageDomain(const Params *p);
 
+    typedef SrcClockDomain::PerfLevel PerfLevel;
+
     /**
      * Get the current voltage.
      *
@@ -67,9 +69,22 @@ class VoltageDomain : public SimObject
      */
     double voltage() const { return voltageOpPoints[_perfLevel]; }
 
-    uint32_t numVoltages() const { return (uint32_t)voltageOpPoints.size(); }
+    /**
+     * Get the voltage at specified performance level.
+     *
+     * @param perf_level Performance level for which the voltage is requested
+     * @return Voltage of the domain at specified performance level
+     */
+    double voltage(PerfLevel perf_level) const
+    {
+        chatty_assert(perf_level < numVoltages(), "VoltageDomain %s "\
+                      "request for voltage perf level %u is outside "\
+                      "of numVoltages %u", name(), perf_level,
+                      numVoltages());
+        return voltageOpPoints[perf_level];
+    }
 
-    typedef SrcClockDomain::PerfLevel PerfLevel;
+    uint32_t numVoltages() const { return (uint32_t)voltageOpPoints.size(); }
 
     /**
      * Set the voltage point of the domain.
@@ -96,7 +111,7 @@ class VoltageDomain : public SimObject
      * Startup has all SrcClockDomains registered with this voltage domain, so
      * try to make sure that all perf level requests from them are met.
      */
-    void startup();
+    void startup() override;
 
     /**
      * Recomputes the highest (fastest, i.e., numerically lowest) requested
@@ -111,10 +126,11 @@ class VoltageDomain : public SimObject
      */
     bool sanitiseVoltages();
 
-    void regStats();
+    void regStats() override;
+
+    void serialize(CheckpointOut &cp) const override;
+    void unserialize(CheckpointIn &cp) override;
 
-    void serialize(std::ostream &os);
-    void unserialize(Checkpoint *cp, const std::string &section);
   private:
     typedef std::vector<double> Voltages;
     /**