arm_generic.py revision 9728:7daeab1685e9
16899SN/A# Copyright (c) 2012 ARM Limited
28851Sandreas.hansson@arm.com# All rights reserved.
38851Sandreas.hansson@arm.com#
48851Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall
58851Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual
68851Sandreas.hansson@arm.com# property including but not limited to intellectual property relating
78851Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software
88851Sandreas.hansson@arm.com# licensed hereunder.  You may use the software subject to the license
98851Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated
108851Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software,
118851Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form.
128851Sandreas.hansson@arm.com#
138851Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
146899SN/A# modification, are permitted provided that the following conditions are
156899SN/A# met: redistributions of source code must retain the above copyright
166899SN/A# notice, this list of conditions and the following disclaimer;
176899SN/A# redistributions in binary form must reproduce the above copyright
186899SN/A# notice, this list of conditions and the following disclaimer in the
196899SN/A# documentation and/or other materials provided with the distribution;
206899SN/A# neither the name of the copyright holders nor the names of its
216899SN/A# contributors may be used to endorse or promote products derived from
226899SN/A# this software without specific prior written permission.
236899SN/A#
246899SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
256899SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
266899SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
276899SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
286899SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
296899SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
306899SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
316899SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
326899SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
336899SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
346899SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
356899SN/A#
366899SN/A# Authors: Andreas Sandberg
376899SN/A
386899SN/Afrom abc import ABCMeta, abstractmethod
396899SN/Aimport m5
406899SN/Afrom m5.objects import *
416899SN/Afrom m5.proxy import *
427805Snilay@cs.wisc.edum5.util.addToPath('../configs/common')
437632SBrad.Beckmann@amd.comimport FSConfig
447632SBrad.Beckmann@amd.comfrom Caches import *
458232Snate@binkert.orgfrom base_config import *
466899SN/A
477053SN/Aclass LinuxArmSystemBuilder(object):
487053SN/A    """Mix-in that implements create_system.
496899SN/A
506899SN/A    This mix-in is intended as a convenient way of adding an
518832SAli.Saidi@ARM.com    ARM-specific create_system method to a class deriving from one of
526899SN/A    the generic base systems.
536899SN/A    """
547053SN/A    def __init__(self, machine_type):
558832SAli.Saidi@ARM.com        """
568932SBrad.Beckmann@amd.com        Arguments:
576899SN/A          machine_type -- String describing the platform to simulate
586899SN/A        """
598184Ssomayeh@cs.wisc.edu        self.machine_type = machine_type
608932SBrad.Beckmann@amd.com
618932SBrad.Beckmann@amd.com    def create_system(self):
626899SN/A        system = FSConfig.makeArmSystem(self.mem_mode,
637053SN/A                                        self.machine_type,
646899SN/A                                        DDR3_1600_x64,
658932SBrad.Beckmann@amd.com                                        None, False)
668932SBrad.Beckmann@amd.com
678932SBrad.Beckmann@amd.com        # We typically want the simulator to panic if the kernel
688932SBrad.Beckmann@amd.com        # panics or oopses. This prevents the simulator from running
698932SBrad.Beckmann@amd.com        # an obviously failed test case until the end of time.
708932SBrad.Beckmann@amd.com        system.panic_on_panic = True
718932SBrad.Beckmann@amd.com        system.panic_on_oops = True
728932SBrad.Beckmann@amd.com
738932SBrad.Beckmann@amd.com        self.init_system(system)
748932SBrad.Beckmann@amd.com        return system
758932SBrad.Beckmann@amd.com
768932SBrad.Beckmann@amd.comclass LinuxArmFSSystem(LinuxArmSystemBuilder,
778932SBrad.Beckmann@amd.com                       BaseFSSystem):
788932SBrad.Beckmann@amd.com    """Basic ARM full system builder."""
798932SBrad.Beckmann@amd.com
808932SBrad.Beckmann@amd.com    def __init__(self, machine_type='RealView_PBX', **kwargs):
818932SBrad.Beckmann@amd.com        """Initialize an ARM system that supports full system simulation.
828932SBrad.Beckmann@amd.com
838932SBrad.Beckmann@amd.com        Note: Keyword arguments that are not listed below will be
848932SBrad.Beckmann@amd.com        passed to the BaseFSSystem.
858932SBrad.Beckmann@amd.com
868932SBrad.Beckmann@amd.com        Keyword Arguments:
878851Sandreas.hansson@arm.com          machine_type -- String describing the platform to simulate
888851Sandreas.hansson@arm.com        """
897053SN/A        BaseSystem.__init__(self, **kwargs)
907053SN/A        LinuxArmSystemBuilder.__init__(self, machine_type)
916899SN/A
926899SN/Aclass LinuxArmFSSystemUniprocessor(LinuxArmSystemBuilder,
936899SN/A                                   BaseFSSystemUniprocessor):
946899SN/A    """Basic ARM full system builder for uniprocessor systems.
957053SN/A
968932SBrad.Beckmann@amd.com    Note: This class is a specialization of the ArmFSSystem and is
978932SBrad.Beckmann@amd.com    only really needed to provide backwards compatibility for existing
988932SBrad.Beckmann@amd.com    test cases.
996899SN/A    """
1006899SN/A
1017053SN/A    def __init__(self, machine_type='RealView_PBX', **kwargs):
1027053SN/A        BaseFSSystemUniprocessor.__init__(self, **kwargs)
1036899SN/A        LinuxArmSystemBuilder.__init__(self, machine_type)
1048932SBrad.Beckmann@amd.com
1056899SN/A
1068932SBrad.Beckmann@amd.comclass LinuxArmFSSwitcheroo(LinuxArmSystemBuilder, BaseFSSwitcheroo):
1077053SN/A    """Uniprocessor ARM system prepared for CPU switching"""
1087053SN/A
1097053SN/A    def __init__(self, machine_type='RealView_PBX', **kwargs):
1106899SN/A        BaseFSSwitcheroo.__init__(self, **kwargs)
1118932SBrad.Beckmann@amd.com        LinuxArmSystemBuilder.__init__(self, machine_type)
1128932SBrad.Beckmann@amd.com