O3CPU.py revision 10329:12e3be8203a5
1# Copyright (c) 2005-2007 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright
9# notice, this list of conditions and the following disclaimer in the
10# documentation and/or other materials provided with the distribution;
11# neither the name of the copyright holders nor the names of its
12# contributors may be used to endorse or promote products derived from
13# this software without specific prior written permission.
14#
15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27# Authors: Kevin Lim
28
29from m5.defines import buildEnv
30from m5.params import *
31from m5.proxy import *
32from BaseCPU import BaseCPU
33from FUPool import *
34from O3Checker import O3Checker
35from BranchPredictor import BranchPredictor
36
37class DerivO3CPU(BaseCPU):
38    type = 'DerivO3CPU'
39    cxx_header = 'cpu/o3/deriv.hh'
40
41    @classmethod
42    def memory_mode(cls):
43        return 'timing'
44
45    @classmethod
46    def require_caches(cls):
47        return True
48
49    @classmethod
50    def support_take_over(cls):
51        return True
52
53    activity = Param.Unsigned(0, "Initial count")
54
55    cachePorts = Param.Unsigned(200, "Cache Ports")
56
57    decodeToFetchDelay = Param.Cycles(1, "Decode to fetch delay")
58    renameToFetchDelay = Param.Cycles(1 ,"Rename to fetch delay")
59    iewToFetchDelay = Param.Cycles(1, "Issue/Execute/Writeback to fetch "
60                                   "delay")
61    commitToFetchDelay = Param.Cycles(1, "Commit to fetch delay")
62    fetchWidth = Param.Unsigned(8, "Fetch width")
63    fetchBufferSize = Param.Unsigned(64, "Fetch buffer size in bytes")
64    fetchQueueSize = Param.Unsigned(32, "Fetch queue size in micro-ops")
65
66    renameToDecodeDelay = Param.Cycles(1, "Rename to decode delay")
67    iewToDecodeDelay = Param.Cycles(1, "Issue/Execute/Writeback to decode "
68                                    "delay")
69    commitToDecodeDelay = Param.Cycles(1, "Commit to decode delay")
70    fetchToDecodeDelay = Param.Cycles(1, "Fetch to decode delay")
71    decodeWidth = Param.Unsigned(8, "Decode width")
72
73    iewToRenameDelay = Param.Cycles(1, "Issue/Execute/Writeback to rename "
74                                    "delay")
75    commitToRenameDelay = Param.Cycles(1, "Commit to rename delay")
76    decodeToRenameDelay = Param.Cycles(1, "Decode to rename delay")
77    renameWidth = Param.Unsigned(8, "Rename width")
78
79    commitToIEWDelay = Param.Cycles(1, "Commit to "
80               "Issue/Execute/Writeback delay")
81    renameToIEWDelay = Param.Cycles(2, "Rename to "
82               "Issue/Execute/Writeback delay")
83    issueToExecuteDelay = Param.Cycles(1, "Issue to execute delay (internal "
84              "to the IEW stage)")
85    dispatchWidth = Param.Unsigned(8, "Dispatch width")
86    issueWidth = Param.Unsigned(8, "Issue width")
87    wbWidth = Param.Unsigned(8, "Writeback width")
88    fuPool = Param.FUPool(DefaultFUPool(), "Functional Unit pool")
89
90    iewToCommitDelay = Param.Cycles(1, "Issue/Execute/Writeback to commit "
91               "delay")
92    renameToROBDelay = Param.Cycles(1, "Rename to reorder buffer delay")
93    commitWidth = Param.Unsigned(8, "Commit width")
94    squashWidth = Param.Unsigned(8, "Squash width")
95    trapLatency = Param.Cycles(13, "Trap latency")
96    fetchTrapLatency = Param.Cycles(1, "Fetch trap latency")
97
98    backComSize = Param.Unsigned(5, "Time buffer size for backwards communication")
99    forwardComSize = Param.Unsigned(5, "Time buffer size for forward communication")
100
101    LQEntries = Param.Unsigned(32, "Number of load queue entries")
102    SQEntries = Param.Unsigned(32, "Number of store queue entries")
103    LSQDepCheckShift = Param.Unsigned(4, "Number of places to shift addr before check")
104    LSQCheckLoads = Param.Bool(True,
105        "Should dependency violations be checked for loads & stores or just stores")
106    store_set_clear_period = Param.Unsigned(250000,
107            "Number of load/store insts before the dep predictor should be invalidated")
108    LFSTSize = Param.Unsigned(1024, "Last fetched store table size")
109    SSITSize = Param.Unsigned(1024, "Store set ID table size")
110
111    numRobs = Param.Unsigned(1, "Number of Reorder Buffers");
112
113    numPhysIntRegs = Param.Unsigned(256, "Number of physical integer registers")
114    numPhysFloatRegs = Param.Unsigned(256, "Number of physical floating point "
115                                      "registers")
116    # most ISAs don't use condition-code regs, so default is 0
117    _defaultNumPhysCCRegs = 0
118    if buildEnv['TARGET_ISA'] == 'x86':
119        # For x86, each CC reg is used to hold only a subset of the
120        # flags, so we need 4-5 times the number of CC regs as
121        # physical integer regs to be sure we don't run out.  In
122        # typical real machines, CC regs are not explicitly renamed
123        # (it's a side effect of int reg renaming), so they should
124        # never be the bottleneck here.
125        _defaultNumPhysCCRegs = Self.numPhysIntRegs * 5
126    numPhysCCRegs = Param.Unsigned(_defaultNumPhysCCRegs,
127                                   "Number of physical cc registers")
128    numIQEntries = Param.Unsigned(64, "Number of instruction queue entries")
129    numROBEntries = Param.Unsigned(192, "Number of reorder buffer entries")
130
131    smtNumFetchingThreads = Param.Unsigned(1, "SMT Number of Fetching Threads")
132    smtFetchPolicy = Param.String('SingleThread', "SMT Fetch policy")
133    smtLSQPolicy    = Param.String('Partitioned', "SMT LSQ Sharing Policy")
134    smtLSQThreshold = Param.Int(100, "SMT LSQ Threshold Sharing Parameter")
135    smtIQPolicy    = Param.String('Partitioned', "SMT IQ Sharing Policy")
136    smtIQThreshold = Param.Int(100, "SMT IQ Threshold Sharing Parameter")
137    smtROBPolicy   = Param.String('Partitioned', "SMT ROB Sharing Policy")
138    smtROBThreshold = Param.Int(100, "SMT ROB Threshold Sharing Parameter")
139    smtCommitPolicy = Param.String('RoundRobin', "SMT Commit Policy")
140
141    branchPred = Param.BranchPredictor(BranchPredictor(numThreads =
142                                                       Parent.numThreads),
143                                       "Branch Predictor")
144    needsTSO = Param.Bool(buildEnv['TARGET_ISA'] == 'x86',
145                          "Enable TSO Memory model")
146
147    def addCheckerCpu(self):
148        if buildEnv['TARGET_ISA'] in ['arm']:
149            from ArmTLB import ArmTLB
150
151            self.checker = O3Checker(workload=self.workload,
152                                     exitOnError=False,
153                                     updateOnError=True,
154                                     warnOnlyOnLoadError=True)
155            self.checker.itb = ArmTLB(size = self.itb.size)
156            self.checker.dtb = ArmTLB(size = self.dtb.size)
157            self.checker.cpu_id = self.cpu_id
158
159        else:
160            print "ERROR: Checker only supported under ARM ISA!"
161            exit(1)
162