System.py revision 12262
12914SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
213564Snikos.nikoleris@arm.com# Copyright (c) 2011 Regents of the University of California
38856SN/A# All rights reserved.
48856SN/A#
58856SN/A# Redistribution and use in source and binary forms, with or without
68856SN/A# modification, are permitted provided that the following conditions are
78856SN/A# met: redistributions of source code must retain the above copyright
88856SN/A# notice, this list of conditions and the following disclaimer;
98856SN/A# redistributions in binary form must reproduce the above copyright
108856SN/A# notice, this list of conditions and the following disclaimer in the
118856SN/A# documentation and/or other materials provided with the distribution;
128856SN/A# neither the name of the copyright holders nor the names of its
138856SN/A# contributors may be used to endorse or promote products derived from
142914SN/A# this software without specific prior written permission.
152914SN/A#
162914SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172914SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182914SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192914SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202914SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212914SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222914SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232914SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242914SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252914SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262914SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272914SN/A#
282914SN/A# Authors: Nathan Binkert
292914SN/A#          Rick Strong
302914SN/A
312914SN/Afrom m5.SimObject import *
322914SN/Afrom m5.defines import buildEnv
332914SN/Afrom m5.params import *
342914SN/Afrom m5.proxy import *
352914SN/A
362914SN/Afrom DVFSHandler import *
372914SN/Afrom SimpleMemory import *
382914SN/A
392914SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
402914SN/A                                'atomic_noncaching']
418856SN/A
422914SN/Aclass System(MemObject):
432914SN/A    type = 'System'
4411793Sbrandon.potter@amd.com    cxx_header = "sim/system.hh"
4511793Sbrandon.potter@amd.com    system_port = MasterPort("System port")
469356Snilay@cs.wisc.edu
479152Satgutier@umich.edu    cxx_exports = [
488914Sandreas.hansson@arm.com        PyBindMethod("getMemoryMode"),
492914SN/A        PyBindMethod("setMemoryMode"),
5011207SBrad.Beckmann@amd.com    ]
5112083Sspwilson2@wisc.edu
5213564Snikos.nikoleris@arm.com    memories = VectorParam.AbstractMemory(Self.all,
5311207SBrad.Beckmann@amd.com                                          "All memories in the system")
5412083Sspwilson2@wisc.edu    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
5512083Sspwilson2@wisc.edu
5613564Snikos.nikoleris@arm.com    thermal_model = Param.ThermalModel(NULL, "Thermal model")
5711207SBrad.Beckmann@amd.com    thermal_components = VectorParam.SimObject([],
585740SN/A            "A collection of all thermal components in the system.")
595740SN/A
605740SN/A    # When reserving memory on the host, we have the option of
618914Sandreas.hansson@arm.com    # reserving swap space or not (by passing MAP_NORESERVE to
625740SN/A    # mmap). By enabling this flag, we accommodate cases where a large
635740SN/A    # (but sparse) memory is simulated.
645740SN/A    mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \
658914Sandreas.hansson@arm.com                                          "without reserving swap")
668914Sandreas.hansson@arm.com
678914Sandreas.hansson@arm.com    # The memory ranges are to be populated when creating the system
688914Sandreas.hansson@arm.com    # such that these can be passed from the I/O subsystem through an
698914Sandreas.hansson@arm.com    # I/O bridge or cache
7010713Sandreas.hansson@arm.com    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
718914Sandreas.hansson@arm.com
728914Sandreas.hansson@arm.com    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
738914Sandreas.hansson@arm.com
744929SN/A    exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when "
7513860Sodanrc@yahoo.com.br                                    "encountering work item annotations.")
7610713Sandreas.hansson@arm.com    work_item_id = Param.Int(-1, "specific work item id")
7710713Sandreas.hansson@arm.com    num_work_ids = Param.Int(16, "Number of distinct work item types")
7810713Sandreas.hansson@arm.com    work_begin_cpu_id_exit = Param.Int(-1,
7910713Sandreas.hansson@arm.com        "work started on specific id, now exit simulation")
8013860Sodanrc@yahoo.com.br    work_begin_ckpt_count = Param.Counter(0,
8110713Sandreas.hansson@arm.com        "create checkpoint when work items begin count value is reached")
8210713Sandreas.hansson@arm.com    work_begin_exit_count = Param.Counter(0,
8310713Sandreas.hansson@arm.com        "exit simulation when work items begin count value is reached")
8410713Sandreas.hansson@arm.com    work_end_ckpt_count = Param.Counter(0,
8510713Sandreas.hansson@arm.com        "create checkpoint when work items end count value is reached")
8610713Sandreas.hansson@arm.com    work_end_exit_count = Param.Counter(0,
8712823Srmk35@cl.cam.ac.uk        "exit simulation when work items end count value is reached")
883091SN/A    work_cpus_ckpt_count = Param.Counter(0,
898856SN/A        "create checkpoint when active cpu count value is reached")
908856SN/A
9110322Sandreas.hansson@arm.com    init_param = Param.UInt64(0, "numerical value to pass into simulator")
928856SN/A    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
933296SN/A    kernel = Param.String("", "file that contains the kernel code")
9410322Sandreas.hansson@arm.com    kernel_addr_check = Param.Bool(True,
958856SN/A        "whether to address check on kernel (disable for baremetal)")
968856SN/A    kernel_extras = VectorParam.String([],"Additional object files to load")
9712823Srmk35@cl.cam.ac.uk    readfile = Param.String("", "file to read startup script from")
988856SN/A    symbolfile = Param.String("", "file to get the symbols from")
993284SN/A    load_addr_mask = Param.UInt64(0xffffffffff,
1004929SN/A            "Address to mask loading binaries with")
1018856SN/A    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
1028856SN/A
1038856SN/A    multi_thread = Param.Bool(False,
1044490SN/A            "Supports multi-threaded CPUs? Impacts Thread/Context IDs")
1053342SN/A
1064490SN/A    # Dynamic voltage and frequency handler for the system, disabled by default
10713564Snikos.nikoleris@arm.com    # Provide list of domains that need to be controlled by the handler
1083403SN/A    dvfs_handler = DVFSHandler()
10910722Sstephan.diestelhorst@arm.com
11010722Sstephan.diestelhorst@arm.com    if buildEnv['USE_KVM']:
11113564Snikos.nikoleris@arm.com        kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)')
11210713Sandreas.hansson@arm.com