summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/ClockDomain.py4
-rw-r--r--src/sim/SConscript3
-rw-r--r--src/sim/VoltageDomain.py47
-rw-r--r--src/sim/clock_domain.cc12
-rw-r--r--src/sim/clock_domain.hh29
-rw-r--r--src/sim/voltage_domain.cc68
-rw-r--r--src/sim/voltage_domain.hh84
7 files changed, 243 insertions, 4 deletions
diff --git a/src/sim/ClockDomain.py b/src/sim/ClockDomain.py
index 37958dc26..2a3b6addf 100644
--- a/src/sim/ClockDomain.py
+++ b/src/sim/ClockDomain.py
@@ -38,6 +38,7 @@
from m5.params import *
from m5.SimObject import SimObject
+from m5.proxy import *
# Abstract clock domain
class ClockDomain(SimObject):
@@ -51,6 +52,9 @@ class SrcClockDomain(ClockDomain):
cxx_header = "sim/clock_domain.hh"
clock = Param.Clock("Clock period")
+ # A source clock must be associated with a voltage domain
+ voltage_domain = Param.VoltageDomain("Voltage domain")
+
# Derived clock domain with a parent clock domain and a frequency
# divider
class DerivedClockDomain(ClockDomain):
diff --git a/src/sim/SConscript b/src/sim/SConscript
index 7aa4702cd..90d77848b 100644
--- a/src/sim/SConscript
+++ b/src/sim/SConscript
@@ -35,6 +35,7 @@ SimObject('ClockedObject.py')
SimObject('Root.py')
SimObject('InstTracer.py')
SimObject('ClockDomain.py')
+SimObject('VoltageDomain.py')
Source('arguments.cc')
Source('async.cc')
@@ -52,6 +53,7 @@ Source('simulate.cc')
Source('stat_control.cc')
Source('syscall_emul.cc')
Source('clock_domain.cc')
+Source('voltage_domain.cc')
if env['TARGET_ISA'] != 'no':
SimObject('Process.py')
@@ -84,3 +86,4 @@ DebugFlag('Timer')
DebugFlag('VtoPhys')
DebugFlag('WorkItems')
DebugFlag('ClockDomain')
+DebugFlag('VoltageDomain')
diff --git a/src/sim/VoltageDomain.py b/src/sim/VoltageDomain.py
new file mode 100644
index 000000000..ad84d756b
--- /dev/null
+++ b/src/sim/VoltageDomain.py
@@ -0,0 +1,47 @@
+# Copyright (c) 2012 ARM Limited
+# All rights reserved.
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder. You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Vasileios Spiliopoulos
+# Akash Bagdia
+
+from m5.SimObject import SimObject
+from m5.params import *
+
+class VoltageDomain(SimObject):
+ type = 'VoltageDomain'
+ cxx_header = "sim/voltage_domain.hh"
+ # We use a default voltage of 1V to avoid forcing users to set it
+ # even if they are not interested in using the functionality
+ voltage = Param.Voltage('1V', "Operational voltage")
diff --git a/src/sim/clock_domain.cc b/src/sim/clock_domain.cc
index 262ae904c..8b563d598 100644
--- a/src/sim/clock_domain.cc
+++ b/src/sim/clock_domain.cc
@@ -44,8 +44,16 @@
#include "params/DerivedClockDomain.hh"
#include "params/SrcClockDomain.hh"
#include "sim/clock_domain.hh"
+#include "sim/voltage_domain.hh"
-SrcClockDomain::SrcClockDomain(const Params *p) : ClockDomain(p)
+double
+ClockDomain::voltage() const
+{
+ return _voltageDomain->voltage();
+}
+
+SrcClockDomain::SrcClockDomain(const Params *p) :
+ ClockDomain(p, p->voltage_domain)
{
clockPeriod(p->clock);
}
@@ -76,7 +84,7 @@ SrcClockDomainParams::create()
}
DerivedClockDomain::DerivedClockDomain(const Params *p) :
- ClockDomain(p),
+ ClockDomain(p, p->clk_domain->voltageDomain()),
parent(*p->clk_domain),
clockDivider(p->clk_divider)
{
diff --git a/src/sim/clock_domain.hh b/src/sim/clock_domain.hh
index c3f53e675..619f30696 100644
--- a/src/sim/clock_domain.hh
+++ b/src/sim/clock_domain.hh
@@ -56,10 +56,12 @@
* Forward declaration
*/
class DerivedClockDomain;
+class VoltageDomain;
/**
* The ClockDomain provides clock to group of clocked objects bundled
- * under the same clock domain. The clock domains provide support for
+ * under the same clock domain. The clock domains, in turn, are
+ * grouped into voltage domains. The clock domains provide support for
* a hierarchial structure with source and derived domains.
*/
class ClockDomain : public SimObject
@@ -74,6 +76,11 @@ class ClockDomain : public SimObject
Tick _clockPeriod;
/**
+ * Voltage domain this clock domain belongs to
+ */
+ VoltageDomain *_voltageDomain;
+
+ /**
* Pointers to potential derived clock domains so we can propagate
* changes.
*/
@@ -82,7 +89,10 @@ class ClockDomain : public SimObject
public:
typedef ClockDomainParams Params;
- ClockDomain(const Params *p) : SimObject(p), _clockPeriod(0) {}
+ ClockDomain(const Params *p, VoltageDomain *voltage_domain) :
+ SimObject(p),
+ _clockPeriod(0),
+ _voltageDomain(voltage_domain) {}
/**
* Get the clock period.
@@ -92,6 +102,21 @@ class ClockDomain : public SimObject
inline Tick clockPeriod() const { return _clockPeriod; }
/**
+ * Get the voltage domain.
+ *
+ * @return Voltage domain this clock domain belongs to
+ */
+ inline VoltageDomain *voltageDomain() const { return _voltageDomain; }
+
+
+ /**
+ * Get the current voltage this clock domain operates at.
+ *
+ * @return Voltage applied to the clock domain
+ */
+ inline double voltage() const;
+
+ /**
* Add a derived domain.
*
* @param Derived domain to add as a child
diff --git a/src/sim/voltage_domain.cc b/src/sim/voltage_domain.cc
new file mode 100644
index 000000000..43848d68a
--- /dev/null
+++ b/src/sim/voltage_domain.cc
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Vasileios Spiliopoulos
+ * Akash Bagdia
+ */
+
+#include "debug/VoltageDomain.hh"
+#include "params/VoltageDomain.hh"
+#include "sim/sim_object.hh"
+#include "sim/voltage_domain.hh"
+
+VoltageDomain::VoltageDomain(const Params *p)
+ : SimObject(p), _voltage(0)
+{
+ voltage(p->voltage);
+}
+
+void
+VoltageDomain::voltage(double voltage)
+{
+ if (voltage <= 0) {
+ fatal("Voltage should be greater than zero.\n");
+ }
+
+ _voltage = voltage;
+ DPRINTF(VoltageDomain,
+ "Setting voltage to %f for domain %s\n", _voltage, name());
+}
+
+VoltageDomain *
+VoltageDomainParams::create()
+{
+ return new VoltageDomain(this);
+}
diff --git a/src/sim/voltage_domain.hh b/src/sim/voltage_domain.hh
new file mode 100644
index 000000000..585ec8d66
--- /dev/null
+++ b/src/sim/voltage_domain.hh
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Vasileios Spiliopoulos
+ * Akash Bagdia
+ */
+
+#ifndef __SIM_VOLTAGE_DOMAIN_HH__
+#define __SIM_VOLTAGE_DOMAIN_HH__
+
+#include "base/statistics.hh"
+#include "params/VoltageDomain.hh"
+#include "sim/sim_object.hh"
+
+/**
+ * A VoltageDomain is used to group clock domains that operate under
+ * the same voltage. The class provides methods for setting and
+ * getting the voltage.
+ */
+class VoltageDomain : public SimObject
+{
+
+ private:
+
+ /**
+ * The voltage of the domain expressed in Volts
+ */
+ double _voltage;
+
+ public:
+
+ typedef VoltageDomainParams Params;
+ VoltageDomain(const Params *p);
+
+ /**
+ * Get the current volate.
+ *
+ * @return Voltage of the domain
+ */
+ inline double voltage() const { return _voltage; }
+
+ /**
+ * Set the voltage of the domain.
+ *
+ * @param Voltage value to be set
+ */
+ void voltage(double voltage);
+
+};
+
+#endif