System.py revision 12272
113521Sgabeblack@google.com# Copyright (c) 2017 ARM Limited 213521Sgabeblack@google.com# All rights reserved. 313521Sgabeblack@google.com# 413521Sgabeblack@google.com# The license below extends only to copyright in the software and shall 513521Sgabeblack@google.com# not be construed as granting a license to any other intellectual 613521Sgabeblack@google.com# property including but not limited to intellectual property relating 713521Sgabeblack@google.com# to a hardware implementation of the functionality of the software 813521Sgabeblack@google.com# licensed hereunder. You may use the software subject to the license 913521Sgabeblack@google.com# terms below provided that you ensure that this notice is replicated 1013521Sgabeblack@google.com# unmodified and in its entirety in all distributions of the software, 1113521Sgabeblack@google.com# modified or unmodified, in source code or in binary form. 1213521Sgabeblack@google.com# 1313521Sgabeblack@google.com# Copyright (c) 2005-2007 The Regents of The University of Michigan 1413521Sgabeblack@google.com# Copyright (c) 2011 Regents of the University of California 1513521Sgabeblack@google.com# All rights reserved. 1613521Sgabeblack@google.com# 1713521Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without 1813521Sgabeblack@google.com# modification, are permitted provided that the following conditions are 1913521Sgabeblack@google.com# met: redistributions of source code must retain the above copyright 2013521Sgabeblack@google.com# notice, this list of conditions and the following disclaimer; 2113521Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright 2213521Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the 2313521Sgabeblack@google.com# documentation and/or other materials provided with the distribution; 2413521Sgabeblack@google.com# neither the name of the copyright holders nor the names of its 2513521Sgabeblack@google.com# contributors may be used to endorse or promote products derived from 2613521Sgabeblack@google.com# this software without specific prior written permission. 2713521Sgabeblack@google.com# 2813521Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2913521Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3013521Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3113521Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3213521Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3313521Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3413521Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3513521Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3613521Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3713521Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3813521Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39# 40# Authors: Nathan Binkert 41# Rick Strong 42 43from m5.SimObject import * 44from m5.defines import buildEnv 45from m5.params import * 46from m5.proxy import * 47 48from DVFSHandler import * 49from SimpleMemory import * 50 51class MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing', 52 'atomic_noncaching'] 53 54class System(MemObject): 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 exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when " 87 "encountering work item annotations.") 88 work_item_id = Param.Int(-1, "specific work item id") 89 num_work_ids = Param.Int(16, "Number of distinct work item types") 90 work_begin_cpu_id_exit = Param.Int(-1, 91 "work started on specific id, now exit simulation") 92 work_begin_ckpt_count = Param.Counter(0, 93 "create checkpoint when work items begin count value is reached") 94 work_begin_exit_count = Param.Counter(0, 95 "exit simulation when work items begin count value is reached") 96 work_end_ckpt_count = Param.Counter(0, 97 "create checkpoint when work items end count value is reached") 98 work_end_exit_count = Param.Counter(0, 99 "exit simulation when work items end count value is reached") 100 work_cpus_ckpt_count = Param.Counter(0, 101 "create checkpoint when active cpu count value is reached") 102 103 init_param = Param.UInt64(0, "numerical value to pass into simulator") 104 boot_osflags = Param.String("a", "boot flags to pass to the kernel") 105 kernel = Param.String("", "file that contains the kernel code") 106 kernel_addr_check = Param.Bool(True, 107 "whether to address check on kernel (disable for baremetal)") 108 kernel_extras = VectorParam.String([],"Additional object files to load") 109 readfile = Param.String("", "file to read startup script from") 110 symbolfile = Param.String("", "file to get the symbols from") 111 load_addr_mask = Param.UInt64(0xffffffffffffffff, 112 "Address to mask loading binaries with, if 0, system " 113 "auto-calculates the mask to be the most restrictive, " 114 "otherwise it obeys a custom mask.") 115 load_offset = Param.UInt64(0, "Address to offset loading binaries with") 116 117 multi_thread = Param.Bool(False, 118 "Supports multi-threaded CPUs? Impacts Thread/Context IDs") 119 120 # Dynamic voltage and frequency handler for the system, disabled by default 121 # Provide list of domains that need to be controlled by the handler 122 dvfs_handler = DVFSHandler() 123 124 if buildEnv['USE_KVM']: 125 kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)') 126