From 4422d1322a8ed47bc9d743894ad47d82f33eba7c Mon Sep 17 00:00:00 2001 From: Stephan Diestelhorst Date: Mon, 16 Jun 2014 14:59:44 +0100 Subject: energy: Small extentions and fixes for DVFS handler These additions allow easier interoperability with and querying from an additional controller which will be in a separate patch. Also adding warnings for changing the enabled state of the handler across checkpoint / resume and deviating from the state in the configuration. Contributed-by: Akash Bagdia --- src/sim/dvfs_handler.hh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'src/sim/dvfs_handler.hh') diff --git a/src/sim/dvfs_handler.hh b/src/sim/dvfs_handler.hh index c8d962133..3ff08115a 100644 --- a/src/sim/dvfs_handler.hh +++ b/src/sim/dvfs_handler.hh @@ -52,13 +52,14 @@ #include +#include "debug/DVFS.hh" #include "params/ClockDomain.hh" #include "params/DVFSHandler.hh" #include "params/VoltageDomain.hh" #include "sim/clock_domain.hh" #include "sim/eventq.hh" #include "sim/sim_object.hh" - +#include "sim/voltage_domain.hh" /** * DVFS Handler class, maintains a list of all the domains it can handle. @@ -79,6 +80,18 @@ class DVFSHandler : public SimObject typedef SrcClockDomain::DomainID DomainID; typedef SrcClockDomain::PerfLevel PerfLevel; + /** + * Get the number of domains assigned to this DVFS handler. + * @return Number of domains + */ + uint32_t numDomains() const { return domainIDList.size(); } + + /** + * Get the n-th domain ID, from the domains managed by this handler. + * @return Domain ID + */ + DomainID domainID(uint32_t index) const; + /** * Check whether a domain ID is known to the handler or not. * @param domain_id Domain ID to check @@ -127,6 +140,19 @@ class DVFSHandler : public SimObject return findDomain(domain_id)->clkPeriodAtPerfLevel(perf_level); } + /** + * Read the voltage of the specified domain at the specified + * performance level. + * @param domain_id Domain ID to query + * @param perf_level Performance level of interest + * @return Voltage for the requested performance level of the respective + * domain + */ + double voltageAtPerfLevel(DomainID domain_id, PerfLevel perf_level) const + { + return findDomain(domain_id)->voltageDomain()->voltage(perf_level); + } + /** * Get the total number of available performance levels. * @@ -153,6 +179,11 @@ class DVFSHandler : public SimObject typedef std::map Domains; Domains domains; + /** + * List of IDs avaiable in the domain list + */ + std::vector domainIDList; + /** * Clock domain of the system the handler is instantiated. */ -- cgit v1.2.3