2012-02-13 12:43:09 +01:00
|
|
|
# Copyright (c) 2012 ARM Limited
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# The license below extends only to copyright in the software and shall
|
|
|
|
# not be construed as granting a license to any other intellectual
|
|
|
|
# property including but not limited to intellectual property relating
|
|
|
|
# to a hardware implementation of the functionality of the software
|
|
|
|
# licensed hereunder. You may use the software subject to the license
|
|
|
|
# terms below provided that you ensure that this notice is replicated
|
|
|
|
# unmodified and in its entirety in all distributions of the software,
|
|
|
|
# modified or unmodified, in source code or in binary form.
|
|
|
|
#
|
2008-02-06 05:44:13 +01:00
|
|
|
# Copyright (c) 2005-2008 The Regents of The University of Michigan
|
2011-02-07 07:14:17 +01:00
|
|
|
# Copyright (c) 2011 Regents of the University of California
|
2007-05-28 04:21:17 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are
|
|
|
|
# met: redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer;
|
|
|
|
# redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution;
|
|
|
|
# neither the name of the copyright holders nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived from
|
|
|
|
# this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# Authors: Nathan Binkert
|
2011-02-07 07:14:17 +01:00
|
|
|
# Rick Strong
|
2012-02-13 12:43:09 +01:00
|
|
|
# Andreas Hansson
|
2007-05-28 04:21:17 +02:00
|
|
|
|
2009-09-23 00:24:16 +02:00
|
|
|
import sys
|
|
|
|
|
|
|
|
from m5.defines import buildEnv
|
2006-09-05 02:14:07 +02:00
|
|
|
from m5.params import *
|
|
|
|
from m5.proxy import *
|
2009-09-23 00:24:16 +02:00
|
|
|
|
2006-08-16 18:52:05 +02:00
|
|
|
from Bus import Bus
|
2007-07-29 05:30:43 +02:00
|
|
|
from InstTracer import InstTracer
|
|
|
|
from ExeTracer import ExeTracer
|
2009-09-23 00:24:16 +02:00
|
|
|
from MemObject import MemObject
|
2006-06-10 05:01:31 +02:00
|
|
|
|
2007-07-29 05:30:43 +02:00
|
|
|
default_tracer = ExeTracer()
|
|
|
|
|
2009-09-23 00:24:16 +02:00
|
|
|
if buildEnv['TARGET_ISA'] == 'alpha':
|
2009-04-09 07:21:27 +02:00
|
|
|
from AlphaTLB import AlphaDTB, AlphaITB
|
2011-10-09 09:15:50 +02:00
|
|
|
from AlphaInterrupts import AlphaInterrupts
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'sparc':
|
2009-04-09 07:21:27 +02:00
|
|
|
from SparcTLB import SparcTLB
|
2011-10-09 09:15:50 +02:00
|
|
|
from SparcInterrupts import SparcInterrupts
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'x86':
|
2009-04-09 07:21:27 +02:00
|
|
|
from X86TLB import X86TLB
|
2011-10-09 09:15:50 +02:00
|
|
|
from X86LocalApic import X86LocalApic
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'mips':
|
2009-04-09 07:21:27 +02:00
|
|
|
from MipsTLB import MipsTLB
|
2011-10-09 09:15:50 +02:00
|
|
|
from MipsInterrupts import MipsInterrupts
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'arm':
|
2009-04-22 00:40:25 +02:00
|
|
|
from ArmTLB import ArmTLB
|
2011-10-09 09:15:50 +02:00
|
|
|
from ArmInterrupts import ArmInterrupts
|
2009-10-27 17:24:39 +01:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'power':
|
|
|
|
from PowerTLB import PowerTLB
|
2011-10-09 09:15:50 +02:00
|
|
|
from PowerInterrupts import PowerInterrupts
|
2007-05-28 04:21:17 +02:00
|
|
|
|
2008-08-11 21:22:16 +02:00
|
|
|
class BaseCPU(MemObject):
|
2005-02-03 03:13:01 +01:00
|
|
|
type = 'BaseCPU'
|
2005-01-15 10:12:25 +01:00
|
|
|
abstract = True
|
|
|
|
|
2006-07-13 02:22:07 +02:00
|
|
|
system = Param.System(Parent.any, "system object")
|
2008-11-03 03:56:57 +01:00
|
|
|
cpu_id = Param.Int(-1, "CPU identifier")
|
2008-08-11 21:22:16 +02:00
|
|
|
numThreads = Param.Unsigned(1, "number of HW thread contexts")
|
|
|
|
|
|
|
|
function_trace = Param.Bool(False, "Enable function trace")
|
|
|
|
function_trace_start = Param.Tick(0, "Cycle to start function trace")
|
|
|
|
|
2009-01-31 01:08:13 +01:00
|
|
|
checker = Param.BaseCPU(NULL, "checker CPU")
|
2006-10-08 19:53:24 +02:00
|
|
|
|
2008-12-17 18:51:18 +01:00
|
|
|
do_checkpoint_insts = Param.Bool(True,
|
|
|
|
"enable checkpoint pseudo instructions")
|
|
|
|
do_statistics_insts = Param.Bool(True,
|
|
|
|
"enable statistics pseudo instructions")
|
|
|
|
|
2011-11-02 10:11:14 +01:00
|
|
|
profile = Param.Latency('0ns', "trace the kernel stack")
|
|
|
|
do_quiesce = Param.Bool(True, "enable quiesce instructions")
|
|
|
|
|
2011-11-18 10:33:28 +01:00
|
|
|
workload = VectorParam.Process([], "processes to run")
|
2005-01-15 10:12:25 +01:00
|
|
|
|
2009-09-23 00:24:16 +02:00
|
|
|
if buildEnv['TARGET_ISA'] == 'sparc':
|
2009-04-09 07:21:27 +02:00
|
|
|
dtb = Param.SparcTLB(SparcTLB(), "Data TLB")
|
|
|
|
itb = Param.SparcTLB(SparcTLB(), "Instruction TLB")
|
2011-10-09 09:15:50 +02:00
|
|
|
interrupts = Param.SparcInterrupts(
|
2008-10-12 18:09:56 +02:00
|
|
|
SparcInterrupts(), "Interrupt Controller")
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'alpha':
|
2009-04-09 07:21:27 +02:00
|
|
|
dtb = Param.AlphaTLB(AlphaDTB(), "Data TLB")
|
|
|
|
itb = Param.AlphaTLB(AlphaITB(), "Instruction TLB")
|
2011-10-09 09:15:50 +02:00
|
|
|
interrupts = Param.AlphaInterrupts(
|
2008-10-12 18:09:56 +02:00
|
|
|
AlphaInterrupts(), "Interrupt Controller")
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'x86':
|
2009-04-09 07:21:27 +02:00
|
|
|
dtb = Param.X86TLB(X86TLB(), "Data TLB")
|
|
|
|
itb = Param.X86TLB(X86TLB(), "Instruction TLB")
|
2011-10-09 09:15:50 +02:00
|
|
|
_localApic = X86LocalApic(pio_addr=0x2000000000000000)
|
|
|
|
interrupts = Param.X86LocalApic(_localApic, "Interrupt Controller")
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'mips':
|
2009-04-09 07:21:27 +02:00
|
|
|
dtb = Param.MipsTLB(MipsTLB(), "Data TLB")
|
|
|
|
itb = Param.MipsTLB(MipsTLB(), "Instruction TLB")
|
2011-10-09 09:15:50 +02:00
|
|
|
interrupts = Param.MipsInterrupts(
|
|
|
|
MipsInterrupts(), "Interrupt Controller")
|
2009-09-23 00:24:16 +02:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'arm':
|
2009-04-22 00:40:25 +02:00
|
|
|
dtb = Param.ArmTLB(ArmTLB(), "Data TLB")
|
|
|
|
itb = Param.ArmTLB(ArmTLB(), "Instruction TLB")
|
2011-10-09 09:15:50 +02:00
|
|
|
interrupts = Param.ArmInterrupts(
|
|
|
|
ArmInterrupts(), "Interrupt Controller")
|
2009-10-27 17:24:39 +01:00
|
|
|
elif buildEnv['TARGET_ISA'] == 'power':
|
|
|
|
UnifiedTLB = Param.Bool(True, "Is this a Unified TLB?")
|
|
|
|
dtb = Param.PowerTLB(PowerTLB(), "Data TLB")
|
|
|
|
itb = Param.PowerTLB(PowerTLB(), "Instruction TLB")
|
2011-10-09 09:15:50 +02:00
|
|
|
interrupts = Param.PowerInterrupts(
|
|
|
|
PowerInterrupts(), "Interrupt Controller")
|
2007-08-27 05:24:18 +02:00
|
|
|
else:
|
|
|
|
print "Don't know what TLB to use for ISA %s" % \
|
2009-09-23 00:24:16 +02:00
|
|
|
buildEnv['TARGET_ISA']
|
2007-08-27 05:24:18 +02:00
|
|
|
sys.exit(1)
|
|
|
|
|
2005-01-15 10:12:25 +01:00
|
|
|
max_insts_all_threads = Param.Counter(0,
|
|
|
|
"terminate when all threads have reached this inst count")
|
|
|
|
max_insts_any_thread = Param.Counter(0,
|
|
|
|
"terminate when any thread reaches this inst count")
|
|
|
|
max_loads_all_threads = Param.Counter(0,
|
|
|
|
"terminate when all threads have reached this load count")
|
|
|
|
max_loads_any_thread = Param.Counter(0,
|
|
|
|
"terminate when any thread reaches this load count")
|
2006-12-30 01:57:45 +01:00
|
|
|
progress_interval = Param.Tick(0,
|
|
|
|
"interval to print out the progress message")
|
2005-01-15 10:12:25 +01:00
|
|
|
|
2005-02-03 23:04:54 +01:00
|
|
|
defer_registration = Param.Bool(False,
|
2005-01-15 10:12:25 +01:00
|
|
|
"defer registration with system (for sampling)")
|
Make the notion of a global event tick independent of the actual
CPU cycle ticks. This allows the user to have CPUs of different
frequencies, and also allows frequencies and latencies that are
not evenly divisible by the CPU frequency. For now, the CPU
frequency is still set to the global frequency, but soon, we'll
hopefully make the global frequency fixed at something like 1THz
and set all other frequencies independently.
arch/alpha/ev5.cc:
The cycles counter is based on the current cpu cycle.
cpu/base_cpu.cc:
frequency isn't the cpu parameter anymore, cycleTime is.
cpu/base_cpu.hh:
frequency isn't the cpu parameter anymore, cycleTime is.
create several public functions for getting the cpu frequency
and the numbers of ticks for a given number of cycles, etc.
cpu/memtest/memtest.cc:
cpu/simple_cpu/simple_cpu.cc:
cpu/simple_cpu/simple_cpu.hh:
cpu/trace/trace_cpu.cc:
Now that ticks aren't cpu cycles, fixup code to advance
by the proper number of ticks.
cpu/memtest/memtest.hh:
cpu/trace/trace_cpu.hh:
Provide a function to get the number of ticks for a given
number of cycles.
dev/alpha_console.cc:
Update for changes in the way that frequencies and latencies are
accessed. Move some stuff to init()
dev/alpha_console.hh:
Need a pointer to the system and the cpu to get the frequency
so we can pass the info to the console code.
dev/etherbus.cc:
dev/etherbus.hh:
dev/etherlink.cc:
dev/etherlink.hh:
dev/ethertap.cc:
dev/ide_disk.hh:
dev/ns_gige.cc:
dev/ns_gige.hh:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
dev/ide_disk.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
Add some extra debugging printfs
dev/platform.cc:
dev/sinic.cc:
dev/sinic.hh:
outline the constructor and destructor
dev/platform.hh:
outline the constructor and destructor.
don't keep track of the interrupt frequency. Only provide the
accessor function.
dev/tsunami.cc:
dev/tsunami.hh:
outline the constructor and destructor
Don't set the interrupt frequency here. Get it from the actual device
that does the interrupting.
dev/tsunami_io.cc:
dev/tsunami_io.hh:
Make the interrupt interval a configuration parameter. (And convert
the interval to the new latency/frequency stuff in the python)
kern/linux/linux_system.cc:
update for changes in the way bandwidths are passed from
python to C++ to accomidate the new way that ticks works.
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
kern/tru64/tru64_system.cc:
For now, we must get the boot cpu's frequency as a parameter
since allowing the system to have a pointer to the boot cpu would
cause a cycle.
python/m5/config.py:
Fix support for cycle_time relative latencies and frequencies.
Add support for getting a NetworkBandwidth or a MemoryBandwidth.
python/m5/objects/BaseCPU.mpy:
All CPUs now have a cycle_time. The default is the global frequency,
but it is now possible to set the global frequency to some large value
(like 1THz) and set each CPU frequency independently.
python/m5/objects/BaseCache.mpy:
python/m5/objects/Ide.mpy:
Make this a Latency parameter
python/m5/objects/BaseSystem.mpy:
We need to pass the boot CPU's frequency to the system
python/m5/objects/Ethernet.mpy:
Update parameter types to use latency and bandwidth types
python/m5/objects/Platform.mpy:
this frequency isn't needed. We get it from the clock interrupt.
python/m5/objects/Tsunami.mpy:
The clock generator should hold the frequency
sim/eventq.hh:
Need to remove this assertion because the writeback event
queue is different from the CPU's event queue which can cause
this assertion to fail.
sim/process.cc:
Fix comment.
sim/system.hh:
Struct member to hold the boot CPU's frequency.
sim/universe.cc:
remove unneeded variable.
--HG--
extra : convert_revision : 51efe4041095234bf458d9b3b0d417f4cae16fdc
2005-04-11 21:32:06 +02:00
|
|
|
|
2007-03-06 20:13:43 +01:00
|
|
|
clock = Param.Clock('1t', "clock speed")
|
|
|
|
phase = Param.Latency('0ns', "clock phase")
|
2006-08-16 18:52:05 +02:00
|
|
|
|
2007-07-29 05:30:43 +02:00
|
|
|
tracer = Param.InstTracer(default_tracer, "Instruction tracer")
|
|
|
|
|
2012-02-13 12:43:09 +01:00
|
|
|
icache_port = MasterPort("Instruction Port")
|
|
|
|
dcache_port = MasterPort("Data Port")
|
2012-01-17 19:55:08 +01:00
|
|
|
_cached_ports = ['icache_port', 'dcache_port']
|
|
|
|
|
2011-10-16 14:06:38 +02:00
|
|
|
if buildEnv['TARGET_ISA'] in ['x86', 'arm']:
|
2012-01-17 19:55:08 +01:00
|
|
|
_cached_ports += ["itb.walker.port", "dtb.walker.port"]
|
2011-02-04 05:23:00 +01:00
|
|
|
|
2012-02-13 12:43:09 +01:00
|
|
|
_uncached_slave_ports = []
|
|
|
|
_uncached_master_ports = []
|
2011-10-09 09:15:50 +02:00
|
|
|
if buildEnv['TARGET_ISA'] == 'x86':
|
2012-02-13 12:43:09 +01:00
|
|
|
_uncached_slave_ports += ["interrupts.pio", "interrupts.int_slave"]
|
|
|
|
_uncached_master_ports += ["interrupts.int_master"]
|
2011-02-04 05:23:00 +01:00
|
|
|
|
|
|
|
def connectCachedPorts(self, bus):
|
|
|
|
for p in self._cached_ports:
|
2012-02-13 12:43:09 +01:00
|
|
|
exec('self.%s = bus.slave' % p)
|
2006-08-16 18:52:05 +02:00
|
|
|
|
2011-02-04 05:23:00 +01:00
|
|
|
def connectUncachedPorts(self, bus):
|
2012-02-13 12:43:09 +01:00
|
|
|
for p in self._uncached_slave_ports:
|
|
|
|
exec('self.%s = bus.master' % p)
|
|
|
|
for p in self._uncached_master_ports:
|
|
|
|
exec('self.%s = bus.slave' % p)
|
2010-06-02 19:58:16 +02:00
|
|
|
|
2011-02-04 05:23:00 +01:00
|
|
|
def connectAllPorts(self, cached_bus, uncached_bus = None):
|
|
|
|
self.connectCachedPorts(cached_bus)
|
|
|
|
if not uncached_bus:
|
|
|
|
uncached_bus = cached_bus
|
|
|
|
self.connectUncachedPorts(uncached_bus)
|
2006-08-16 18:52:05 +02:00
|
|
|
|
2011-02-02 03:28:41 +01:00
|
|
|
def addPrivateSplitL1Caches(self, ic, dc, iwc = None, dwc = None):
|
2006-08-16 18:52:05 +02:00
|
|
|
self.icache = ic
|
|
|
|
self.dcache = dc
|
|
|
|
self.icache_port = ic.cpu_side
|
|
|
|
self.dcache_port = dc.cpu_side
|
2011-02-04 05:23:00 +01:00
|
|
|
self._cached_ports = ['icache.mem_side', 'dcache.mem_side']
|
2012-01-07 11:15:35 +01:00
|
|
|
if buildEnv['TARGET_ISA'] in ['x86', 'arm']:
|
|
|
|
if iwc and dwc:
|
|
|
|
self.itb_walker_cache = iwc
|
|
|
|
self.dtb_walker_cache = dwc
|
|
|
|
self.itb.walker.port = iwc.cpu_side
|
|
|
|
self.dtb.walker.port = dwc.cpu_side
|
|
|
|
self._cached_ports += ["itb_walker_cache.mem_side", \
|
|
|
|
"dtb_walker_cache.mem_side"]
|
|
|
|
else:
|
|
|
|
self._cached_ports += ["itb.walker.port", "dtb.walker.port"]
|
2012-02-01 07:40:08 +01:00
|
|
|
# Checker doesn't need its own tlb caches because it does
|
|
|
|
# functional accesses only
|
|
|
|
if buildEnv['USE_CHECKER']:
|
|
|
|
self._cached_ports += ["checker.itb.walker.port", \
|
|
|
|
"checker.dtb.walker.port"]
|
2006-08-16 18:52:05 +02:00
|
|
|
|
2011-02-02 03:28:41 +01:00
|
|
|
def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
|
|
|
|
self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
|
2006-08-16 18:52:05 +02:00
|
|
|
self.toL2Bus = Bus()
|
2011-02-04 05:23:00 +01:00
|
|
|
self.connectCachedPorts(self.toL2Bus)
|
2006-08-16 18:52:05 +02:00
|
|
|
self.l2cache = l2c
|
2012-02-13 12:43:09 +01:00
|
|
|
self.toL2Bus.master = self.l2cache.cpu_side
|
2011-02-04 05:23:00 +01:00
|
|
|
self._cached_ports = ['l2cache.mem_side']
|