System.py revision 10282
12329SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
22329SN/A# Copyright (c) 2011 Regents of the University of California
32329SN/A# All rights reserved.
42329SN/A#
52329SN/A# Redistribution and use in source and binary forms, with or without
62329SN/A# modification, are permitted provided that the following conditions are
72329SN/A# met: redistributions of source code must retain the above copyright
82329SN/A# notice, this list of conditions and the following disclaimer;
92329SN/A# redistributions in binary form must reproduce the above copyright
102329SN/A# notice, this list of conditions and the following disclaimer in the
112329SN/A# documentation and/or other materials provided with the distribution;
122329SN/A# neither the name of the copyright holders nor the names of its
132329SN/A# contributors may be used to endorse or promote products derived from
142329SN/A# this software without specific prior written permission.
152329SN/A#
162329SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172329SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182329SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192329SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202329SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212329SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222329SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232329SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242329SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252329SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262329SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272689Sktlim@umich.edu#
282689Sktlim@umich.edu# Authors: Nathan Binkert
292329SN/A#          Rick Strong
302292SN/A
312292SN/Afrom m5.SimObject import SimObject
322292SN/Afrom m5.defines import buildEnv
332292SN/Afrom m5.params import *
342362SN/Afrom m5.proxy import *
352362SN/A
362680Sktlim@umich.edufrom DVFSHandler import *
372292SN/Afrom SimpleMemory import *
388793Sgblack@eecs.umich.edu
392362SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing',
402292SN/A                                'atomic_noncaching']
418777Sgblack@eecs.umich.edu
422292SN/Aclass System(MemObject):
438777Sgblack@eecs.umich.edu    type = 'System'
448777Sgblack@eecs.umich.edu    cxx_header = "sim/system.hh"
452292SN/A    system_port = MasterPort("System port")
462292SN/A
472292SN/A    @classmethod
482329SN/A    def export_method_cxx_predecls(cls, code):
492329SN/A        code('#include "sim/system.hh"')
502329SN/A
512680Sktlim@umich.edu    @classmethod
522680Sktlim@umich.edu    def export_methods(cls, code):
532329SN/A        code('''
542329SN/A      Enums::MemoryMode getMemoryMode() const;
552292SN/A      void setMemoryMode(Enums::MemoryMode mode);
562292SN/A''')
572680Sktlim@umich.edu
582733Sktlim@umich.edu    memories = VectorParam.AbstractMemory(Self.all,
592292SN/A                                          "All memories in the system")
602292SN/A    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
612348SN/A
622733Sktlim@umich.edu    # 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
642348SN/A    # I/O bridge or cache
652348SN/A    mem_ranges = VectorParam.AddrRange([], "Ranges that constitute main memory")
662348SN/A
672292SN/A    cache_line_size = Param.Unsigned(64, "Cache line size in bytes")
682292SN/A
692348SN/A    work_item_id = Param.Int(-1, "specific work item id")
702348SN/A    num_work_ids = Param.Int(16, "Number of distinct work item types")
712348SN/A    work_begin_cpu_id_exit = Param.Int(-1,
722292SN/A        "work started on specific id, now exit simulation")
732292SN/A    work_begin_ckpt_count = Param.Counter(0,
748766Sgblack@eecs.umich.edu        "create checkpoint when work items begin count value is reached")
758766Sgblack@eecs.umich.edu    work_begin_exit_count = Param.Counter(0,
762362SN/A        "exit simulation when work items begin count value is reached")
772362SN/A    work_end_ckpt_count = Param.Counter(0,
788793Sgblack@eecs.umich.edu        "create checkpoint when work items end count value is reached")
798793Sgblack@eecs.umich.edu    work_end_exit_count = Param.Counter(0,
808793Sgblack@eecs.umich.edu        "exit simulation when work items end count value is reached")
818793Sgblack@eecs.umich.edu    work_cpus_ckpt_count = Param.Counter(0,
828793Sgblack@eecs.umich.edu        "create checkpoint when active cpu count value is reached")
838793Sgblack@eecs.umich.edu
848793Sgblack@eecs.umich.edu    init_param = Param.UInt64(0, "numerical value to pass into simulator")
858793Sgblack@eecs.umich.edu    boot_osflags = Param.String("a", "boot flags to pass to the kernel")
868793Sgblack@eecs.umich.edu    kernel = Param.String("", "file that contains the kernel code")
878793Sgblack@eecs.umich.edu    kernel_addr_check = Param.Bool(True,
888793Sgblack@eecs.umich.edu        "whether to address check on kernel (disable for baremetal)")
898793Sgblack@eecs.umich.edu    readfile = Param.String("", "file to read startup script from")
908793Sgblack@eecs.umich.edu    symbolfile = Param.String("", "file to get the symbols from")
918793Sgblack@eecs.umich.edu    load_addr_mask = Param.UInt64(0xffffffffff,
928793Sgblack@eecs.umich.edu            "Address to mask loading binaries with")
932362SN/A    load_offset = Param.UInt64(0, "Address to offset loading binaries with")
942362SN/A
952292SN/A    # Dynamic voltage and frequency handler for the system, disabled by default
962680Sktlim@umich.edu    # Provide list of domains that need to be controlled by the handler
972680Sktlim@umich.edu    dvfs_handler = DVFSHandler()
982292SN/A