System.py revision 10249
12330SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
22330SN/A# Copyright (c) 2011 Regents of the University of California
32330SN/A# All rights reserved.
42330SN/A#
52330SN/A# Redistribution and use in source and binary forms, with or without
62330SN/A# modification, are permitted provided that the following conditions are
72330SN/A# met: redistributions of source code must retain the above copyright
82330SN/A# notice, this list of conditions and the following disclaimer;
92330SN/A# redistributions in binary form must reproduce the above copyright
102330SN/A# notice, this list of conditions and the following disclaimer in the
112330SN/A# documentation and/or other materials provided with the distribution;
122330SN/A# neither the name of the copyright holders nor the names of its
132330SN/A# contributors may be used to endorse or promote products derived from
142330SN/A# this software without specific prior written permission.
152330SN/A#
162330SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172330SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182330SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192330SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202330SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212330SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222330SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232330SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242330SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252330SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262330SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272689Sktlim@umich.edu#
282689Sktlim@umich.edu# Authors: Nathan Binkert
292330SN/A#          Rick Strong
302292SN/A
312292SN/Afrom m5.SimObject import SimObject
322292SN/Afrom m5.defines import buildEnv
332292SN/Afrom m5.params import *
342980Sgblack@eecs.umich.edufrom m5.proxy import *
352362SN/A
362680Sktlim@umich.edufrom DVFSHandler import *
372292SN/Afrom SimpleMemory import *
382678Sktlim@umich.edu
392683Sktlim@umich.educlass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
402683Sktlim@umich.edu                                'atomic_noncaching']
412678Sktlim@umich.edu
422678Sktlim@umich.educlass System(MemObject):
432292SN/A    type = 'System'
442292SN/A    cxx_header = "sim/system.hh"
452292SN/A    system_port = MasterPort("System port")
462292SN/A
472330SN/A    @classmethod
482330SN/A    def export_method_cxx_predecls(cls, code):
492330SN/A        code('#include "sim/system.hh"')
502292SN/A
512292SN/A    @classmethod
523402Sktlim@umich.edu    def export_methods(cls, code):
532862Sktlim@umich.edu        code('''
543486Sktlim@umich.edu      Enums::MemoryMode getMemoryMode() const;
553402Sktlim@umich.edu      void setMemoryMode(Enums::MemoryMode mode);
562862Sktlim@umich.edu''')
572330SN/A
582330SN/A    memories = VectorParam.AbstractMemory(Self.all,
592330SN/A                                          "All memories in the system")
602330SN/A    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
612330SN/A
622330SN/A    # The memory ranges are to be populated when creating the system
632292SN/A    # such that these can be passed from the I/O subsystem through an
642683Sktlim@umich.edu    # I/O bridge or cache
652683Sktlim@umich.edu    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
662292SN/A
673402Sktlim@umich.edu    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
682292SN/A
693402Sktlim@umich.edu    work_item_id = Param.Int(-1, "specific work item id")
703402Sktlim@umich.edu    num_work_ids = Param.Int(16, "Number of distinct work item types")
712292SN/A    work_begin_cpu_id_exit = Param.Int(-1,
722683Sktlim@umich.edu        "work started on specific id, now exit simulation")
733486Sktlim@umich.edu    work_begin_ckpt_count = Param.Counter(0,
743486Sktlim@umich.edu        "create checkpoint when work items begin count value is reached")
752862Sktlim@umich.edu    work_begin_exit_count = Param.Counter(0,
762862Sktlim@umich.edu        "exit simulation when work items begin count value is reached")
772862Sktlim@umich.edu    work_end_ckpt_count = Param.Counter(0,
782862Sktlim@umich.edu        "create checkpoint when work items end count value is reached")
792683Sktlim@umich.edu    work_end_exit_count = Param.Counter(0,
802683Sktlim@umich.edu        "exit simulation when work items end count value is reached")
812683Sktlim@umich.edu    work_cpus_ckpt_count = Param.Counter(0,
822683Sktlim@umich.edu        "create checkpoint when active cpu count value is reached")
832683Sktlim@umich.edu
842683Sktlim@umich.edu    init_param = Param.UInt64(0, "numerical value to pass into simulator")
852683Sktlim@umich.edu    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
862683Sktlim@umich.edu    kernel = Param.String("", "file that contains the kernel code")
872683Sktlim@umich.edu    readfile = Param.String("", "file to read startup script from")
882683Sktlim@umich.edu    symbolfile = Param.String("", "file to get the symbols from")
892683Sktlim@umich.edu    load_addr_mask = Param.UInt64(0xffffffffff,
902683Sktlim@umich.edu            "Address to mask loading binaries with")
912683Sktlim@umich.edu    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
922683Sktlim@umich.edu
932683Sktlim@umich.edu    # Dynamic voltage and frequency handler for the system, disabled by default
942683Sktlim@umich.edu    # Provide list of domains that need to be controlled by the handler
952683Sktlim@umich.edu    dvfs_handler = DVFSHandler()
962683Sktlim@umich.edu