コード例 #1
0
ファイル: __init__.py プロジェクト: ArnauBigas/microprobe
def import_definition(definition_tuple):
    """Return the target corresponding the to the given *definition_tuple*.

    Return the target object corresponding the to the given
    *definition_tuple*. The *definition_tuple* is a string of the form
    ``<architecture_name>-<uarch_name>-<environment_name>`` that defines the
    target. This function uses the search paths provided in the configuration
    to look for the definitions to import.

    :param definition_tuple: Target definition string
    :type definition_tuple: :class:`~.str`
    :return: The target object corresponding to the given *definition_tuple*
    :rtype: :class:`~.Target`
    :raise microprobe.exceptions.MicroprobeTargetDefinitionError: if something
        is wrong during the import
    """
    LOG.debug("Start importing definition tuple")

    if isinstance(definition_tuple, str):
        definition_tuple = _parse_definition_tuple(definition_tuple)

    isa_def, uarch_def, env_def = definition_tuple
    isa = import_isa_definition(os.path.dirname(isa_def.filename))
    env = import_env_definition(env_def.filename,
                                isa,
                                definition_name=env_def.name)
    uarch = import_microarchitecture_definition(
        os.path.dirname(uarch_def.filename))

    target = Target(isa, uarch=uarch, env=env)
    LOG.info("Target '%s-%s-%s' imported", isa_def.name, uarch_def.name,
             env_def.name)
    LOG.debug("End importing definition tuple")
    return target
コード例 #2
0
# Own modules
from microprobe.target.isa import find_isa_definitions, import_isa_definition

__author__ = "Ramon Bertran"
__copyright__ = "Copyright 2011-2021 IBM Corporation"
__credits__ = []
__license__ = "IBM (c) 2011-2021 All rights reserved"
__version__ = "0.5"
__maintainer__ = "Ramon Bertran"
__email__ = "*****@*****.**"
__status__ = "Development"  # "Prototype", "Development", or "Production"

# Constants
ISANAME = "power_v206"

# Functions

# Classes

# Main

# Search and import definition
ISADEF = import_isa_definition(
    os.path.dirname([
        isa for isa in find_isa_definitions() if isa.name == ISANAME
    ][0].filename))

# Print definition
print((ISADEF.full_report()))
exit(0)
コード例 #3
0
 def setUpClass(cls):
     cls.isa_obj = import_isa_definition(cls.isa_path)
     cls.env_obj = import_env_definition(cls.env_path, cls.isa_obj)
     cls.target = Target(cls.isa_obj, env=cls.env_obj)
コード例 #4
0
                os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
                             "..", "..", "riscv", "isa", "riscv-v2_2"),
                os.path.join(os.path.dirname(os.path.abspath(__file__)), "..",
                             "..", "..", "riscv", "env",
                             "riscv_linux_gcc.py"), [
                                 "BEQ_V0", "BGEU_V0", "BGE_V0", "BLTU_V0",
                                 "BLT_V0", "BNE_V0", "C.BEQZ_V0", "C.BNEZ_V0",
                                 "C.J_V0", "JAL_V0"
                             ], [])]

TEST_CLASSES = []
for name, gen_function, isa_path, env_path, \
        expected_fails, unsupported in TARGETS:

    # py2lint: disable=cell-var-from-loop
    isa_obj = import_isa_definition(isa_path)

    class TestTarget(TestCase):  # pylint: disable=too-many-public-methods
        """
        TestTarget Test Class.
        """

        name = name
        isa_path = isa_path
        env_path = env_path
        gen_function = gen_function
        compiler_bin = "MP_TESTING_COMPILER_%s" % (name.upper())
        compiler_flags = "MP_TESTING_CFLAGS_%s" % (name.upper())
        asm_flags = "MP_TESTING_AFLAGS_%s" % (name.upper())
        dump_flags = "MP_TESTING_DFLAGS_%s" % (name.upper())