From 16351ba8d6b98e4dc0012cfc4083fe93ec6d76ce Mon Sep 17 00:00:00 2001 From: Stephan Diestelhorst Date: Tue, 12 Aug 2014 19:00:44 +0100 Subject: energy: Tighter checking of levels for DFS systems There are cases where users might by accident / intention specify less voltage operating points thatn frequency points. We consider one of these cases special: giving only a single voltage to a voltage domain effectively renders it as a static domain. This patch adds additional logic in the auxiliary parts of the functionality to handle these cases properly (simple driver asking for N>1 operating levels, we should return the same voltage for all of them) and adds error checking code in the voltage domain. --- src/sim/voltage_domain.hh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/sim/voltage_domain.hh') diff --git a/src/sim/voltage_domain.hh b/src/sim/voltage_domain.hh index 9ffbe7bbc..ab96abad8 100644 --- a/src/sim/voltage_domain.hh +++ b/src/sim/voltage_domain.hh @@ -77,6 +77,10 @@ class VoltageDomain : public SimObject */ 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]; } -- cgit v1.2.3