BaseCPU.py revision 3170
11689SN/Afrom m5.SimObject import SimObject
22326SN/Afrom m5.params import *
31689SN/Afrom m5.proxy import *
41689SN/Afrom m5 import build_env
51689SN/Afrom AlphaTLB import AlphaDTB, AlphaITB
61689SN/Afrom Bus import Bus
71689SN/A
81689SN/Aclass BaseCPU(SimObject):
91689SN/A    type = 'BaseCPU'
101689SN/A    abstract = True
111689SN/A    mem = Param.MemObject("memory")
121689SN/A
131689SN/A    system = Param.System(Parent.any, "system object")
141689SN/A    cpu_id = Param.Int("CPU identifier")
151689SN/A
161689SN/A    if build_env['FULL_SYSTEM']:
171689SN/A        dtb = Param.AlphaDTB(AlphaDTB(), "Data TLB")
181689SN/A        itb = Param.AlphaITB(AlphaITB(), "Instruction TLB")
191689SN/A    else:
201689SN/A        workload = VectorParam.Process("processes to run")
211689SN/A
221689SN/A    max_insts_all_threads = Param.Counter(0,
231689SN/A        "terminate when all threads have reached this inst count")
241689SN/A    max_insts_any_thread = Param.Counter(0,
251689SN/A        "terminate when any thread reaches this inst count")
261689SN/A    max_loads_all_threads = Param.Counter(0,
272665Ssaidi@eecs.umich.edu        "terminate when all threads have reached this load count")
282665Ssaidi@eecs.umich.edu    max_loads_any_thread = Param.Counter(0,
291689SN/A        "terminate when any thread reaches this load count")
301689SN/A    progress_interval = Param.Tick(0, "interval to print out the progress message")
311060SN/A
321060SN/A    defer_registration = Param.Bool(False,
331689SN/A        "defer registration with system (for sampling)")
341060SN/A
351060SN/A    clock = Param.Clock(Parent.clock, "clock speed")
361060SN/A
371060SN/A    _mem_ports = []
382292SN/A
391717SN/A    def connectMemPorts(self, bus):
401060SN/A        for p in self._mem_ports:
411681SN/A            exec('self.%s = bus.port' % p)
422292SN/A
432873Sktlim@umich.edu    def addPrivateSplitL1Caches(self, ic, dc):
441060SN/A        assert(len(self._mem_ports) == 2)
451061SN/A        self.icache = ic
462292SN/A        self.dcache = dc
472292SN/A        self.icache_port = ic.cpu_side
482292SN/A        self.dcache_port = dc.cpu_side
492292SN/A        self._mem_ports = ['icache.mem_side', 'dcache.mem_side']
502820Sktlim@umich.edu#        self.mem = dc
512292SN/A
522820Sktlim@umich.edu    def addTwoLevelCacheHierarchy(self, ic, dc, l2c):
532820Sktlim@umich.edu        self.addPrivateSplitL1Caches(ic, dc)
542307SN/A        self.toL2Bus = Bus()
552307SN/A        self.connectMemPorts(self.toL2Bus)
561060SN/A        self.l2cache = l2c
572292SN/A        self.l2cache.cpu_side = self.toL2Bus.port
582292SN/A        self._mem_ports = ['l2cache.mem_side']
592292SN/A