System.py revision 12262
16691Stjones1@inf.ed.ac.uk# Copyright (c) 2005-2007 The Regents of The University of Michigan
26691Stjones1@inf.ed.ac.uk# Copyright (c) 2011 Regents of the University of California
36691Stjones1@inf.ed.ac.uk# All rights reserved.
46691Stjones1@inf.ed.ac.uk#
56691Stjones1@inf.ed.ac.uk# Redistribution and use in source and binary forms, with or without
66691Stjones1@inf.ed.ac.uk# modification, are permitted provided that the following conditions are
76691Stjones1@inf.ed.ac.uk# met: redistributions of source code must retain the above copyright
86691Stjones1@inf.ed.ac.uk# notice, this list of conditions and the following disclaimer;
96691Stjones1@inf.ed.ac.uk# redistributions in binary form must reproduce the above copyright
106691Stjones1@inf.ed.ac.uk# notice, this list of conditions and the following disclaimer in the
116691Stjones1@inf.ed.ac.uk# documentation and/or other materials provided with the distribution;
126691Stjones1@inf.ed.ac.uk# neither the name of the copyright holders nor the names of its
136691Stjones1@inf.ed.ac.uk# contributors may be used to endorse or promote products derived from
146691Stjones1@inf.ed.ac.uk# this software without specific prior written permission.
156691Stjones1@inf.ed.ac.uk#
166691Stjones1@inf.ed.ac.uk# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176691Stjones1@inf.ed.ac.uk# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186691Stjones1@inf.ed.ac.uk# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196691Stjones1@inf.ed.ac.uk# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206691Stjones1@inf.ed.ac.uk# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216691Stjones1@inf.ed.ac.uk# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226691Stjones1@inf.ed.ac.uk# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236691Stjones1@inf.ed.ac.uk# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246691Stjones1@inf.ed.ac.uk# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256691Stjones1@inf.ed.ac.uk# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266691Stjones1@inf.ed.ac.uk# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276691Stjones1@inf.ed.ac.uk#
286691Stjones1@inf.ed.ac.uk# Authors: Nathan Binkert
296691Stjones1@inf.ed.ac.uk#          Rick Strong
306691Stjones1@inf.ed.ac.uk
316691Stjones1@inf.ed.ac.ukfrom m5.SimObject import *
326691Stjones1@inf.ed.ac.ukfrom m5.defines import buildEnv
336691Stjones1@inf.ed.ac.ukfrom m5.params import *
346691Stjones1@inf.ed.ac.ukfrom m5.proxy import *
356691Stjones1@inf.ed.ac.uk
366691Stjones1@inf.ed.ac.ukfrom DVFSHandler import *
376691Stjones1@inf.ed.ac.ukfrom SimpleMemory import *
388229Snate@binkert.org
3911800Sbrandon.potter@amd.comclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
406691Stjones1@inf.ed.ac.uk                                'atomic_noncaching']
416691Stjones1@inf.ed.ac.uk
426691Stjones1@inf.ed.ac.ukclass System(MemObject):
436691Stjones1@inf.ed.ac.uk    type = 'System'
4411851Sbrandon.potter@amd.com    cxx_header = "sim/system.hh"
456691Stjones1@inf.ed.ac.uk    system_port = MasterPort("System port")
466691Stjones1@inf.ed.ac.uk
4711851Sbrandon.potter@amd.com    cxx_exports = [
486691Stjones1@inf.ed.ac.uk        PyBindMethod("getMemoryMode"),
497532Ssteve.reinhardt@amd.com        PyBindMethod("setMemoryMode"),
506691Stjones1@inf.ed.ac.uk    ]
516691Stjones1@inf.ed.ac.uk
526691Stjones1@inf.ed.ac.uk    memories = VectorParam.AbstractMemory(Self.all,
5313617Sgabeblack@google.com                                          "All memories in the system")
549552Sandreas.hansson@arm.com    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
5511851Sbrandon.potter@amd.com
5613617Sgabeblack@google.com    thermal_model = Param.ThermalModel(NULL, "Thermal model")
576691Stjones1@inf.ed.ac.uk    thermal_components = VectorParam.SimObject([],
586691Stjones1@inf.ed.ac.uk            "A collection of all thermal components in the system.")
596691Stjones1@inf.ed.ac.uk
606691Stjones1@inf.ed.ac.uk    # When reserving memory on the host, we have the option of
616691Stjones1@inf.ed.ac.uk    # reserving swap space or not (by passing MAP_NORESERVE to
62    # mmap). By enabling this flag, we accommodate cases where a large
63    # (but sparse) memory is simulated.
64    mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \
65                                          "without reserving swap")
66
67    # The memory ranges are to be populated when creating the system
68    # such that these can be passed from the I/O subsystem through an
69    # I/O bridge or cache
70    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
71
72    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
73
74    exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when "
75                                    "encountering work item annotations.")
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    kernel_extras = VectorParam.String([],"Additional object files to load")
97    readfile = Param.String("", "file to read startup script from")
98    symbolfile = Param.String("", "file to get the symbols from")
99    load_addr_mask = Param.UInt64(0xffffffffff,
100            "Address to mask loading binaries with")
101    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
102
103    multi_thread = Param.Bool(False,
104            "Supports multi-threaded CPUs? Impacts Thread/Context IDs")
105
106    # Dynamic voltage and frequency handler for the system, disabled by default
107    # Provide list of domains that need to be controlled by the handler
108    dvfs_handler = DVFSHandler()
109
110    if buildEnv['USE_KVM']:
111        kvm_vm = Param.KvmVM(NULL, 'KVM VM (i.e., shared memory domain)')
112