__init__.py revision 12099:40bbc2917b8a
112863Sgabeblack@google.com# Copyright (c) 2017 ARM Limited
212863Sgabeblack@google.com# All rights reserved.
312863Sgabeblack@google.com#
412863Sgabeblack@google.com# The license below extends only to copyright in the software and shall
512863Sgabeblack@google.com# not be construed as granting a license to any other intellectual
612863Sgabeblack@google.com# property including but not limited to intellectual property relating
712863Sgabeblack@google.com# to a hardware implementation of the functionality of the software
812863Sgabeblack@google.com# licensed hereunder.  You may use the software subject to the license
912863Sgabeblack@google.com# terms below provided that you ensure that this notice is replicated
1012863Sgabeblack@google.com# unmodified and in its entirety in all distributions of the software,
1112863Sgabeblack@google.com# modified or unmodified, in source code or in binary form.
1212863Sgabeblack@google.com#
1312863Sgabeblack@google.com# Redistribution and use in source and binary forms, with or without
1412863Sgabeblack@google.com# modification, are permitted provided that the following conditions are
1512863Sgabeblack@google.com# met: redistributions of source code must retain the above copyright
1612863Sgabeblack@google.com# notice, this list of conditions and the following disclaimer;
1712863Sgabeblack@google.com# redistributions in binary form must reproduce the above copyright
1812863Sgabeblack@google.com# notice, this list of conditions and the following disclaimer in the
1912863Sgabeblack@google.com# documentation and/or other materials provided with the distribution;
2012863Sgabeblack@google.com# neither the name of the copyright holders nor the names of its
2112863Sgabeblack@google.com# contributors may be used to endorse or promote products derived from
2212863Sgabeblack@google.com# this software without specific prior written permission.
2312863Sgabeblack@google.com#
2412863Sgabeblack@google.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2512863Sgabeblack@google.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2612863Sgabeblack@google.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2712863Sgabeblack@google.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2812863Sgabeblack@google.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2912863Sgabeblack@google.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3012863Sgabeblack@google.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3112863Sgabeblack@google.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3212863Sgabeblack@google.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3312950Sgabeblack@google.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3412982Sgabeblack@google.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3512950Sgabeblack@google.com#
3612950Sgabeblack@google.com# Authors: Andreas Sandberg
3712950Sgabeblack@google.com
3812950Sgabeblack@google.comfrom pkgutil import iter_modules
3912950Sgabeblack@google.comfrom importlib import import_module
4012863Sgabeblack@google.com
4112863Sgabeblack@google.com_cpu_modules = [
4212863Sgabeblack@google.com    name for _, name, ispkg in iter_modules(__path__) if not ispkg
4312863Sgabeblack@google.com]
4412863Sgabeblack@google.com
4512863Sgabeblack@google.comfor c in _cpu_modules:
4612950Sgabeblack@google.com    try:
4712950Sgabeblack@google.com        import_module("." + c, package=__package__)
4812863Sgabeblack@google.com    except NameError:
4912863Sgabeblack@google.com        # Failed to import a CPU model due to a missing
5012863Sgabeblack@google.com        # dependency. This typically happens if gem5 has been compiled
5112950Sgabeblack@google.com        # without a CPU model needed by the timing model.
5212982Sgabeblack@google.com        pass
5312982Sgabeblack@google.com
5412950Sgabeblack@google.com__all__ = _cpu_modules
5512863Sgabeblack@google.com