MinorCPU.py revision 11567
113558Snikos.nikoleris@arm.com# Copyright (c) 2012-2014 ARM Limited 28839Sandreas.hansson@arm.com# All rights reserved. 38839Sandreas.hansson@arm.com# 48839Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall 58839Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual 68839Sandreas.hansson@arm.com# property including but not limited to intellectual property relating 78839Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software 88839Sandreas.hansson@arm.com# licensed hereunder. You may use the software subject to the license 98839Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated 108839Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software, 118839Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form. 128839Sandreas.hansson@arm.com# 133101Sstever@eecs.umich.edu# Copyright (c) 2007 The Regents of The University of Michigan 148579Ssteve.reinhardt@amd.com# All rights reserved. 153101Sstever@eecs.umich.edu# 163101Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 173101Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are 183101Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright 193101Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 203101Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 213101Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 223101Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution; 233101Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its 243101Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from 253101Sstever@eecs.umich.edu# this software without specific prior written permission. 263101Sstever@eecs.umich.edu# 273101Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 283101Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 293101Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 303101Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 313101Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 323101Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 333101Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 343101Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 353101Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 363101Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 373101Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 383101Sstever@eecs.umich.edu# 393101Sstever@eecs.umich.edu# Authors: Gabe Black 403101Sstever@eecs.umich.edu# Nathan Binkert 413101Sstever@eecs.umich.edu# Andrew Bardsley 427778Sgblack@eecs.umich.edu 438839Sandreas.hansson@arm.comfrom m5.defines import buildEnv 443101Sstever@eecs.umich.edufrom m5.params import * 453101Sstever@eecs.umich.edufrom m5.proxy import * 463101Sstever@eecs.umich.edufrom m5.SimObject import SimObject 473101Sstever@eecs.umich.edufrom BaseCPU import BaseCPU 483101Sstever@eecs.umich.edufrom DummyChecker import DummyChecker 493101Sstever@eecs.umich.edufrom BranchPredictor import * 503101Sstever@eecs.umich.edufrom TimingExpr import TimingExpr 513101Sstever@eecs.umich.edu 523101Sstever@eecs.umich.edufrom FuncUnit import OpClass 533101Sstever@eecs.umich.edu 543101Sstever@eecs.umich.educlass MinorOpClass(SimObject): 553101Sstever@eecs.umich.edu """Boxing of OpClass to get around build problems and provide a hook for 563101Sstever@eecs.umich.edu future additions to OpClass checks""" 573101Sstever@eecs.umich.edu 583101Sstever@eecs.umich.edu type = 'MinorOpClass' 593101Sstever@eecs.umich.edu cxx_header = "cpu/minor/func_unit.hh" 603101Sstever@eecs.umich.edu 613101Sstever@eecs.umich.edu opClass = Param.OpClass("op class to match") 6212563Sgabeblack@google.com 6312563Sgabeblack@google.comclass MinorOpClassSet(SimObject): 643885Sbinkertn@umich.edu """A set of matchable op classes""" 653885Sbinkertn@umich.edu 664762Snate@binkert.org type = 'MinorOpClassSet' 673885Sbinkertn@umich.edu cxx_header = "cpu/minor/func_unit.hh" 683885Sbinkertn@umich.edu 697528Ssteve.reinhardt@amd.com opClasses = VectorParam.MinorOpClass([], "op classes to be matched." 703885Sbinkertn@umich.edu " An empty list means any class") 714380Sbinkertn@umich.edu 724167Sbinkertn@umich.educlass MinorFUTiming(SimObject): 733102Sstever@eecs.umich.edu type = 'MinorFUTiming' 743101Sstever@eecs.umich.edu cxx_header = "cpu/minor/func_unit.hh" 754762Snate@binkert.org 764762Snate@binkert.org mask = Param.UInt64(0, "mask for testing ExtMachInst") 774762Snate@binkert.org match = Param.UInt64(0, "match value for testing ExtMachInst:" 784762Snate@binkert.org " (ext_mach_inst & mask) == match") 794762Snate@binkert.org suppress = Param.Bool(False, "if true, this inst. is not executed by" 804762Snate@binkert.org " this FU") 814762Snate@binkert.org extraCommitLat = Param.Cycles(0, "extra cycles to stall commit for" 824762Snate@binkert.org " this inst.") 834762Snate@binkert.org extraCommitLatExpr = Param.TimingExpr(NULL, "extra cycles as a" 845033Smilesck@eecs.umich.edu " run-time evaluated expression") 855033Smilesck@eecs.umich.edu extraAssumedLat = Param.Cycles(0, "extra cycles to add to scoreboard" 865033Smilesck@eecs.umich.edu " retire time for this insts dest registers once it leaves the" 875033Smilesck@eecs.umich.edu " functional unit. For mem refs, if this is 0, the result's time" 885033Smilesck@eecs.umich.edu " is marked as unpredictable and no forwarding can take place.") 895033Smilesck@eecs.umich.edu srcRegsRelativeLats = VectorParam.Cycles("the maximum number of cycles" 905033Smilesck@eecs.umich.edu " after inst. issue that each src reg can be available for this" 915033Smilesck@eecs.umich.edu " inst. to issue") 925033Smilesck@eecs.umich.edu opClasses = Param.MinorOpClassSet(MinorOpClassSet(), 935033Smilesck@eecs.umich.edu "op classes to be considered for this decode. An empty set means any" 943101Sstever@eecs.umich.edu " class") 953101Sstever@eecs.umich.edu description = Param.String('', "description string of the decoding/inst." 963101Sstever@eecs.umich.edu " class") 975033Smilesck@eecs.umich.edu 9810267SGeoffrey.Blake@arm.comdef minorMakeOpClassSet(op_classes): 998596Ssteve.reinhardt@amd.com """Make a MinorOpClassSet from a list of OpClass enum value strings""" 1008596Ssteve.reinhardt@amd.com def boxOpClass(op_class): 1018596Ssteve.reinhardt@amd.com return MinorOpClass(opClass=op_class) 1028596Ssteve.reinhardt@amd.com 1037673Snate@binkert.org return MinorOpClassSet(opClasses=map(boxOpClass, op_classes)) 1047673Snate@binkert.org 1057673Snate@binkert.orgclass MinorFU(SimObject): 1067673Snate@binkert.org type = 'MinorFU' 10711988Sandreas.sandberg@arm.com cxx_header = "cpu/minor/func_unit.hh" 10811988Sandreas.sandberg@arm.com 10911988Sandreas.sandberg@arm.com opClasses = Param.MinorOpClassSet(MinorOpClassSet(), "type of operations" 11011988Sandreas.sandberg@arm.com " allowed on this functional unit") 1113101Sstever@eecs.umich.edu opLat = Param.Cycles(1, "latency in cycles") 1123101Sstever@eecs.umich.edu issueLat = Param.Cycles(1, "cycles until another instruction can be" 1133101Sstever@eecs.umich.edu " issued") 1143101Sstever@eecs.umich.edu timings = VectorParam.MinorFUTiming([], "extra decoding rules") 1153101Sstever@eecs.umich.edu 11610380SAndrew.Bardsley@arm.com cantForwardFromFUIndices = VectorParam.Unsigned([], 11710380SAndrew.Bardsley@arm.com "list of FU indices from which this FU can't receive and early" 11810380SAndrew.Bardsley@arm.com " (forwarded) result") 11910380SAndrew.Bardsley@arm.com 12010380SAndrew.Bardsley@arm.comclass MinorFUPool(SimObject): 12110380SAndrew.Bardsley@arm.com type = 'MinorFUPool' 12210458Sandreas.hansson@arm.com cxx_header = "cpu/minor/func_unit.hh" 12310458Sandreas.hansson@arm.com 12410458Sandreas.hansson@arm.com funcUnits = VectorParam.MinorFU("functional units") 12510458Sandreas.hansson@arm.com 12610458Sandreas.hansson@arm.comclass MinorDefaultIntFU(MinorFU): 12710458Sandreas.hansson@arm.com opClasses = minorMakeOpClassSet(['IntAlu']) 12810458Sandreas.hansson@arm.com timings = [MinorFUTiming(description="Int", 12910458Sandreas.hansson@arm.com srcRegsRelativeLats=[2])] 13010458Sandreas.hansson@arm.com opLat = 3 13110458Sandreas.hansson@arm.com 13210458Sandreas.hansson@arm.comclass MinorDefaultIntMulFU(MinorFU): 13310458Sandreas.hansson@arm.com opClasses = minorMakeOpClassSet(['IntMult']) 1343101Sstever@eecs.umich.edu timings = [MinorFUTiming(description='Mul', 1353101Sstever@eecs.umich.edu srcRegsRelativeLats=[0])] 1363101Sstever@eecs.umich.edu opLat = 3 1373101Sstever@eecs.umich.edu 1383101Sstever@eecs.umich.educlass MinorDefaultIntDivFU(MinorFU): 13910267SGeoffrey.Blake@arm.com opClasses = minorMakeOpClassSet(['IntDiv']) 14010267SGeoffrey.Blake@arm.com issueLat = 9 14110267SGeoffrey.Blake@arm.com opLat = 9 14210267SGeoffrey.Blake@arm.com 1433101Sstever@eecs.umich.educlass MinorDefaultFloatSimdFU(MinorFU): 1443101Sstever@eecs.umich.edu opClasses = minorMakeOpClassSet([ 1453101Sstever@eecs.umich.edu 'FloatAdd', 'FloatCmp', 'FloatCvt', 'FloatMult', 'FloatDiv', 1463101Sstever@eecs.umich.edu 'FloatSqrt', 1473101Sstever@eecs.umich.edu 'SimdAdd', 'SimdAddAcc', 'SimdAlu', 'SimdCmp', 'SimdCvt', 1483101Sstever@eecs.umich.edu 'SimdMisc', 'SimdMult', 'SimdMultAcc', 'SimdShift', 'SimdShiftAcc', 1493101Sstever@eecs.umich.edu 'SimdSqrt', 'SimdFloatAdd', 'SimdFloatAlu', 'SimdFloatCmp', 1503101Sstever@eecs.umich.edu 'SimdFloatCvt', 'SimdFloatDiv', 'SimdFloatMisc', 'SimdFloatMult', 1513101Sstever@eecs.umich.edu 'SimdFloatMultAcc', 'SimdFloatSqrt']) 1523101Sstever@eecs.umich.edu timings = [MinorFUTiming(description='FloatSimd', 1533101Sstever@eecs.umich.edu srcRegsRelativeLats=[2])] 1543101Sstever@eecs.umich.edu opLat = 6 1553101Sstever@eecs.umich.edu 1563101Sstever@eecs.umich.educlass MinorDefaultMemFU(MinorFU): 1573101Sstever@eecs.umich.edu opClasses = minorMakeOpClassSet(['MemRead', 'MemWrite']) 15813663Sandreas.sandberg@arm.com timings = [MinorFUTiming(description='Mem', 1593101Sstever@eecs.umich.edu srcRegsRelativeLats=[1], extraAssumedLat=2)] 16013675Sandreas.sandberg@arm.com opLat = 1 1613101Sstever@eecs.umich.edu 1623101Sstever@eecs.umich.educlass MinorDefaultMiscFU(MinorFU): 1633101Sstever@eecs.umich.edu opClasses = minorMakeOpClassSet(['IprAccess', 'InstPrefetch']) 1643101Sstever@eecs.umich.edu opLat = 1 16513675Sandreas.sandberg@arm.com 1663101Sstever@eecs.umich.educlass MinorDefaultFUPool(MinorFUPool): 1673101Sstever@eecs.umich.edu funcUnits = [MinorDefaultIntFU(), MinorDefaultIntFU(), 1683101Sstever@eecs.umich.edu MinorDefaultIntMulFU(), MinorDefaultIntDivFU(), 1693101Sstever@eecs.umich.edu MinorDefaultFloatSimdFU(), MinorDefaultMemFU(), 1703101Sstever@eecs.umich.edu MinorDefaultMiscFU()] 17113663Sandreas.sandberg@arm.com 1723101Sstever@eecs.umich.educlass ThreadPolicy(Enum): vals = ['SingleThreaded', 'RoundRobin', 'Random'] 1733101Sstever@eecs.umich.edu 17413663Sandreas.sandberg@arm.comclass MinorCPU(BaseCPU): 1753101Sstever@eecs.umich.edu type = 'MinorCPU' 1763101Sstever@eecs.umich.edu cxx_header = "cpu/minor/cpu.hh" 1773101Sstever@eecs.umich.edu 1785033Smilesck@eecs.umich.edu @classmethod 1796656Snate@binkert.org def memory_mode(cls): 1805033Smilesck@eecs.umich.edu return 'timing' 1815033Smilesck@eecs.umich.edu 1825033Smilesck@eecs.umich.edu @classmethod 18313663Sandreas.sandberg@arm.com def require_caches(cls): 18413663Sandreas.sandberg@arm.com return True 1853101Sstever@eecs.umich.edu 18610267SGeoffrey.Blake@arm.com @classmethod 18710267SGeoffrey.Blake@arm.com def support_take_over(cls): 18810267SGeoffrey.Blake@arm.com return True 18910267SGeoffrey.Blake@arm.com 19010267SGeoffrey.Blake@arm.com threadPolicy = Param.ThreadPolicy('RoundRobin', 19110267SGeoffrey.Blake@arm.com "Thread scheduling policy") 19210267SGeoffrey.Blake@arm.com fetch1FetchLimit = Param.Unsigned(1, 19310267SGeoffrey.Blake@arm.com "Number of line fetches allowable in flight at once") 19410267SGeoffrey.Blake@arm.com fetch1LineSnapWidth = Param.Unsigned(0, 19510267SGeoffrey.Blake@arm.com "Fetch1 'line' fetch snap size in bytes" 19610267SGeoffrey.Blake@arm.com " (0 means use system cache line size)") 19710267SGeoffrey.Blake@arm.com fetch1LineWidth = Param.Unsigned(0, 19810267SGeoffrey.Blake@arm.com "Fetch1 maximum fetch size in bytes (0 means use system cache" 1993101Sstever@eecs.umich.edu " line size)") 2003101Sstever@eecs.umich.edu fetch1ToFetch2ForwardDelay = Param.Cycles(1, 2013101Sstever@eecs.umich.edu "Forward cycle delay from Fetch1 to Fetch2 (1 means next cycle)") 2023101Sstever@eecs.umich.edu fetch1ToFetch2BackwardDelay = Param.Cycles(1, 20313699Sandreas.sandberg@arm.com "Backward cycle delay from Fetch2 to Fetch1 for branch prediction" 2043101Sstever@eecs.umich.edu " signalling (0 means in the same cycle, 1 mean the next cycle)") 2053101Sstever@eecs.umich.edu 2063101Sstever@eecs.umich.edu fetch2InputBufferSize = Param.Unsigned(2, 2073101Sstever@eecs.umich.edu "Size of input buffer to Fetch2 in cycles-worth of insts.") 2083101Sstever@eecs.umich.edu fetch2ToDecodeForwardDelay = Param.Cycles(1, 2093102Sstever@eecs.umich.edu "Forward cycle delay from Fetch2 to Decode (1 means next cycle)") 2103101Sstever@eecs.umich.edu fetch2CycleInput = Param.Bool(True, 2113101Sstever@eecs.umich.edu "Allow Fetch2 to cross input lines to generate full output each" 2123101Sstever@eecs.umich.edu " cycle") 21310267SGeoffrey.Blake@arm.com 21410267SGeoffrey.Blake@arm.com decodeInputBufferSize = Param.Unsigned(3, 21510267SGeoffrey.Blake@arm.com "Size of input buffer to Decode in cycles-worth of insts.") 21610267SGeoffrey.Blake@arm.com decodeToExecuteForwardDelay = Param.Cycles(1, 21710267SGeoffrey.Blake@arm.com "Forward cycle delay from Decode to Execute (1 means next cycle)") 21810267SGeoffrey.Blake@arm.com decodeInputWidth = Param.Unsigned(2, 21910267SGeoffrey.Blake@arm.com "Width (in instructions) of input to Decode (and implicitly" 2207673Snate@binkert.org " Decode's own width)") 2218607Sgblack@eecs.umich.edu decodeCycleInput = Param.Bool(True, 2227673Snate@binkert.org "Allow Decode to pack instructions from more than one input cycle" 2233101Sstever@eecs.umich.edu " to fill its output each cycle") 22411988Sandreas.sandberg@arm.com 22511988Sandreas.sandberg@arm.com executeInputWidth = Param.Unsigned(2, 22611988Sandreas.sandberg@arm.com "Width (in instructions) of input to Execute") 2277673Snate@binkert.org executeCycleInput = Param.Bool(True, 2287673Snate@binkert.org "Allow Execute to use instructions from more than one input cycle" 2293101Sstever@eecs.umich.edu " each cycle") 2303101Sstever@eecs.umich.edu executeIssueLimit = Param.Unsigned(2, 2313101Sstever@eecs.umich.edu "Number of issuable instructions in Execute each cycle") 2323101Sstever@eecs.umich.edu executeMemoryIssueLimit = Param.Unsigned(1, 2333101Sstever@eecs.umich.edu "Number of issuable memory instructions in Execute each cycle") 2343101Sstever@eecs.umich.edu executeCommitLimit = Param.Unsigned(2, 2355033Smilesck@eecs.umich.edu "Number of committable instructions in Execute each cycle") 2365475Snate@binkert.org executeMemoryCommitLimit = Param.Unsigned(1, 23713663Sandreas.sandberg@arm.com "Number of committable memory references in Execute each cycle") 23813663Sandreas.sandberg@arm.com executeInputBufferSize = Param.Unsigned(7, 2395475Snate@binkert.org "Size of input buffer to Execute in cycles-worth of insts.") 24010380SAndrew.Bardsley@arm.com executeMemoryWidth = Param.Unsigned(0, 24110380SAndrew.Bardsley@arm.com "Width (and snap) in bytes of the data memory interface. (0 mean use" 24210380SAndrew.Bardsley@arm.com " the system cacheLineSize)") 2433101Sstever@eecs.umich.edu executeMaxAccessesInMemory = Param.Unsigned(2, 2443101Sstever@eecs.umich.edu "Maximum number of concurrent accesses allowed to the memory system" 2453101Sstever@eecs.umich.edu " from the dcache port") 2464762Snate@binkert.org executeLSQMaxStoreBufferStoresPerCycle = Param.Unsigned(2, 2474762Snate@binkert.org "Maximum number of stores that the store buffer can issue per cycle") 2484762Snate@binkert.org executeLSQRequestsQueueSize = Param.Unsigned(1, 2493101Sstever@eecs.umich.edu "Size of LSQ requests queue (address translation queue)") 25012050Snikos.nikoleris@arm.com executeLSQTransfersQueueSize = Param.Unsigned(2, 25112050Snikos.nikoleris@arm.com "Size of LSQ transfers queue (memory transaction queue)") 25212050Snikos.nikoleris@arm.com executeLSQStoreBufferSize = Param.Unsigned(5, 2538459SAli.Saidi@ARM.com "Size of LSQ store buffer") 2548459SAli.Saidi@ARM.com executeBranchDelay = Param.Cycles(1, 25512050Snikos.nikoleris@arm.com "Delay from Execute deciding to branch and Fetch1 reacting" 2563101Sstever@eecs.umich.edu " (1 means next cycle)") 2577528Ssteve.reinhardt@amd.com 2587528Ssteve.reinhardt@amd.com executeFuncUnits = Param.MinorFUPool(MinorDefaultFUPool(), 2597528Ssteve.reinhardt@amd.com "FUlines for this processor") 2607528Ssteve.reinhardt@amd.com 2617528Ssteve.reinhardt@amd.com executeSetTraceTimeOnCommit = Param.Bool(True, 2627528Ssteve.reinhardt@amd.com "Set inst. trace times to be commit times") 2633101Sstever@eecs.umich.edu executeSetTraceTimeOnIssue = Param.Bool(False, 2647528Ssteve.reinhardt@amd.com "Set inst. trace times to be issue times") 2657528Ssteve.reinhardt@amd.com 2667528Ssteve.reinhardt@amd.com executeAllowEarlyMemoryIssue = Param.Bool(True, 2677528Ssteve.reinhardt@amd.com "Allow mem refs to be issued to the LSQ before reaching the head of" 2687528Ssteve.reinhardt@amd.com " the in flight insts queue") 2697528Ssteve.reinhardt@amd.com 2707528Ssteve.reinhardt@amd.com enableIdling = Param.Bool(True, 2717528Ssteve.reinhardt@amd.com "Enable cycle skipping when the processor is idle\n"); 2727528Ssteve.reinhardt@amd.com 2737528Ssteve.reinhardt@amd.com branchPred = Param.BranchPredictor(TournamentBP( 2748321Ssteve.reinhardt@amd.com numThreads = Parent.numThreads), "Branch Predictor") 27512194Sgabeblack@google.com 2767528Ssteve.reinhardt@amd.com def addCheckerCpu(self): 2777528Ssteve.reinhardt@amd.com print "Checker not yet supported by MinorCPU" 2787528Ssteve.reinhardt@amd.com exit(1) 2797528Ssteve.reinhardt@amd.com