System.py revision 8597:45c9f664a365
110448Snilay@cs.wisc.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan
210448Snilay@cs.wisc.edu# Copyright (c) 2011 Regents of the University of California
310448Snilay@cs.wisc.edu# All rights reserved.
410448Snilay@cs.wisc.edu#
510448Snilay@cs.wisc.edu# Redistribution and use in source and binary forms, with or without
610448Snilay@cs.wisc.edu# modification, are permitted provided that the following conditions are
710448Snilay@cs.wisc.edu# met: redistributions of source code must retain the above copyright
810448Snilay@cs.wisc.edu# notice, this list of conditions and the following disclaimer;
910448Snilay@cs.wisc.edu# redistributions in binary form must reproduce the above copyright
1010448Snilay@cs.wisc.edu# notice, this list of conditions and the following disclaimer in the
1110448Snilay@cs.wisc.edu# documentation and/or other materials provided with the distribution;
1210448Snilay@cs.wisc.edu# neither the name of the copyright holders nor the names of its
1310448Snilay@cs.wisc.edu# contributors may be used to endorse or promote products derived from
1410448Snilay@cs.wisc.edu# this software without specific prior written permission.
1510448Snilay@cs.wisc.edu#
1610448Snilay@cs.wisc.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1710448Snilay@cs.wisc.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1810448Snilay@cs.wisc.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1910448Snilay@cs.wisc.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2010448Snilay@cs.wisc.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2110448Snilay@cs.wisc.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2210447Snilay@cs.wisc.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2310447Snilay@cs.wisc.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2410447Snilay@cs.wisc.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2510447Snilay@cs.wisc.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2610447Snilay@cs.wisc.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2710447Snilay@cs.wisc.edu#
2810447Snilay@cs.wisc.edu# Authors: Nathan Binkert
2910447Snilay@cs.wisc.edu#          Rick Strong
3010447Snilay@cs.wisc.edu
3110447Snilay@cs.wisc.edufrom m5.SimObject import SimObject
3210447Snilay@cs.wisc.edufrom m5.defines import buildEnv
3310447Snilay@cs.wisc.edufrom m5.params import *
3410447Snilay@cs.wisc.edufrom m5.proxy import *
3510447Snilay@cs.wisc.edu
3610447Snilay@cs.wisc.edufrom PhysicalMemory import *
3710447Snilay@cs.wisc.edu
3810447Snilay@cs.wisc.educlass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing']
3910447Snilay@cs.wisc.edu
4010447Snilay@cs.wisc.educlass System(SimObject):
4110447Snilay@cs.wisc.edu    type = 'System'
4210447Snilay@cs.wisc.edu
4310447Snilay@cs.wisc.edu    @classmethod
4410447Snilay@cs.wisc.edu    def export_method_cxx_predecls(cls, code):
4510447Snilay@cs.wisc.edu        code('#include "sim/system.hh"')
4610447Snilay@cs.wisc.edu
4710447Snilay@cs.wisc.edu    @classmethod
4810447Snilay@cs.wisc.edu    def export_methods(cls, code):
4910447Snilay@cs.wisc.edu        code('''
5010447Snilay@cs.wisc.edu      Enums::MemoryMode getMemoryMode();
5110447Snilay@cs.wisc.edu      void setMemoryMode(Enums::MemoryMode mode);
5210447Snilay@cs.wisc.edu''')
5310447Snilay@cs.wisc.edu
5410447Snilay@cs.wisc.edu    physmem = Param.PhysicalMemory("Physical Memory")
5510447Snilay@cs.wisc.edu    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
5610447Snilay@cs.wisc.edu    memories = VectorParam.PhysicalMemory(Self.all, "All memories is the system")
5710447Snilay@cs.wisc.edu
5810447Snilay@cs.wisc.edu    work_item_id = Param.Int(-1, "specific work item id")
5910447Snilay@cs.wisc.edu    work_begin_cpu_id_exit = Param.Int(-1,
6010447Snilay@cs.wisc.edu        "work started on specific id, now exit simulation")
6110447Snilay@cs.wisc.edu    work_begin_ckpt_count = Param.Counter(0,
6210447Snilay@cs.wisc.edu        "create checkpoint when work items begin count value is reached")
6310447Snilay@cs.wisc.edu    work_begin_exit_count = Param.Counter(0,
6410447Snilay@cs.wisc.edu        "exit simulation when work items begin count value is reached")
6510447Snilay@cs.wisc.edu    work_end_ckpt_count = Param.Counter(0,
66        "create checkpoint when work items end count value is reached")
67    work_end_exit_count = Param.Counter(0,
68        "exit simulation when work items end count value is reached")
69    work_cpus_ckpt_count = Param.Counter(0,
70        "create checkpoint when active cpu count value is reached")
71
72    if buildEnv['FULL_SYSTEM']:
73        abstract = True
74        boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
75                                             "boot processor frequency")
76        init_param = Param.UInt64(0, "numerical value to pass into simulator")
77        boot_osflags = Param.String("a", "boot flags to pass to the kernel")
78        kernel = Param.String("", "file that contains the kernel code")
79        readfile = Param.String("", "file to read startup script from")
80        symbolfile = Param.String("", "file to get the symbols from")
81        load_addr_mask = Param.UInt64(0xffffffffff,
82                "Address to mask loading binaries with");
83