System.py revision 8597:45c9f664a365
12SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
29952Sdam.sunwoo@arm.com# Copyright (c) 2011 Regents of the University of California
39952Sdam.sunwoo@arm.com# All rights reserved.
49952Sdam.sunwoo@arm.com#
59952Sdam.sunwoo@arm.com# Redistribution and use in source and binary forms, with or without
69952Sdam.sunwoo@arm.com# modification, are permitted provided that the following conditions are
79952Sdam.sunwoo@arm.com# met: redistributions of source code must retain the above copyright
89952Sdam.sunwoo@arm.com# notice, this list of conditions and the following disclaimer;
99952Sdam.sunwoo@arm.com# redistributions in binary form must reproduce the above copyright
109952Sdam.sunwoo@arm.com# notice, this list of conditions and the following disclaimer in the
119952Sdam.sunwoo@arm.com# documentation and/or other materials provided with the distribution;
129952Sdam.sunwoo@arm.com# neither the name of the copyright holders nor the names of its
139952Sdam.sunwoo@arm.com# contributors may be used to endorse or promote products derived from
141762SN/A# this software without specific prior written permission.
159983Sstever@gmail.com#
169983Sstever@gmail.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272SN/A#
282SN/A# Authors: Nathan Binkert
292SN/A#          Rick Strong
302SN/A
312SN/Afrom m5.SimObject import SimObject
322SN/Afrom m5.defines import buildEnv
332SN/Afrom m5.params import *
342SN/Afrom m5.proxy import *
352SN/A
362SN/Afrom PhysicalMemory import *
372SN/A
382SN/Aclass MemoryMode(Enum): vals = ['invalid', 'atomic', 'timing']
392SN/A
402SN/Aclass System(SimObject):
412665Ssaidi@eecs.umich.edu    type = 'System'
422665Ssaidi@eecs.umich.edu
432SN/A    @classmethod
442SN/A    def export_method_cxx_predecls(cls, code):
451798SN/A        code('#include "sim/system.hh"')
461798SN/A
472SN/A    @classmethod
489983Sstever@gmail.com    def export_methods(cls, code):
499952Sdam.sunwoo@arm.com        code('''
502SN/A      Enums::MemoryMode getMemoryMode();
512SN/A      void setMemoryMode(Enums::MemoryMode mode);
522SN/A''')
532SN/A
549983Sstever@gmail.com    physmem = Param.PhysicalMemory("Physical Memory")
552SN/A    mem_mode = Param.MemoryMode('atomic', "The mode the memory system is in")
565606Snate@binkert.org    memories = VectorParam.PhysicalMemory(Self.all, "All memories is the system")
572SN/A
582SN/A    work_item_id = Param.Int(-1, "specific work item id")
592SN/A    work_begin_cpu_id_exit = Param.Int(-1,
603144Shsul@eecs.umich.edu        "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")
639952Sdam.sunwoo@arm.com    work_begin_exit_count = Param.Counter(0,
649983Sstever@gmail.com        "exit simulation when work items begin count value is reached")
659983Sstever@gmail.com    work_end_ckpt_count = Param.Counter(0,
6611070Sandreas.sandberg@arm.com        "create checkpoint when work items end count value is reached")
672SN/A    work_end_exit_count = Param.Counter(0,
689983Sstever@gmail.com        "exit simulation when work items end count value is reached")
699983Sstever@gmail.com    work_cpus_ckpt_count = Param.Counter(0,
709983Sstever@gmail.com        "create checkpoint when active cpu count value is reached")
719983Sstever@gmail.com
729983Sstever@gmail.com    if buildEnv['FULL_SYSTEM']:
739983Sstever@gmail.com        abstract = True
749983Sstever@gmail.com        boot_cpu_frequency = Param.Frequency(Self.cpu[0].clock.frequency,
759983Sstever@gmail.com                                             "boot processor frequency")
769983Sstever@gmail.com        init_param = Param.UInt64(0, "numerical value to pass into simulator")
779983Sstever@gmail.com        boot_osflags = Param.String("a", "boot flags to pass to the kernel")
789983Sstever@gmail.com        kernel = Param.String("", "file that contains the kernel code")
799983Sstever@gmail.com        readfile = Param.String("", "file to read startup script from")
809983Sstever@gmail.com        symbolfile = Param.String("", "file to get the symbols from")
819983Sstever@gmail.com        load_addr_mask = Param.UInt64(0xffffffffff,
829983Sstever@gmail.com                "Address to mask loading binaries with");
839983Sstever@gmail.com