x86_generic.py revision 9665:6dbdeee787cc
110152Satgutier@umich.edu# Copyright (c) 2012 ARM Limited
210152Satgutier@umich.edu# All rights reserved.
310152Satgutier@umich.edu#
410152Satgutier@umich.edu# The license below extends only to copyright in the software and shall
510234Syasuko.eckert@amd.com# not be construed as granting a license to any other intellectual
610152Satgutier@umich.edu# property including but not limited to intellectual property relating
710152Satgutier@umich.edu# to a hardware implementation of the functionality of the software
810152Satgutier@umich.edu# licensed hereunder.  You may use the software subject to the license
910152Satgutier@umich.edu# terms below provided that you ensure that this notice is replicated
1010152Satgutier@umich.edu# unmodified and in its entirety in all distributions of the software,
1110152Satgutier@umich.edu# modified or unmodified, in source code or in binary form.
1210152Satgutier@umich.edu#
1310152Satgutier@umich.edu# Redistribution and use in source and binary forms, with or without
1410152Satgutier@umich.edu# modification, are permitted provided that the following conditions are
1510152Satgutier@umich.edu# met: redistributions of source code must retain the above copyright
1610152Satgutier@umich.edu# notice, this list of conditions and the following disclaimer;
1710152Satgutier@umich.edu# redistributions in binary form must reproduce the above copyright
1810152Satgutier@umich.edu# notice, this list of conditions and the following disclaimer in the
1910152Satgutier@umich.edu# documentation and/or other materials provided with the distribution;
2010152Satgutier@umich.edu# neither the name of the copyright holders nor the names of its
2110152Satgutier@umich.edu# contributors may be used to endorse or promote products derived from
2210152Satgutier@umich.edu# this software without specific prior written permission.
2310152Satgutier@umich.edu#
2410152Satgutier@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2510152Satgutier@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2610152Satgutier@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2710152Satgutier@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2810152Satgutier@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2910234Syasuko.eckert@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3010152Satgutier@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3110152Satgutier@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3210152Satgutier@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3310152Satgutier@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3410152Satgutier@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3510234Syasuko.eckert@amd.com#
3610152Satgutier@umich.edu# Authors: Andreas Sandberg
3710152Satgutier@umich.edu
3810152Satgutier@umich.edufrom abc import ABCMeta, abstractmethod
3910152Satgutier@umich.eduimport m5
4010152Satgutier@umich.edufrom m5.objects import *
4110152Satgutier@umich.edufrom m5.proxy import *
4210152Satgutier@umich.edum5.util.addToPath('../configs/common')
4310234Syasuko.eckert@amd.comfrom Benchmarks import SysConfig
4410234Syasuko.eckert@amd.comimport FSConfig
4510234Syasuko.eckert@amd.comfrom Caches import *
4610234Syasuko.eckert@amd.comfrom base_config import *
4710234Syasuko.eckert@amd.com
4810234Syasuko.eckert@amd.comclass LinuxX86SystemBuilder(object):
4910234Syasuko.eckert@amd.com    """Mix-in that implements create_system.
5010234Syasuko.eckert@amd.com
5110234Syasuko.eckert@amd.com    This mix-in is intended as a convenient way of adding an
5210234Syasuko.eckert@amd.com    X86-specific create_system method to a class deriving from one of
5310234Syasuko.eckert@amd.com    the generic base systems.
5410234Syasuko.eckert@amd.com    """
5510234Syasuko.eckert@amd.com    def __init__(self):
5610234Syasuko.eckert@amd.com        pass
5710234Syasuko.eckert@amd.com
5810234Syasuko.eckert@amd.com    def create_system(self):
5910234Syasuko.eckert@amd.com        mdesc = SysConfig(disk = 'linux-x86.img')
6010234Syasuko.eckert@amd.com        system = FSConfig.makeLinuxX86System(self.mem_mode,
6110234Syasuko.eckert@amd.com                                             SimpleDDR3,
6210234Syasuko.eckert@amd.com                                             numCPUs=self.num_cpus,
6310234Syasuko.eckert@amd.com                                             mdesc=mdesc)
6410234Syasuko.eckert@amd.com        system.kernel = FSConfig.binary('x86_64-vmlinux-2.6.22.9')
6510234Syasuko.eckert@amd.com
6610234Syasuko.eckert@amd.com        self.init_system(system)
6710152Satgutier@umich.edu        return system
6810234Syasuko.eckert@amd.com
6910234Syasuko.eckert@amd.comclass LinuxX86FSSystem(LinuxX86SystemBuilder,
7010234Syasuko.eckert@amd.com                       BaseFSSystem):
7110234Syasuko.eckert@amd.com    """Basic X86 full system builder."""
7210234Syasuko.eckert@amd.com
7310234Syasuko.eckert@amd.com    def __init__(self, **kwargs):
7410234Syasuko.eckert@amd.com        """Initialize an X86 system that supports full system simulation.
7510234Syasuko.eckert@amd.com
7610234Syasuko.eckert@amd.com        Note: Keyword arguments that are not listed below will be
7710234Syasuko.eckert@amd.com        passed to the BaseFSSystem.
7810234Syasuko.eckert@amd.com
7910234Syasuko.eckert@amd.com        Keyword Arguments:
8010234Syasuko.eckert@amd.com          machine_type -- String describing the platform to simulate
8110234Syasuko.eckert@amd.com        """
8210234Syasuko.eckert@amd.com        BaseSystem.__init__(self, **kwargs)
8310234Syasuko.eckert@amd.com        LinuxX86SystemBuilder.__init__(self)
8410234Syasuko.eckert@amd.com
8510234Syasuko.eckert@amd.com    def create_caches_private(self, cpu):
8610234Syasuko.eckert@amd.com        cpu.addPrivateSplitL1Caches(L1Cache(size='32kB', assoc=1),
8710234Syasuko.eckert@amd.com                                    L1Cache(size='32kB', assoc=4),
8810234Syasuko.eckert@amd.com                                    PageTableWalkerCache(),
8910234Syasuko.eckert@amd.com                                    PageTableWalkerCache())
9010234Syasuko.eckert@amd.com
9110234Syasuko.eckert@amd.comclass LinuxX86FSSystemUniprocessor(LinuxX86SystemBuilder,
9210234Syasuko.eckert@amd.com                                   BaseFSSystemUniprocessor):
9310234Syasuko.eckert@amd.com    """Basic X86 full system builder for uniprocessor systems.
9410234Syasuko.eckert@amd.com
9510234Syasuko.eckert@amd.com    Note: This class is a specialization of the X86FSSystem and is
9610234Syasuko.eckert@amd.com    only really needed to provide backwards compatibility for existing
9710234Syasuko.eckert@amd.com    test cases.
9810234Syasuko.eckert@amd.com    """
9910152Satgutier@umich.edu
10010152Satgutier@umich.edu    def __init__(self, **kwargs):
10110152Satgutier@umich.edu        BaseFSSystemUniprocessor.__init__(self, **kwargs)
102        LinuxX86SystemBuilder.__init__(self)
103
104    def create_caches_private(self, cpu):
105        cpu.addTwoLevelCacheHierarchy(L1Cache(size='32kB', assoc=1),
106                                      L1Cache(size='32kB', assoc=4),
107                                      L2Cache(size='4MB', assoc=8),
108                                      PageTableWalkerCache(),
109                                      PageTableWalkerCache())
110