110249Sstephan.diestelhorst@arm.com# Copyright (c) 2013-2014 ARM Limited
29793Sakash.bagdia@arm.com# All rights reserved.
39793Sakash.bagdia@arm.com#
49793Sakash.bagdia@arm.com# The license below extends only to copyright in the software and shall
59793Sakash.bagdia@arm.com# not be construed as granting a license to any other intellectual
69793Sakash.bagdia@arm.com# property including but not limited to intellectual property relating
79793Sakash.bagdia@arm.com# to a hardware implementation of the functionality of the software
89793Sakash.bagdia@arm.com# licensed hereunder.  You may use the software subject to the license
99793Sakash.bagdia@arm.com# terms below provided that you ensure that this notice is replicated
109793Sakash.bagdia@arm.com# unmodified and in its entirety in all distributions of the software,
119793Sakash.bagdia@arm.com# modified or unmodified, in source code or in binary form.
129793Sakash.bagdia@arm.com#
139793Sakash.bagdia@arm.com# Redistribution and use in source and binary forms, with or without
149793Sakash.bagdia@arm.com# modification, are permitted provided that the following conditions are
159793Sakash.bagdia@arm.com# met: redistributions of source code must retain the above copyright
169793Sakash.bagdia@arm.com# notice, this list of conditions and the following disclaimer;
179793Sakash.bagdia@arm.com# redistributions in binary form must reproduce the above copyright
189793Sakash.bagdia@arm.com# notice, this list of conditions and the following disclaimer in the
199793Sakash.bagdia@arm.com# documentation and/or other materials provided with the distribution;
209793Sakash.bagdia@arm.com# neither the name of the copyright holders nor the names of its
219793Sakash.bagdia@arm.com# contributors may be used to endorse or promote products derived from
229793Sakash.bagdia@arm.com# this software without specific prior written permission.
239793Sakash.bagdia@arm.com#
249793Sakash.bagdia@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
259793Sakash.bagdia@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
269793Sakash.bagdia@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
279793Sakash.bagdia@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
289793Sakash.bagdia@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
299793Sakash.bagdia@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
309793Sakash.bagdia@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
319793Sakash.bagdia@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
329793Sakash.bagdia@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
339793Sakash.bagdia@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
349793Sakash.bagdia@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
359793Sakash.bagdia@arm.com#
369793Sakash.bagdia@arm.com# Authors: Vasileios Spiliopoulos
379793Sakash.bagdia@arm.com#          Akash Bagdia
3810249Sstephan.diestelhorst@arm.com#          Stephan Diestelhorst
399793Sakash.bagdia@arm.com
409793Sakash.bagdia@arm.comfrom m5.params import *
419793Sakash.bagdia@arm.comfrom m5.SimObject import SimObject
429827Sakash.bagdia@arm.comfrom m5.proxy import *
439793Sakash.bagdia@arm.com
449793Sakash.bagdia@arm.com# Abstract clock domain
459793Sakash.bagdia@arm.comclass ClockDomain(SimObject):
469793Sakash.bagdia@arm.com    type = 'ClockDomain'
479793Sakash.bagdia@arm.com    cxx_header = "sim/clock_domain.hh"
489793Sakash.bagdia@arm.com    abstract = True
499793Sakash.bagdia@arm.com
5010249Sstephan.diestelhorst@arm.com# Source clock domain with an actual clock, and a list of voltage and frequency
5110249Sstephan.diestelhorst@arm.com# op points
529793Sakash.bagdia@arm.comclass SrcClockDomain(ClockDomain):
539793Sakash.bagdia@arm.com    type = 'SrcClockDomain'
549793Sakash.bagdia@arm.com    cxx_header = "sim/clock_domain.hh"
5510249Sstephan.diestelhorst@arm.com
5610249Sstephan.diestelhorst@arm.com    # Single clock frequency value, or list of frequencies for DVFS
5710249Sstephan.diestelhorst@arm.com    # Frequencies must be ordered in descending order
5810249Sstephan.diestelhorst@arm.com    # Note: Matching voltages should be defined in the voltage domain
5910249Sstephan.diestelhorst@arm.com    clock = VectorParam.Clock("Clock period")
609793Sakash.bagdia@arm.com
619827Sakash.bagdia@arm.com    # A source clock must be associated with a voltage domain
629827Sakash.bagdia@arm.com    voltage_domain = Param.VoltageDomain("Voltage domain")
639827Sakash.bagdia@arm.com
6410249Sstephan.diestelhorst@arm.com    # Domain ID is an identifier for the DVFS domain as understood by the
6510249Sstephan.diestelhorst@arm.com    # necessary control logic (either software or hardware). For example, in
6610249Sstephan.diestelhorst@arm.com    # case of software control via cpufreq framework the IDs should correspond
6710249Sstephan.diestelhorst@arm.com    # to the neccessary identifier in the device tree blob which is interpretted
6810249Sstephan.diestelhorst@arm.com    # by the device driver to communicate to the domain controller in hardware.
6910249Sstephan.diestelhorst@arm.com    domain_id = Param.Int32(-1, "domain id")
7010249Sstephan.diestelhorst@arm.com
7110249Sstephan.diestelhorst@arm.com    # Initial performance level from the list of available operation points
7210249Sstephan.diestelhorst@arm.com    # Defaults to maximum performance
7310249Sstephan.diestelhorst@arm.com    init_perf_level = Param.UInt32(0, "Initial performance level")
7410249Sstephan.diestelhorst@arm.com
759793Sakash.bagdia@arm.com# Derived clock domain with a parent clock domain and a frequency
769793Sakash.bagdia@arm.com# divider
779793Sakash.bagdia@arm.comclass DerivedClockDomain(ClockDomain):
789793Sakash.bagdia@arm.com    type = 'DerivedClockDomain'
799793Sakash.bagdia@arm.com    cxx_header = "sim/clock_domain.hh"
809793Sakash.bagdia@arm.com    clk_domain = Param.ClockDomain("Parent clock domain")
819793Sakash.bagdia@arm.com    clk_divider = Param.Unsigned(1, "Frequency divider")
82