System.py revision 10700
12689Sktlim@umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan 22689Sktlim@umich.edu# Copyright (c) 2011 Regents of the University of California 32689Sktlim@umich.edu# All rights reserved. 42689Sktlim@umich.edu# 52689Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without 62689Sktlim@umich.edu# modification, are permitted provided that the following conditions are 72689Sktlim@umich.edu# met: redistributions of source code must retain the above copyright 82689Sktlim@umich.edu# notice, this list of conditions and the following disclaimer; 92689Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright 102689Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the 112689Sktlim@umich.edu# documentation and/or other materials provided with the distribution; 122689Sktlim@umich.edu# neither the name of the copyright holders nor the names of its 132689Sktlim@umich.edu# contributors may be used to endorse or promote products derived from 142689Sktlim@umich.edu# this software without specific prior written permission. 152689Sktlim@umich.edu# 162689Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172689Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182689Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192689Sktlim@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202689Sktlim@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212689Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222689Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232689Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242689Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252689Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262689Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272689Sktlim@umich.edu# 282689Sktlim@umich.edu# Authors: Nathan Binkert 292689Sktlim@umich.edu# Rick Strong 302290SN/A 313368Sstever@eecs.umich.edufrom m5.SimObject import SimObject 322680Sktlim@umich.edufrom m5.defines import buildEnv 332290SN/Afrom m5.params import * 342290SN/Afrom m5.proxy import * 352680Sktlim@umich.edu 362680Sktlim@umich.edufrom DVFSHandler import * 372290SN/Afrom SimpleMemory import * 382290SN/A 392290SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing', 402290SN/A 'atomic_noncaching'] 412290SN/A 422290SN/Aclass System(MemObject): 433368Sstever@eecs.umich.edu type = 'System' 442680Sktlim@umich.edu cxx_header = "sim/system.hh" 452290SN/A system_port = MasterPort("System port") 462290SN/A 472290SN/A @classmethod 482290SN/A def export_method_cxx_predecls(cls, code): 492290SN/A code('#include "sim/system.hh"') 502290SN/A 512290SN/A @classmethod 52 def export_methods(cls, code): 53 code(''' 54 Enums::MemoryMode getMemoryMode() const; 55 void setMemoryMode(Enums::MemoryMode mode); 56''') 57 58 memories = VectorParam.AbstractMemory(Self.all, 59 "All memories in the system") 60 mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in") 61 62 # When reserving memory on the host, we have the option of 63 # reserving swap space or not (by passing MAP_NORESERVE to 64 # mmap). By enabling this flag, we accomodate cases where a large 65 # (but sparse) memory is simulated. 66 mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \ 67 "without reserving swap") 68 69 # The memory ranges are to be populated when creating the system 70 # such that these can be passed from the I/O subsystem through an 71 # I/O bridge or cache 72 mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory") 73 74 cache_line_size = Param.Unsigned(64, "Cache line size in bytes") 75 76 work_item_id = Param.Int(-1, "specific work item id") 77 num_work_ids = Param.Int(16, "Number of distinct work item types") 78 work_begin_cpu_id_exit = Param.Int(-1, 79 "work started on specific id, now exit simulation") 80 work_begin_ckpt_count = Param.Counter(0, 81 "create checkpoint when work items begin count value is reached") 82 work_begin_exit_count = Param.Counter(0, 83 "exit simulation when work items begin count value is reached") 84 work_end_ckpt_count = Param.Counter(0, 85 "create checkpoint when work items end count value is reached") 86 work_end_exit_count = Param.Counter(0, 87 "exit simulation when work items end count value is reached") 88 work_cpus_ckpt_count = Param.Counter(0, 89 "create checkpoint when active cpu count value is reached") 90 91 init_param = Param.UInt64(0, "numerical value to pass into simulator") 92 boot_osflags = Param.String("a", "boot flags to pass to the kernel") 93 kernel = Param.String("", "file that contains the kernel code") 94 kernel_addr_check = Param.Bool(True, 95 "whether to address check on kernel (disable for baremetal)") 96 readfile = Param.String("", "file to read startup script from") 97 symbolfile = Param.String("", "file to get the symbols from") 98 load_addr_mask = Param.UInt64(0xffffffffff, 99 "Address to mask loading binaries with") 100 load_offset = Param.UInt64(0, "Address to offset loading binaries with") 101 102 # Dynamic voltage and frequency handler for the system, disabled by default 103 # Provide list of domains that need to be controlled by the handler 104 dvfs_handler = DVFSHandler() 105