QoSPolicy.py revision 12968:1c2b8dd9241f
11689SN/A# Copyright (c) 2018 ARM Limited 27944SGiacomo.Gabrielli@arm.com# All rights reserved. 37944SGiacomo.Gabrielli@arm.com# 47944SGiacomo.Gabrielli@arm.com# The license below extends only to copyright in the software and shall 57944SGiacomo.Gabrielli@arm.com# not be construed as granting a license to any other intellectual 67944SGiacomo.Gabrielli@arm.com# property including but not limited to intellectual property relating 77944SGiacomo.Gabrielli@arm.com# to a hardware implementation of the functionality of the software 87944SGiacomo.Gabrielli@arm.com# licensed hereunder. You may use the software subject to the license 97944SGiacomo.Gabrielli@arm.com# terms below provided that you ensure that this notice is replicated 107944SGiacomo.Gabrielli@arm.com# unmodified and in its entirety in all distributions of the software, 117944SGiacomo.Gabrielli@arm.com# modified or unmodified, in source code or in binary form. 127944SGiacomo.Gabrielli@arm.com# 137944SGiacomo.Gabrielli@arm.com# Redistribution and use in source and binary forms, with or without 142326SN/A# modification, are permitted provided that the following conditions are 151689SN/A# met: redistributions of source code must retain the above copyright 161689SN/A# notice, this list of conditions and the following disclaimer; 171689SN/A# redistributions in binary form must reproduce the above copyright 181689SN/A# notice, this list of conditions and the following disclaimer in the 191689SN/A# documentation and/or other materials provided with the distribution; 201689SN/A# neither the name of the copyright holders nor the names of its 211689SN/A# contributors may be used to endorse or promote products derived from 221689SN/A# this software without specific prior written permission. 231689SN/A# 241689SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 251689SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 261689SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 271689SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 281689SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 291689SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 301689SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 311689SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 321689SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 331689SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 341689SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 351689SN/A# 361689SN/A# Authors: Giacomo Travaglini 371689SN/A 381689SN/Afrom m5.SimObject import * 392665Ssaidi@eecs.umich.edufrom m5.params import * 402665Ssaidi@eecs.umich.edu 412831Sksewell@umich.edu# QoS scheduler policy used to serve incoming transaction 421689SN/Aclass QoSPolicy(SimObject): 431689SN/A type = 'QoSPolicy' 442064SN/A abstract = True 451060SN/A cxx_header = "mem/qos/policy.hh" 461060SN/A cxx_class = 'QoS::Policy' 472292SN/A 481717SN/Aclass QoSFixedPriorityPolicy(QoSPolicy): 498232Snate@binkert.org type = 'QoSFixedPriorityPolicy' 504762Snate@binkert.org cxx_header = "mem/qos/policy_fixed_prio.hh" 516221Snate@binkert.org cxx_class = 'QoS::FixedPriorityPolicy' 524762Snate@binkert.org 531060SN/A cxx_exports = [ 546221Snate@binkert.org PyBindMethod('initMasterName'), 555529Snate@binkert.org PyBindMethod('initMasterObj'), 561061SN/A ] 572292SN/A 585606Snate@binkert.org _mpriorities = None 595606Snate@binkert.org 605606Snate@binkert.org def setMasterPriority(self, master, priority): 611060SN/A if not self._mpriorities: 622292SN/A self._mpriorities = [] 632292SN/A 642292SN/A self._mpriorities.append([master, priority]) 652292SN/A 662292SN/A def init(self): 672292SN/A if not self._mpriorities: 682292SN/A print("Error, use setMasterPriority to init masters/priorities\n"); 692326SN/A exit(1) 702292SN/A else: 712292SN/A for mprio in self._mpriorities: 722292SN/A master = mprio[0] 732292SN/A priority = mprio[1] 742292SN/A if isinstance(master, basestring): 752292SN/A self.getCCObject().initMasterName( 765336Shines@cs.fsu.edu master, int(priority)) 772292SN/A else: 784873Sstever@eecs.umich.edu self.getCCObject().initMasterObj( 792292SN/A master.getCCObject(), priority) 802292SN/A 812292SN/A # default fixed priority value for non-listed Masters 824329Sktlim@umich.edu qos_fixed_prio_default_prio = Param.UInt8(0, 835529Snate@binkert.org "Default priority for non-listed Masters") 844329Sktlim@umich.edu