System.py revision 11988
112027Sjungma@eit.uni-kl.de# Copyright (c) 2005-2007 The Regents of The University of Michigan
212027Sjungma@eit.uni-kl.de# Copyright (c) 2011 Regents of the University of California
312027Sjungma@eit.uni-kl.de# All rights reserved.
412027Sjungma@eit.uni-kl.de#
512027Sjungma@eit.uni-kl.de# Redistribution and use in source and binary forms, with or without
612027Sjungma@eit.uni-kl.de# modification, are permitted provided that the following conditions are
712027Sjungma@eit.uni-kl.de# met: redistributions of source code must retain the above copyright
812027Sjungma@eit.uni-kl.de# notice, this list of conditions and the following disclaimer;
912027Sjungma@eit.uni-kl.de# redistributions in binary form must reproduce the above copyright
1012027Sjungma@eit.uni-kl.de# notice, this list of conditions and the following disclaimer in the
1112027Sjungma@eit.uni-kl.de# documentation and/or other materials provided with the distribution;
1212027Sjungma@eit.uni-kl.de# neither the name of the copyright holders nor the names of its
1312027Sjungma@eit.uni-kl.de# contributors may be used to endorse or promote products derived from
1412027Sjungma@eit.uni-kl.de# this software without specific prior written permission.
1512027Sjungma@eit.uni-kl.de#
1612027Sjungma@eit.uni-kl.de# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1712027Sjungma@eit.uni-kl.de# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1812027Sjungma@eit.uni-kl.de# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1912027Sjungma@eit.uni-kl.de# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2012027Sjungma@eit.uni-kl.de# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2112027Sjungma@eit.uni-kl.de# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2212027Sjungma@eit.uni-kl.de# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2312027Sjungma@eit.uni-kl.de# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2412027Sjungma@eit.uni-kl.de# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2512027Sjungma@eit.uni-kl.de# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2612027Sjungma@eit.uni-kl.de# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2712027Sjungma@eit.uni-kl.de#
2812027Sjungma@eit.uni-kl.de# Authors: Nathan Binkert
2912027Sjungma@eit.uni-kl.de#          Rick Strong
3012027Sjungma@eit.uni-kl.de
3112027Sjungma@eit.uni-kl.defrom m5.SimObject import *
3212027Sjungma@eit.uni-kl.defrom m5.defines import buildEnv
3312027Sjungma@eit.uni-kl.defrom m5.params import *
3412027Sjungma@eit.uni-kl.defrom m5.proxy import *
3512027Sjungma@eit.uni-kl.de
3612027Sjungma@eit.uni-kl.defrom DVFSHandler import *
3712027Sjungma@eit.uni-kl.defrom SimpleMemory import *
3812027Sjungma@eit.uni-kl.de
3912027Sjungma@eit.uni-kl.declass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
4012027Sjungma@eit.uni-kl.de                                'atomic_noncaching']
4112027Sjungma@eit.uni-kl.de
4212027Sjungma@eit.uni-kl.declass System(MemObject):
4312027Sjungma@eit.uni-kl.de    type = 'System'
4412027Sjungma@eit.uni-kl.de    cxx_header = "sim/system.hh"
4512027Sjungma@eit.uni-kl.de    system_port = MasterPort("System port")
4612027Sjungma@eit.uni-kl.de
4712027Sjungma@eit.uni-kl.de    cxx_exports = [
4812027Sjungma@eit.uni-kl.de        PyBindMethod("getMemoryMode"),
4912027Sjungma@eit.uni-kl.de        PyBindMethod("setMemoryMode"),
5012027Sjungma@eit.uni-kl.de    ]
5112027Sjungma@eit.uni-kl.de
5212027Sjungma@eit.uni-kl.de    memories = VectorParam.AbstractMemory(Self.all,
5312027Sjungma@eit.uni-kl.de                                          "All memories in the system")
5412027Sjungma@eit.uni-kl.de    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
5512027Sjungma@eit.uni-kl.de
5612027Sjungma@eit.uni-kl.de    thermal_model = Param.ThermalModel(NULL, "Thermal model")
5712027Sjungma@eit.uni-kl.de    thermal_components = VectorParam.SimObject([],
5812027Sjungma@eit.uni-kl.de            "A collection of all thermal components in the system.")
5912027Sjungma@eit.uni-kl.de
6012027Sjungma@eit.uni-kl.de    # When reserving memory on the host, we have the option of
6112027Sjungma@eit.uni-kl.de    # reserving swap space or not (by passing MAP_NORESERVE to
6212027Sjungma@eit.uni-kl.de    # mmap). By enabling this flag, we accommodate cases where a large
6312027Sjungma@eit.uni-kl.de    # (but sparse) memory is simulated.
6412027Sjungma@eit.uni-kl.de    mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \
6512027Sjungma@eit.uni-kl.de                                          "without reserving swap")
6612027Sjungma@eit.uni-kl.de
6712027Sjungma@eit.uni-kl.de    # The memory ranges are to be populated when creating the system
6812027Sjungma@eit.uni-kl.de    # such that these can be passed from the I/O subsystem through an
6912027Sjungma@eit.uni-kl.de    # I/O bridge or cache
7012027Sjungma@eit.uni-kl.de    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
7112027Sjungma@eit.uni-kl.de
7212027Sjungma@eit.uni-kl.de    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
7312027Sjungma@eit.uni-kl.de
7412027Sjungma@eit.uni-kl.de    exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when "
7512027Sjungma@eit.uni-kl.de                                    "encountering work item annotations.")
7612027Sjungma@eit.uni-kl.de    work_item_id = Param.Int(-1, "specific work item id")
7712027Sjungma@eit.uni-kl.de    num_work_ids = Param.Int(16, "Number of distinct work item types")
7812027Sjungma@eit.uni-kl.de    work_begin_cpu_id_exit = Param.Int(-1,
7912027Sjungma@eit.uni-kl.de        "work started on specific id, now exit simulation")
8012027Sjungma@eit.uni-kl.de    work_begin_ckpt_count = Param.Counter(0,
8112027Sjungma@eit.uni-kl.de        "create checkpoint when work items begin count value is reached")
8212027Sjungma@eit.uni-kl.de    work_begin_exit_count = Param.Counter(0,
8312027Sjungma@eit.uni-kl.de        "exit simulation when work items begin count value is reached")
8412027Sjungma@eit.uni-kl.de    work_end_ckpt_count = Param.Counter(0,
8512027Sjungma@eit.uni-kl.de        "create checkpoint when work items end count value is reached")
8612027Sjungma@eit.uni-kl.de    work_end_exit_count = Param.Counter(0,
8712027Sjungma@eit.uni-kl.de        "exit simulation when work items end count value is reached")
8812027Sjungma@eit.uni-kl.de    work_cpus_ckpt_count = Param.Counter(0,
8912027Sjungma@eit.uni-kl.de        "create checkpoint when active cpu count value is reached")
9012027Sjungma@eit.uni-kl.de
9112027Sjungma@eit.uni-kl.de    init_param = Param.UInt64(0, "numerical value to pass into simulator")
9212027Sjungma@eit.uni-kl.de    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
9312027Sjungma@eit.uni-kl.de    kernel = Param.String("", "file that contains the kernel code")
9412027Sjungma@eit.uni-kl.de    kernel_addr_check = Param.Bool(True,
9512027Sjungma@eit.uni-kl.de        "whether to address check on kernel (disable for baremetal)")
9612027Sjungma@eit.uni-kl.de    readfile = Param.String("", "file to read startup script from")
9712027Sjungma@eit.uni-kl.de    symbolfile = Param.String("", "file to get the symbols from")
9812027Sjungma@eit.uni-kl.de    load_addr_mask = Param.UInt64(0xffffffffff,
9912027Sjungma@eit.uni-kl.de            "Address to mask loading binaries with")
10012027Sjungma@eit.uni-kl.de    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
10112027Sjungma@eit.uni-kl.de
10212027Sjungma@eit.uni-kl.de    multi_thread = Param.Bool(False,
10312027Sjungma@eit.uni-kl.de            "Supports multi-threaded CPUs? Impacts Thread/Context IDs")
10412027Sjungma@eit.uni-kl.de
10512027Sjungma@eit.uni-kl.de    # Dynamic voltage and frequency handler for the system, disabled by default
10612027Sjungma@eit.uni-kl.de    # Provide list of domains that need to be controlled by the handler
10712027Sjungma@eit.uni-kl.de    dvfs_handler = DVFSHandler()
10812027Sjungma@eit.uni-kl.de
10912027Sjungma@eit.uni-kl.de    if buildEnv['USE_KVM']:
11012027Sjungma@eit.uni-kl.de        kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)')
11112027Sjungma@eit.uni-kl.de