System.py revision 13892
12735Sktlim@umich.edu# Copyright (c) 2017 ARM Limited 213953Sgiacomo.gabrielli@arm.com# All rights reserved. 310319SAndreas.Sandberg@ARM.com# 410319SAndreas.Sandberg@ARM.com# The license below extends only to copyright in the software and shall 510319SAndreas.Sandberg@ARM.com# not be construed as granting a license to any other intellectual 610319SAndreas.Sandberg@ARM.com# property including but not limited to intellectual property relating 710319SAndreas.Sandberg@ARM.com# to a hardware implementation of the functionality of the software 810319SAndreas.Sandberg@ARM.com# licensed hereunder. You may use the software subject to the license 910319SAndreas.Sandberg@ARM.com# terms below provided that you ensure that this notice is replicated 1010319SAndreas.Sandberg@ARM.com# unmodified and in its entirety in all distributions of the software, 1110319SAndreas.Sandberg@ARM.com# modified or unmodified, in source code or in binary form. 1210319SAndreas.Sandberg@ARM.com# 1310319SAndreas.Sandberg@ARM.com# Copyright (c) 2005-2007 The Regents of The University of Michigan 142735Sktlim@umich.edu# Copyright (c) 2011 Regents of the University of California 1511303Ssteve.reinhardt@amd.com# All rights reserved. 162735Sktlim@umich.edu# 172735Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without 182735Sktlim@umich.edu# modification, are permitted provided that the following conditions are 192735Sktlim@umich.edu# met: redistributions of source code must retain the above copyright 202735Sktlim@umich.edu# notice, this list of conditions and the following disclaimer; 212735Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright 222735Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the 232735Sktlim@umich.edu# documentation and/or other materials provided with the distribution; 242735Sktlim@umich.edu# neither the name of the copyright holders nor the names of its 252735Sktlim@umich.edu# contributors may be used to endorse or promote products derived from 262735Sktlim@umich.edu# this software without specific prior written permission. 272735Sktlim@umich.edu# 282735Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292735Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302735Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312735Sktlim@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322735Sktlim@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332735Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342735Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352735Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362735Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372735Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382735Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392735Sktlim@umich.edu# 402735Sktlim@umich.edu# Authors: Nathan Binkert 412735Sktlim@umich.edu# Rick Strong 4210319SAndreas.Sandberg@ARM.com 432735Sktlim@umich.edufrom m5.SimObject import * 442735Sktlim@umich.edufrom m5.defines import buildEnv 4510319SAndreas.Sandberg@ARM.comfrom m5.params import * 4610319SAndreas.Sandberg@ARM.comfrom m5.proxy import * 4710319SAndreas.Sandberg@ARM.com 4810319SAndreas.Sandberg@ARM.comfrom m5.objects.DVFSHandler import * 4910319SAndreas.Sandberg@ARM.comfrom m5.objects.SimpleMemory import * 5010319SAndreas.Sandberg@ARM.com 5110529Smorr@cs.wisc.educlass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing', 5212104Snathanael.premillieu@arm.com 'atomic_noncaching'] 5310319SAndreas.Sandberg@ARM.com 5410319SAndreas.Sandberg@ARM.comclass System(SimObject): 5511608Snikos.nikoleris@arm.com type = 'System' 562735Sktlim@umich.edu cxx_header = "sim/system.hh" 572735Sktlim@umich.edu system_port = MasterPort("System port") 5810319SAndreas.Sandberg@ARM.com 5910319SAndreas.Sandberg@ARM.com cxx_exports = [ 6010319SAndreas.Sandberg@ARM.com PyBindMethod("getMemoryMode"), 6110319SAndreas.Sandberg@ARM.com PyBindMethod("setMemoryMode"), 6210319SAndreas.Sandberg@ARM.com ] 6310319SAndreas.Sandberg@ARM.com 6410319SAndreas.Sandberg@ARM.com memories = VectorParam.AbstractMemory(Self.all, 6510319SAndreas.Sandberg@ARM.com "All memories in the system") 6610319SAndreas.Sandberg@ARM.com mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in") 6710319SAndreas.Sandberg@ARM.com 6810319SAndreas.Sandberg@ARM.com thermal_model = Param.ThermalModel(NULL, "Thermal model") 6910319SAndreas.Sandberg@ARM.com thermal_components = VectorParam.SimObject([], 7010319SAndreas.Sandberg@ARM.com "A collection of all thermal components in the system.") 7110319SAndreas.Sandberg@ARM.com 722735Sktlim@umich.edu # When reserving memory on the host, we have the option of 732735Sktlim@umich.edu # reserving swap space or not (by passing MAP_NORESERVE to 7410319SAndreas.Sandberg@ARM.com # mmap). By enabling this flag, we accommodate cases where a large 7510319SAndreas.Sandberg@ARM.com # (but sparse) memory is simulated. 7610319SAndreas.Sandberg@ARM.com mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \ 7712109SRekai.GonzalezAlberquilla@arm.com "without reserving swap") 7812109SRekai.GonzalezAlberquilla@arm.com 7913610Sgiacomo.gabrielli@arm.com # The memory ranges are to be populated when creating the system 8010319SAndreas.Sandberg@ARM.com # such that these can be passed from the I/O subsystem through an 8110319SAndreas.Sandberg@ARM.com # I/O bridge or cache 8210319SAndreas.Sandberg@ARM.com mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory") 8310319SAndreas.Sandberg@ARM.com 8410319SAndreas.Sandberg@ARM.com cache_line_size = Param.Unsigned(64, "Cache line size in bytes") 8510319SAndreas.Sandberg@ARM.com 8610319SAndreas.Sandberg@ARM.com redirect_paths = VectorParam.RedirectPath([], "Path redirections") 872735Sktlim@umich.edu 882735Sktlim@umich.edu exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when " 8913557Sgabeblack@google.com "encountering work item annotations.") 9010319SAndreas.Sandberg@ARM.com work_item_id = Param.Int(-1, "specific work item id") 9110319SAndreas.Sandberg@ARM.com num_work_ids = Param.Int(16, "Number of distinct work item types") 9210319SAndreas.Sandberg@ARM.com work_begin_cpu_id_exit = Param.Int(-1, 9313557Sgabeblack@google.com "work started on specific id, now exit simulation") 9410319SAndreas.Sandberg@ARM.com work_begin_ckpt_count = Param.Counter(0, 9510319SAndreas.Sandberg@ARM.com "create checkpoint when work items begin count value is reached") 9610319SAndreas.Sandberg@ARM.com work_begin_exit_count = Param.Counter(0, 9710319SAndreas.Sandberg@ARM.com "exit simulation when work items begin count value is reached") 9810319SAndreas.Sandberg@ARM.com work_end_ckpt_count = Param.Counter(0, 9910319SAndreas.Sandberg@ARM.com "create checkpoint when work items end count value is reached") 10010319SAndreas.Sandberg@ARM.com work_end_exit_count = Param.Counter(0, 10110319SAndreas.Sandberg@ARM.com "exit simulation when work items end count value is reached") 1022735Sktlim@umich.edu work_cpus_ckpt_count = Param.Counter(0, 1032735Sktlim@umich.edu "create checkpoint when active cpu count value is reached") 1042735Sktlim@umich.edu 10513557Sgabeblack@google.com init_param = Param.UInt64(0, "numerical value to pass into simulator") 1062735Sktlim@umich.edu boot_osflags = Param.String("a", "boot flags to pass to the kernel") 1072735Sktlim@umich.edu kernel = Param.String("", "file that contains the kernel code") 1082735Sktlim@umich.edu kernel_addr_check = Param.Bool(True, 10910319SAndreas.Sandberg@ARM.com "whether to address check on kernel (disable for baremetal)") 11013557Sgabeblack@google.com kernel_extras = VectorParam.String([],"Additional object files to load") 1112735Sktlim@umich.edu readfile = Param.String("", "file to read startup script from") 11210319SAndreas.Sandberg@ARM.com symbolfile = Param.String("", "file to get the symbols from") 1132735Sktlim@umich.edu load_addr_mask = Param.UInt64(0xffffffffffffffff, 11412109SRekai.GonzalezAlberquilla@arm.com "Address to mask loading binaries with, if 0, system " 11512109SRekai.GonzalezAlberquilla@arm.com "auto-calculates the mask to be the most restrictive, " 11612109SRekai.GonzalezAlberquilla@arm.com "otherwise it obeys a custom mask.") 11712109SRekai.GonzalezAlberquilla@arm.com load_offset = Param.UInt64(0, "Address to offset loading binaries with") 11812109SRekai.GonzalezAlberquilla@arm.com 11912109SRekai.GonzalezAlberquilla@arm.com multi_thread = Param.Bool(False, 12012109SRekai.GonzalezAlberquilla@arm.com "Supports multi-threaded CPUs? Impacts Thread/Context IDs") 12112109SRekai.GonzalezAlberquilla@arm.com 12212109SRekai.GonzalezAlberquilla@arm.com # Dynamic voltage and frequency handler for the system, disabled by default 12312109SRekai.GonzalezAlberquilla@arm.com # Provide list of domains that need to be controlled by the handler 12412109SRekai.GonzalezAlberquilla@arm.com dvfs_handler = DVFSHandler() 12512109SRekai.GonzalezAlberquilla@arm.com 12612109SRekai.GonzalezAlberquilla@arm.com if buildEnv['USE_KVM']: 12712109SRekai.GonzalezAlberquilla@arm.com kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)') 12812109SRekai.GonzalezAlberquilla@arm.com