System.py revision 11146
12036SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
22036SN/A# Copyright (c) 2011 Regents of the University of California
32036SN/A# All rights reserved.
42036SN/A#
52036SN/A# Redistribution and use in source and binary forms, with or without
62036SN/A# modification, are permitted provided that the following conditions are
72036SN/A# met: redistributions of source code must retain the above copyright
82036SN/A# notice, this list of conditions and the following disclaimer;
92036SN/A# redistributions in binary form must reproduce the above copyright
102036SN/A# notice, this list of conditions and the following disclaimer in the
112036SN/A# documentation and/or other materials provided with the distribution;
122036SN/A# neither the name of the copyright holders nor the names of its
132036SN/A# contributors may be used to endorse or promote products derived from
142036SN/A# this software without specific prior written permission.
152036SN/A#
162036SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172036SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182036SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192036SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202036SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212036SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222036SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232036SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242036SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252036SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262036SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu#
282956Sgblack@eecs.umich.edu# Authors: Nathan Binkert
292956Sgblack@eecs.umich.edu#          Rick Strong
302772Ssaidi@eecs.umich.edu
312036SN/Afrom m5.SimObject import SimObject
322036SN/Afrom m5.defines import buildEnv
332036SN/Afrom m5.params import *
342036SN/Afrom m5.proxy import *
352036SN/A
362036SN/Afrom DVFSHandler import *
372036SN/Afrom SimpleMemory import *
382036SN/A
392036SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
406214Snate@binkert.org                                'atomic_noncaching']
412036SN/A
422036SN/Aclass System(MemObject):
438902Sandreas.hansson@arm.com    type = 'System'
442036SN/A    cxx_header = "sim/system.hh"
452565SN/A    system_port = MasterPort("System port")
462565SN/A
472565SN/A    @classmethod
482565SN/A    def export_method_cxx_predecls(cls, code):
493918Ssaidi@eecs.umich.edu        code('#include "sim/system.hh"')
503483Ssaidi@eecs.umich.edu
512036SN/A    @classmethod
522036SN/A    def export_methods(cls, code):
532036SN/A        code('''
542036SN/A      Enums::MemoryMode getMemoryMode() const;
552778Ssaidi@eecs.umich.edu      void setMemoryMode(Enums::MemoryMode mode);
562778Ssaidi@eecs.umich.edu''')
572778Ssaidi@eecs.umich.edu
582778Ssaidi@eecs.umich.edu    memories = VectorParam.AbstractMemory(Self.all,
592036SN/A                                          "All memories in the system")
602036SN/A    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
615549Snate@binkert.org
622036SN/A    # When reserving memory on the host, we have the option of
632036SN/A    # reserving swap space or not (by passing MAP_NORESERVE to
648902Sandreas.hansson@arm.com    # mmap). By enabling this flag, we accomodate cases where a large
652565SN/A    # (but sparse) memory is simulated.
662778Ssaidi@eecs.umich.edu    mmap_using_noreserve = Param.Bool(False, "mmap the backing store " \
672778Ssaidi@eecs.umich.edu                                          "without reserving swap")
682565SN/A
692036SN/A    # The memory ranges are to be populated when creating the system
702036SN/A    # such that these can be passed from the I/O subsystem through an
712036SN/A    # I/O bridge or cache
722036SN/A    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
732036SN/A
742036SN/A    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
752036SN/A
762036SN/A    work_item_id = Param.Int(-1, "specific work item id")
772565SN/A    num_work_ids = Param.Int(16, "Number of distinct work item types")
782036SN/A    work_begin_cpu_id_exit = Param.Int(-1,
792036SN/A        "work started on specific id, now exit simulation")
805549Snate@binkert.org    work_begin_ckpt_count = Param.Counter(0,
812036SN/A        "create checkpoint when work items begin count value is reached")
822036SN/A    work_begin_exit_count = Param.Counter(0,
838902Sandreas.hansson@arm.com        "exit simulation when work items begin count value is reached")
842565SN/A    work_end_ckpt_count = Param.Counter(0,
852778Ssaidi@eecs.umich.edu        "create checkpoint when work items end count value is reached")
862778Ssaidi@eecs.umich.edu    work_end_exit_count = Param.Counter(0,
872565SN/A        "exit simulation when work items end count value is reached")
882036SN/A    work_cpus_ckpt_count = Param.Counter(0,
892036SN/A        "create checkpoint when active cpu count value is reached")
902036SN/A
912565SN/A    init_param = Param.UInt64(0, "numerical value to pass into simulator")
922036SN/A    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
932036SN/A    kernel = Param.String("", "file that contains the kernel code")
945549Snate@binkert.org    kernel_addr_check = Param.Bool(True,
952036SN/A        "whether to address check on kernel (disable for baremetal)")
962036SN/A    readfile = Param.String("", "file to read startup script from")
978902Sandreas.hansson@arm.com    symbolfile = Param.String("", "file to get the symbols from")
982565SN/A    load_addr_mask = Param.UInt64(0xffffffffff,
992778Ssaidi@eecs.umich.edu            "Address to mask loading binaries with")
1002778Ssaidi@eecs.umich.edu    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
1012565SN/A
1022036SN/A    multi_thread = Param.Bool(False,
1032036SN/A            "Supports multi-threaded CPUs? Impacts Thread/Context IDs")
1042565SN/A
1052036SN/A    # Dynamic voltage and frequency handler for the system, disabled by default
1062036SN/A    # Provide list of domains that need to be controlled by the handler
1072764Sstever@eecs.umich.edu    dvfs_handler = DVFSHandler()
1082764Sstever@eecs.umich.edu