System.py revision 11763:302c6b957854
12155SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
22155SN/A# Copyright (c) 2011 Regents of the University of California
32155SN/A# All rights reserved.
42155SN/A#
52155SN/A# Redistribution and use in source and binary forms, with or without
62155SN/A# modification, are permitted provided that the following conditions are
72155SN/A# met: redistributions of source code must retain the above copyright
82155SN/A# notice, this list of conditions and the following disclaimer;
92155SN/A# redistributions in binary form must reproduce the above copyright
102155SN/A# notice, this list of conditions and the following disclaimer in the
112155SN/A# documentation and/or other materials provided with the distribution;
122155SN/A# neither the name of the copyright holders nor the names of its
132155SN/A# contributors may be used to endorse or promote products derived from
142155SN/A# this software without specific prior written permission.
152155SN/A#
162155SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172155SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182155SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192155SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202155SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212155SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222155SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232155SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242155SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252155SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262155SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272155SN/A#
282665Ssaidi@eecs.umich.edu# Authors: Nathan Binkert
292665Ssaidi@eecs.umich.edu#          Rick Strong
302155SN/A
314202Sbinkertn@umich.edufrom m5.SimObject import SimObject
322155SN/Afrom m5.params import *
332178SN/Afrom m5.proxy import *
342178SN/A
352178SN/Afrom DVFSHandler import *
362178SN/Afrom SimpleMemory import *
372178SN/A
382178SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
392178SN/A                                'atomic_noncaching']
402178SN/A
412178SN/Aclass System(MemObject):
422178SN/A    type = 'System'
432178SN/A    cxx_header = "sim/system.hh"
442178SN/A    system_port = MasterPort("System port")
452155SN/A
462178SN/A    @classmethod
472155SN/A    def export_method_cxx_predecls(cls, code):
482155SN/A        code('#include "sim/system.hh"')
492178SN/A
502155SN/A    @classmethod
512155SN/A    def export_methods(cls, code):
522623SN/A        code('''
533918Ssaidi@eecs.umich.edu      Enums::MemoryMode getMemoryMode() const;
542623SN/A      void setMemoryMode(Enums::MemoryMode mode);
552623SN/A''')
563918Ssaidi@eecs.umich.edu
572155SN/A    memories = VectorParam.AbstractMemory(Self.all,
582155SN/A                                          "All memories in the system")
592292SN/A    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
603918Ssaidi@eecs.umich.edu
612292SN/A    thermal_model = Param.ThermalModel(NULL, "Thermal model")
622292SN/A    thermal_components = VectorParam.SimObject([],
632292SN/A            "A collection of all thermal components in the system.")
643918Ssaidi@eecs.umich.edu
652292SN/A    # When reserving memory on the host, we have the option of
662292SN/A    # reserving swap space or not (by passing MAP_NORESERVE to
672766Sktlim@umich.edu    # mmap). By enabling this flag, we accomodate cases where a large
682766Sktlim@umich.edu    # (but sparse) memory is simulated.
692766Sktlim@umich.edu    mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \
702921Sktlim@umich.edu                                          "without reserving swap")
712921Sktlim@umich.edu
722766Sktlim@umich.edu    # The memory ranges are to be populated when creating the system
732766Sktlim@umich.edu    # such that these can be passed from the I/O subsystem through an
742766Sktlim@umich.edu    # I/O bridge or cache
754762Snate@binkert.org    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
762155SN/A
772155SN/A    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
782155SN/A
792155SN/A    exit_on_work_items = Param.Bool(False, "Exit from the simulation loop when "
802155SN/A                                    "encountering work item annotations.")
812155SN/A    work_item_id = Param.Int(-1, "specific work item id")
822766Sktlim@umich.edu    num_work_ids = Param.Int(16, "Number of distinct work item types")
832155SN/A    work_begin_cpu_id_exit = Param.Int(-1,
842623SN/A        "work started on specific id, now exit simulation")
852155SN/A    work_begin_ckpt_count = Param.Counter(0,
862155SN/A        "create checkpoint when work items begin count value is reached")
872155SN/A    work_begin_exit_count = Param.Counter(0,
882155SN/A        "exit simulation when work items begin count value is reached")
892178SN/A    work_end_ckpt_count = Param.Counter(0,
902178SN/A        "create checkpoint when work items end count value is reached")
912178SN/A    work_end_exit_count = Param.Counter(0,
922766Sktlim@umich.edu        "exit simulation when work items end count value is reached")
932178SN/A    work_cpus_ckpt_count = Param.Counter(0,
942178SN/A        "create checkpoint when active cpu count value is reached")
952178SN/A
962178SN/A    init_param = Param.UInt64(0, "numerical value to pass into simulator")
972766Sktlim@umich.edu    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
982766Sktlim@umich.edu    kernel = Param.String("", "file that contains the kernel code")
992766Sktlim@umich.edu    kernel_addr_check = Param.Bool(True,
1002788Sktlim@umich.edu        "whether to address check on kernel (disable for baremetal)")
1012178SN/A    readfile = Param.String("", "file to read startup script from")
1022733Sktlim@umich.edu    symbolfile = Param.String("", "file to get the symbols from")
1032733Sktlim@umich.edu    load_addr_mask = Param.UInt64(0xffffffffff,
1042817Sksewell@umich.edu            "Address to mask loading binaries with")
1052733Sktlim@umich.edu    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
1064486Sbinkertn@umich.edu
1074486Sbinkertn@umich.edu    multi_thread = Param.Bool(False,
1084776Sgblack@eecs.umich.edu            "Supports multi-threaded CPUs? Impacts Thread/Context IDs")
1094776Sgblack@eecs.umich.edu
1104486Sbinkertn@umich.edu    # Dynamic voltage and frequency handler for the system, disabled by default
1114202Sbinkertn@umich.edu    # Provide list of domains that need to be controlled by the handler
1124202Sbinkertn@umich.edu    dvfs_handler = DVFSHandler()
1134202Sbinkertn@umich.edu