System.py revision 13665
112272SGeoffrey.Blake@arm.com# Copyright (c) 2017 ARM Limited 212272SGeoffrey.Blake@arm.com# All rights reserved. 312272SGeoffrey.Blake@arm.com# 412272SGeoffrey.Blake@arm.com# The license below extends only to copyright in the software and shall 512272SGeoffrey.Blake@arm.com# not be construed as granting a license to any other intellectual 612272SGeoffrey.Blake@arm.com# property including but not limited to intellectual property relating 712272SGeoffrey.Blake@arm.com# to a hardware implementation of the functionality of the software 812272SGeoffrey.Blake@arm.com# licensed hereunder. You may use the software subject to the license 912272SGeoffrey.Blake@arm.com# terms below provided that you ensure that this notice is replicated 1012272SGeoffrey.Blake@arm.com# unmodified and in its entirety in all distributions of the software, 1112272SGeoffrey.Blake@arm.com# modified or unmodified, in source code or in binary form. 1212272SGeoffrey.Blake@arm.com# 134486Sbinkertn@umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan 147897Shestness@cs.utexas.edu# Copyright (c) 2011 Regents of the University of California 154486Sbinkertn@umich.edu# All rights reserved. 164486Sbinkertn@umich.edu# 174486Sbinkertn@umich.edu# Redistribution and use in source and binary forms, with or without 184486Sbinkertn@umich.edu# modification, are permitted provided that the following conditions are 194486Sbinkertn@umich.edu# met: redistributions of source code must retain the above copyright 204486Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer; 214486Sbinkertn@umich.edu# redistributions in binary form must reproduce the above copyright 224486Sbinkertn@umich.edu# notice, this list of conditions and the following disclaimer in the 234486Sbinkertn@umich.edu# documentation and/or other materials provided with the distribution; 244486Sbinkertn@umich.edu# neither the name of the copyright holders nor the names of its 254486Sbinkertn@umich.edu# contributors may be used to endorse or promote products derived from 264486Sbinkertn@umich.edu# this software without specific prior written permission. 274486Sbinkertn@umich.edu# 284486Sbinkertn@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 294486Sbinkertn@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 304486Sbinkertn@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 314486Sbinkertn@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 324486Sbinkertn@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 334486Sbinkertn@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 344486Sbinkertn@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 354486Sbinkertn@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 364486Sbinkertn@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 374486Sbinkertn@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 384486Sbinkertn@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 394486Sbinkertn@umich.edu# 404486Sbinkertn@umich.edu# Authors: Nathan Binkert 417897Shestness@cs.utexas.edu# Rick Strong 424486Sbinkertn@umich.edu 4311988Sandreas.sandberg@arm.comfrom m5.SimObject import * 4411839SCurtis.Dunham@arm.comfrom m5.defines import buildEnv 453102SN/Afrom m5.params import * 463102SN/Afrom m5.proxy import * 476654Snate@binkert.org 4813665Sandreas.sandberg@arm.comfrom m5.objects.DVFSHandler import * 4913665Sandreas.sandberg@arm.comfrom m5.objects.SimpleMemory import * 502212SN/A 519524SAndreas.Sandberg@ARM.comclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing', 529524SAndreas.Sandberg@ARM.com 'atomic_noncaching'] 532902SN/A 548703Sandreas.hansson@arm.comclass System(MemObject): 551783SN/A type = 'System' 569338SAndreas.Sandberg@arm.com cxx_header = "sim/system.hh" 578839Sandreas.hansson@arm.com system_port = MasterPort("System port") 587673Snate@binkert.org 5911988Sandreas.sandberg@arm.com cxx_exports = [ 6011988Sandreas.sandberg@arm.com PyBindMethod("getMemoryMode"), 6111988Sandreas.sandberg@arm.com PyBindMethod("setMemoryMode"), 6211988Sandreas.sandberg@arm.com ] 634859Snate@binkert.org 648931Sandreas.hansson@arm.com memories = VectorParam.AbstractMemory(Self.all, 658931Sandreas.hansson@arm.com "All memories in the system") 662902SN/A mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in") 679408Sandreas.hansson@arm.com 6811420Sdavid.guillen@arm.com thermal_model = Param.ThermalModel(NULL, "Thermal model") 6911420Sdavid.guillen@arm.com thermal_components = VectorParam.SimObject([], 7011420Sdavid.guillen@arm.com "A collection of all thermal components in the system.") 7111420Sdavid.guillen@arm.com 7210700Sandreas.hansson@arm.com # When reserving memory on the host, we have the option of 7310700Sandreas.hansson@arm.com # reserving swap space or not (by passing MAP_NORESERVE to 7411838SCurtis.Dunham@arm.com # mmap). By enabling this flag, we accommodate cases where a large 7510700Sandreas.hansson@arm.com # (but sparse) memory is simulated. 7610700Sandreas.hansson@arm.com mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \ 7710700Sandreas.hansson@arm.com "without reserving swap") 7810700Sandreas.hansson@arm.com 799408Sandreas.hansson@arm.com # The memory ranges are to be populated when creating the system 809408Sandreas.hansson@arm.com # such that these can be passed from the I/O subsystem through an 819408Sandreas.hansson@arm.com # I/O bridge or cache 829408Sandreas.hansson@arm.com mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory") 839408Sandreas.hansson@arm.com 849814Sandreas.hansson@arm.com cache_line_size = Param.Unsigned(64, "Cache line size in bytes") 859814Sandreas.hansson@arm.com 8611273Sandreas.sandberg@arm.com exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when " 8711270Sandreas.sandberg@arm.com "encountering work item annotations.") 887914SBrad.Beckmann@amd.com work_item_id = Param.Int(-1, "specific work item id") 898666SPrakash.Ramrakhyani@arm.com num_work_ids = Param.Int(16, "Number of distinct work item types") 907914SBrad.Beckmann@amd.com work_begin_cpu_id_exit = Param.Int(-1, 917914SBrad.Beckmann@amd.com "work started on specific id, now exit simulation") 927914SBrad.Beckmann@amd.com work_begin_ckpt_count = Param.Counter(0, 937914SBrad.Beckmann@amd.com "create checkpoint when work items begin count value is reached") 947914SBrad.Beckmann@amd.com work_begin_exit_count = Param.Counter(0, 957914SBrad.Beckmann@amd.com "exit simulation when work items begin count value is reached") 967914SBrad.Beckmann@amd.com work_end_ckpt_count = Param.Counter(0, 977914SBrad.Beckmann@amd.com "create checkpoint when work items end count value is reached") 987914SBrad.Beckmann@amd.com work_end_exit_count = Param.Counter(0, 997914SBrad.Beckmann@amd.com "exit simulation when work items end count value is reached") 1007914SBrad.Beckmann@amd.com work_cpus_ckpt_count = Param.Counter(0, 1017914SBrad.Beckmann@amd.com "create checkpoint when active cpu count value is reached") 1027914SBrad.Beckmann@amd.com 1038769Sgblack@eecs.umich.edu init_param = Param.UInt64(0, "numerical value to pass into simulator") 1048769Sgblack@eecs.umich.edu boot_osflags = Param.String("a", "boot flags to pass to the kernel") 1058769Sgblack@eecs.umich.edu kernel = Param.String("", "file that contains the kernel code") 10610282Sdam.sunwoo@arm.com kernel_addr_check = Param.Bool(True, 10710282Sdam.sunwoo@arm.com "whether to address check on kernel (disable for baremetal)") 10812262Sandreas.sandberg@arm.com kernel_extras = VectorParam.String([],"Additional object files to load") 1098769Sgblack@eecs.umich.edu readfile = Param.String("", "file to read startup script from") 1108769Sgblack@eecs.umich.edu symbolfile = Param.String("", "file to get the symbols from") 11112272SGeoffrey.Blake@arm.com load_addr_mask = Param.UInt64(0xffffffffffffffff, 11212272SGeoffrey.Blake@arm.com "Address to mask loading binaries with, if 0, system " 11312272SGeoffrey.Blake@arm.com "auto-calculates the mask to be the most restrictive, " 11412272SGeoffrey.Blake@arm.com "otherwise it obeys a custom mask.") 11510037SARM gem5 Developers load_offset = Param.UInt64(0, "Address to offset loading binaries with") 11610249Sstephan.diestelhorst@arm.com 11711146Smitch.hayenga@arm.com multi_thread = Param.Bool(False, 11811146Smitch.hayenga@arm.com "Supports multi-threaded CPUs? Impacts Thread/Context IDs") 11911146Smitch.hayenga@arm.com 12010249Sstephan.diestelhorst@arm.com # Dynamic voltage and frequency handler for the system, disabled by default 12110249Sstephan.diestelhorst@arm.com # Provide list of domains that need to be controlled by the handler 12210249Sstephan.diestelhorst@arm.com dvfs_handler = DVFSHandler() 12311839SCurtis.Dunham@arm.com 12411839SCurtis.Dunham@arm.com if buildEnv['USE_KVM']: 12511839SCurtis.Dunham@arm.com kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)') 126