System.py revision 13892
13546Sgblack@eecs.umich.edu# Copyright (c) 2017 ARM Limited
23546Sgblack@eecs.umich.edu# All rights reserved.
33546Sgblack@eecs.umich.edu#
43546Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall
53546Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual
63546Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating
73546Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software
83546Sgblack@eecs.umich.edu# licensed hereunder.  You may use the software subject to the license
93546Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated
103546Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software,
113546Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form.
123546Sgblack@eecs.umich.edu#
133546Sgblack@eecs.umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan
143546Sgblack@eecs.umich.edu# Copyright (c) 2011 Regents of the University of California
153546Sgblack@eecs.umich.edu# All rights reserved.
163546Sgblack@eecs.umich.edu#
173546Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
183546Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
193546Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
203546Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
213546Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
223546Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
233546Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
243546Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
253546Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
263546Sgblack@eecs.umich.edu# this software without specific prior written permission.
273546Sgblack@eecs.umich.edu#
283546Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
293546Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
303546Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
314202Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
323546Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
334202Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
344202Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
354202Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
363546Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
374202Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
384202Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
394202Sbinkertn@umich.edu#
403546Sgblack@eecs.umich.edu# Authors: Nathan Binkert
414202Sbinkertn@umich.edu#          Rick Strong
424202Sbinkertn@umich.edu
434202Sbinkertn@umich.edufrom m5.SimObject import *
444202Sbinkertn@umich.edufrom m5.defines import buildEnv
454202Sbinkertn@umich.edufrom m5.params import *
46from m5.proxy import *
47
48from m5.objects.DVFSHandler import *
49from m5.objects.SimpleMemory import *
50
51class MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
52                                'atomic_noncaching']
53
54class System(SimObject):
55    type = 'System'
56    cxx_header = "sim/system.hh"
57    system_port = MasterPort("System port")
58
59    cxx_exports = [
60        PyBindMethod("getMemoryMode"),
61        PyBindMethod("setMemoryMode"),
62    ]
63
64    memories = VectorParam.AbstractMemory(Self.all,
65                                          "All memories in the system")
66    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
67
68    thermal_model = Param.ThermalModel(NULL, "Thermal model")
69    thermal_components = VectorParam.SimObject([],
70            "A collection of all thermal components in the system.")
71
72    # When reserving memory on the host, we have the option of
73    # reserving swap space or not (by passing MAP_NORESERVE to
74    # mmap). By enabling this flag, we accommodate cases where a large
75    # (but sparse) memory is simulated.
76    mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \
77                                          "without reserving swap")
78
79    # The memory ranges are to be populated when creating the system
80    # such that these can be passed from the I/O subsystem through an
81    # I/O bridge or cache
82    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
83
84    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
85
86    redirect_paths = VectorParam.RedirectPath([], "Path redirections")
87
88    exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when "
89                                    "encountering work item annotations.")
90    work_item_id = Param.Int(-1, "specific work item id")
91    num_work_ids = Param.Int(16, "Number of distinct work item types")
92    work_begin_cpu_id_exit = Param.Int(-1,
93        "work started on specific id, now exit simulation")
94    work_begin_ckpt_count = Param.Counter(0,
95        "create checkpoint when work items begin count value is reached")
96    work_begin_exit_count = Param.Counter(0,
97        "exit simulation when work items begin count value is reached")
98    work_end_ckpt_count = Param.Counter(0,
99        "create checkpoint when work items end count value is reached")
100    work_end_exit_count = Param.Counter(0,
101        "exit simulation when work items end count value is reached")
102    work_cpus_ckpt_count = Param.Counter(0,
103        "create checkpoint when active cpu count value is reached")
104
105    init_param = Param.UInt64(0, "numerical value to pass into simulator")
106    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
107    kernel = Param.String("", "file that contains the kernel code")
108    kernel_addr_check = Param.Bool(True,
109        "whether to address check on kernel (disable for baremetal)")
110    kernel_extras = VectorParam.String([],"Additional object files to load")
111    readfile = Param.String("", "file to read startup script from")
112    symbolfile = Param.String("", "file to get the symbols from")
113    load_addr_mask = Param.UInt64(0xffffffffffffffff,
114            "Address to mask loading binaries with, if 0, system "
115            "auto-calculates the mask to be the most restrictive, "
116            "otherwise it obeys a custom mask.")
117    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
118
119    multi_thread = Param.Bool(False,
120            "Supports multi-threaded CPUs? Impacts Thread/Context IDs")
121
122    # Dynamic voltage and frequency handler for the system, disabled by default
123    # Provide list of domains that need to be controlled by the handler
124    dvfs_handler = DVFSHandler()
125
126    if buildEnv['USE_KVM']:
127        kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)')
128