System.py revision 8597:45c9f664a365
12689Sktlim@umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan
22689Sktlim@umich.edu# Copyright (c) 2011 Regents of the University of California
32689Sktlim@umich.edu# All rights reserved.
42689Sktlim@umich.edu#
52689Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without
62689Sktlim@umich.edu# modification, are permitted provided that the following conditions are
72689Sktlim@umich.edu# met: redistributions of source code must retain the above copyright
82689Sktlim@umich.edu# notice, this list of conditions and the following disclaimer;
92689Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright
102689Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the
112689Sktlim@umich.edu# documentation and/or other materials provided with the distribution;
122689Sktlim@umich.edu# neither the name of the copyright holders nor the names of its
132689Sktlim@umich.edu# contributors may be used to endorse or promote products derived from
142689Sktlim@umich.edu# this software without specific prior written permission.
152689Sktlim@umich.edu#
162689Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172689Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182689Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192689Sktlim@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202689Sktlim@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212689Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222689Sktlim@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232689Sktlim@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242689Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252689Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262689Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272689Sktlim@umich.edu#
282689Sktlim@umich.edu# Authors: Nathan Binkert
292689Sktlim@umich.edu#          Rick Strong
302689Sktlim@umich.edu
312689Sktlim@umich.edufrom m5.SimObject import SimObject
322689Sktlim@umich.edufrom m5.defines import buildEnv
332689Sktlim@umich.edufrom m5.params import *
342521SN/Afrom m5.proxy import *
353960Sgblack@eecs.umich.edu
364194Ssaidi@eecs.umich.edufrom PhysicalMemory import *
371070SN/A
381070SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing']
392521SN/A
402680Sktlim@umich.educlass System(SimObject):
416658Snate@binkert.org    type = 'System'
426658Snate@binkert.org
432521SN/A    @classmethod
442522SN/A    def export_method_cxx_predecls(cls, code):
452037SN/A        code('#include "sim/system.hh"')
4656SN/A
475512SMichael.Adler@intel.com    @classmethod
486658Snate@binkert.org    def export_methods(cls, code):
492378SN/A        code('''
502521SN/A      Enums::MemoryMode getMemoryMode();
512378SN/A      void setMemoryMode(Enums::MemoryMode mode);
524762Snate@binkert.org''')
534762Snate@binkert.org
542378SN/A    physmem = Param.PhysicalMemory("Physical Memory")
552SN/A    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
562SN/A    memories = VectorParam.PhysicalMemory(Self.all, "All memories is the system")
572107SN/A
582SN/A    work_item_id = Param.Int(-1, "specific work item id")
592SN/A    work_begin_cpu_id_exit = Param.Int(-1,
602SN/A        "work started on specific id, now exit simulation")
612SN/A    work_begin_ckpt_count = Param.Counter(0,
622SN/A        "create checkpoint when work items begin count value is reached")
631070SN/A    work_begin_exit_count = Param.Counter(0,
645714Shsul@eecs.umich.edu        "exit simulation when work items begin count value is reached")
652378SN/A    work_end_ckpt_count = Param.Counter(0,
662521SN/A        "create checkpoint when work items end count value is reached")
672640Sstever@eecs.umich.edu    work_end_exit_count = Param.Counter(0,
682640Sstever@eecs.umich.edu        "exit simulation when work items end count value is reached")
692378SN/A    work_cpus_ckpt_count = Param.Counter(0,
702378SN/A        "create checkpoint when active cpu count value is reached")
714997Sgblack@eecs.umich.edu
722378SN/A    if buildEnv['FULL_SYSTEM']:
732902Ssaidi@eecs.umich.edu        abstract = True
742SN/A        boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
751070SN/A                                             "boot processor frequency")
761070SN/A        init_param = Param.UInt64(0, "numerical value to pass into simulator")
771070SN/A        boot_osflags = Param.String("a", "boot flags to pass to the kernel")
782378SN/A        kernel = Param.String("", "file that contains the kernel code")
791070SN/A        readfile = Param.String("", "file to read startup script from")
804838Ssaidi@eecs.umich.edu        symbolfile = Param.String("", "file to get the symbols from")
814838Ssaidi@eecs.umich.edu        load_addr_mask = Param.UInt64(0xffffffffff,
821070SN/A                "Address to mask loading binaries with");
832520SN/A