System.py revision 11270:a3b41de1c4f1
12381SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan 22381SN/A# Copyright (c) 2011 Regents of the University of California 32381SN/A# All rights reserved. 42381SN/A# 52381SN/A# Redistribution and use in source and binary forms, with or without 62381SN/A# modification, are permitted provided that the following conditions are 72381SN/A# met: redistributions of source code must retain the above copyright 82381SN/A# notice, this list of conditions and the following disclaimer; 92381SN/A# redistributions in binary form must reproduce the above copyright 102381SN/A# notice, this list of conditions and the following disclaimer in the 112381SN/A# documentation and/or other materials provided with the distribution; 122381SN/A# neither the name of the copyright holders nor the names of its 132381SN/A# contributors may be used to endorse or promote products derived from 142381SN/A# this software without specific prior written permission. 152381SN/A# 162381SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172381SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182381SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192381SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202381SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212381SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222381SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232381SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242381SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252381SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262381SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu# 282665Ssaidi@eecs.umich.edu# Authors: Nathan Binkert 292381SN/A# Rick Strong 302381SN/A 312381SN/Afrom m5.SimObject import SimObject 322381SN/Afrom m5.defines import buildEnv 332381SN/Afrom m5.params import * 342381SN/Afrom m5.proxy import * 352381SN/A 362381SN/Afrom DVFSHandler import * 372381SN/Afrom SimpleMemory import * 382381SN/A 392381SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing', 402381SN/A 'atomic_noncaching'] 412381SN/A 422381SN/Aclass System(MemObject): 432381SN/A type = 'System' 442381SN/A cxx_header = "sim/system.hh" 452381SN/A system_port = MasterPort("System port") 462439SN/A 472381SN/A @classmethod 482381SN/A def export_method_cxx_predecls(cls, code): 492381SN/A code('#include "sim/system.hh"') 502381SN/A 512407SN/A @classmethod 522407SN/A def export_methods(cls, code): 532407SN/A code(''' 542407SN/A Enums::MemoryMode getMemoryMode() const; 552407SN/A void setMemoryMode(Enums::MemoryMode mode); 562407SN/A''') 572407SN/A 582407SN/A memories = VectorParam.AbstractMemory(Self.all, 592521SN/A "All memories in the system") 602407SN/A mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in") 612381SN/A 622381SN/A # When reserving memory on the host, we have the option of 632381SN/A # reserving swap space or not (by passing MAP_NORESERVE to 642381SN/A # mmap). By enabling this flag, we accomodate cases where a large 652381SN/A # (but sparse) memory is simulated. 662381SN/A mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \ 672381SN/A "without reserving swap") 682381SN/A 692381SN/A # The memory ranges are to be populated when creating the system 702381SN/A # such that these can be passed from the I/O subsystem through an 712381SN/A # I/O bridge or cache 722381SN/A mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory") 732381SN/A 742640Sstever@eecs.umich.edu cache_line_size = Param.Unsigned(64, "Cache line size in bytes") 752640Sstever@eecs.umich.edu 762640Sstever@eecs.umich.edu exit_on_work_items = Param.Bool(True, "Exit from the simulation loop when " 772640Sstever@eecs.umich.edu "encountering work item annotations.") 782640Sstever@eecs.umich.edu work_item_id = Param.Int(-1, "specific work item id") 792661Sstever@eecs.umich.edu num_work_ids = Param.Int(16, "Number of distinct work item types") 802661Sstever@eecs.umich.edu work_begin_cpu_id_exit = Param.Int(-1, 812661Sstever@eecs.umich.edu "work started on specific id, now exit simulation") 822661Sstever@eecs.umich.edu work_begin_ckpt_count = Param.Counter(0, 832661Sstever@eecs.umich.edu "create checkpoint when work items begin count value is reached") 842381SN/A work_begin_exit_count = Param.Counter(0, 852381SN/A "exit simulation when work items begin count value is reached") 862640Sstever@eecs.umich.edu work_end_ckpt_count = Param.Counter(0, 872640Sstever@eecs.umich.edu "create checkpoint when work items end count value is reached") 882640Sstever@eecs.umich.edu work_end_exit_count = Param.Counter(0, 892640Sstever@eecs.umich.edu "exit simulation when work items end count value is reached") 902640Sstever@eecs.umich.edu work_cpus_ckpt_count = Param.Counter(0, 912640Sstever@eecs.umich.edu "create checkpoint when active cpu count value is reached") 922640Sstever@eecs.umich.edu 932661Sstever@eecs.umich.edu init_param = Param.UInt64(0, "numerical value to pass into simulator") 942640Sstever@eecs.umich.edu boot_osflags = Param.String("a", "boot flags to pass to the kernel") 952640Sstever@eecs.umich.edu kernel = Param.String("", "file that contains the kernel code") 962640Sstever@eecs.umich.edu kernel_addr_check = Param.Bool(True, 972640Sstever@eecs.umich.edu "whether to address check on kernel (disable for baremetal)") 982640Sstever@eecs.umich.edu readfile = Param.String("", "file to read startup script from") 992474SN/A symbolfile = Param.String("", "file to get the symbols from") 1002640Sstever@eecs.umich.edu load_addr_mask = Param.UInt64(0xffffffffff, 1012381SN/A "Address to mask loading binaries with") 1022657Ssaidi@eecs.umich.edu load_offset = Param.UInt64(0, "Address to offset loading binaries with") 1032657Ssaidi@eecs.umich.edu 1042381SN/A multi_thread = Param.Bool(False, 1052381SN/A "Supports multi-threaded CPUs? Impacts Thread/Context IDs") 1062381SN/A 1072381SN/A # Dynamic voltage and frequency handler for the system, disabled by default 1082381SN/A # Provide list of domains that need to be controlled by the handler 1092381SN/A dvfs_handler = DVFSHandler() 1102381SN/A