mlonmcu.target package

Subpackages

Submodules

mlonmcu.target.bench module

Helper functions for benchmarking.

mlonmcu.target.bench.add_bench_metrics(out, metrics, allow_missing=False, target_name=None)[source]
mlonmcu.target.bench.parse_bench_results(out, allow_missing=False, target_name=None)[source]

mlonmcu.target.common module

Helper functions used by MLonMCU targets

mlonmcu.target.common.add_common_options(parser: ArgumentParser, target)[source]

Add a set of common options to a command line parser.

Parameters:
parserargparse.ArgumentParser

The command line parser

mlonmcu.target.common.cli(target, args: List[str] | None = None)[source]

Utility to handle the command line api for targets.

Parameters:
targetTarget

The target to be used.

argslist

Interface to pass arguments to the command line parser from test functions.

mlonmcu.target.common.execute(*args, **kwargs)[source]

Redicrection of old mlonmcu.target.common.execute to new location mlonmcu.setup.utils.execute

Parameters:
argslist

Arguments

kwargsdict

Keyword Arguments

mlonmcu.target.common.init_target_features(names, config)[source]

mlonmcu.target.elf module

ELF File Tool

mlonmcu.target.elf.get_results(elfFile)[source]

Converts and returns collected data.

mlonmcu.target.elf.logger = <Logger mlonmcu (INFO)>

Script to gather metrics on static ROM and RAM usage.

Heavility inspired by get_metrics.py found in the ETISS repository

mlonmcu.target.elf.main()[source]

Main entry point for command line usage.

mlonmcu.target.elf.parseElf(inFile)[source]

Extract static memory usage details from ELF file by mapping each segment.

mlonmcu.target.elf.parse_cmdline()[source]

Cmdline interface definition.

mlonmcu.target.elf.printSz(sz, unknown_msg='')[source]

Helper function for printing file sizes.

mlonmcu.target.elf.print_results(results)[source]

Displaying a fancy overview.

mlonmcu.target.elf.write_csv(filename, results)[source]

Utility for writing a CSV file.

mlonmcu.target.host_x86 module

MLonMCU Host/x86 Target definitions

class mlonmcu.target.host_x86.HostX86Target(name='host_x86', features=None, config=None)[source]

Bases: Target

Target using the x86 host system

Mainly interesting to easy testing and debugging because benchmarking is not possible.

DEFAULTS = {'gdbserver_attach': False, 'gdbserver_enable': False, 'gdbserver_port': 2222, 'print_outputs': False, 'repeat': None}
FEATURES = {'benchmark', 'gdbserver'}
exec(program, *args, **kwargs)[source]

Use target to execute a executable with given arguments

property gdbserver_attach
property gdbserver_enable
property gdbserver_port
get_arch()[source]

mlonmcu.target.metrics module

class mlonmcu.target.metrics.Metrics[source]

Bases: object

add(name, value, optional=False, overwrite=False, prepend=False)[source]
static from_csv(text)[source]
get(name)[source]
get_data(include_optional=False, identify_optional=False)[source]
has(name)[source]
to_csv(include_optional=False)[source]

mlonmcu.target.target module

MLonMCU Target definitions

class mlonmcu.target.target.Target(name: str, features: List[Feature] | None = None, config: dict | None = None)[source]

Bases: object

Base target class

Attributes:
namestr

Default name of the target

featureslist

List of target features which should be enabled

configdict

User config defined via key-value pairs

inspect_programstr

Program which can be used to inspect executables (i.e. readelf)

inspect_program_argslist

List of additional arguments to the inspect_program

envos._Environ

Optinal map of environment variables

DEFAULTS = {'print_outputs': False, 'repeat': None}
FEATURES = {'benchmark'}
OPTIONAL = {}
REQUIRED = {}
add_backend_config(backend, config, optimized_layouts=False, optimized_schedules=False)[source]
add_platform_config(platform, config)[source]
add_platform_defs(platform, defs)[source]
exec(program: Path, *args, cwd='/home/runner/work/mlonmcu/mlonmcu/docs', **kwargs)[source]

Use target to execute a executable with given arguments

export_artifacts(path)[source]
generate(elf) Tuple[dict, dict][source]
generate_artifacts(elf)[source]
get_arch()[source]
get_backend_config(backend, optimized_layouts=False, optimized_schedules=False)[source]
get_hardware_details()[source]
get_metrics(elf, directory, *args, handle_exit=None)[source]
get_platform_config(platform)[source]
get_platform_defs(platform)[source]
get_target_system()[source]
inspect(program: Path, *args, **kwargs)[source]

Use target to inspect a executable

parse_exit(out)[source]
property print_outputs
process_features(features)[source]
reconfigure()[source]
property repeat

Module contents

MLonMCU target submodule

class mlonmcu.target.Corstone300Target(name='corstone300', features=None, config=None)[source]

Bases: Target

Target using an ARM FVP (fixed virtual platform) based on a Cortex M55 with EthosU support

DEFAULTS = {'enable_dsp': False, 'enable_ethosu': False, 'enable_fpu': True, 'enable_mvei': False, 'ethosu_num_macs': 256, 'extra_args': '', 'model': 'cortex-m55', 'print_outputs': False, 'repeat': None, 'timeout_sec': 0}
FEATURES = {'arm_dsp', 'arm_mvei', 'ethosu'}
REQUIRED = {'arm_gcc.install_dir', 'cmsis.dir', 'cmsisnn.dir', 'corstone300.exe', 'ethosu_platform.dir'}
property cmsis_dir
property cmsisnn_dir
property enable_dsp
property enable_ethosu
property enable_fpu
property enable_mvei
property ethosu_num_macs
property ethosu_platform_dir
exec(program, *args, cwd='/home/runner/work/mlonmcu/mlonmcu/docs', **kwargs)[source]

Use target to execute a executable with given arguments

property extra_args
property fvp_exe
property gcc_prefix
get_arch()[source]
get_backend_config(backend, optimized_layouts=False, optimized_schedules=False)[source]
get_default_fvp_args()[source]
get_ethosu_fvp_args()[source]
get_metrics(elf, directory, *args, handle_exit=None)[source]
get_platform_defs(platform)[source]
property model
parse_stdout(out, handle_exit=None)[source]
property timeout_sec
class mlonmcu.target.EtissPulpinoTarget(name='etiss_pulpino', features=None, config=None)[source]

Bases: EtissTarget

Target using a Pulpino-like VP running in the ETISS simulator

REQUIRED = {'etiss.install_dir', 'etiss.src_dir', 'etissvp.script', 'riscv_gcc.install_dir', 'riscv_gcc.name', 'riscv_gcc.variant'}
get_ini_bool_config()[source]
get_platform_defs(platform)[source]
class mlonmcu.target.HostX86Target(name='host_x86', features=None, config=None)[source]

Bases: Target

Target using the x86 host system

Mainly interesting to easy testing and debugging because benchmarking is not possible.

DEFAULTS = {'gdbserver_attach': False, 'gdbserver_enable': False, 'gdbserver_port': 2222, 'print_outputs': False, 'repeat': None}
FEATURES = {'benchmark', 'gdbserver'}
exec(program, *args, **kwargs)[source]

Use target to execute a executable with given arguments

property gdbserver_attach
property gdbserver_enable
property gdbserver_port
get_arch()[source]
class mlonmcu.target.OVPSimTarget(name='ovpsim', features=None, config=None)[source]

Bases: RVPTarget, RVVTarget

Target using an ARM FVP (fixed virtual platform) based on a Cortex M55 with EthosU support

DEFAULTS = {'abi': None, 'arch': None, 'atomic': True, 'attr': '', 'bitmanip_spec': 0.94, 'compressed': True, 'cpu': None, 'elen': 64, 'embedded': False, 'embedded_vext': False, 'enable_pext': False, 'enable_vext': False, 'end_to_end_cycles': True, 'extensions': [], 'extra_args': '', 'fpu': 'double', 'gdbserver_attach': False, 'gdbserver_enable': False, 'gdbserver_port': 2222, 'multiply': True, 'pext_spec': 0.92, 'print_outputs': False, 'repeat': None, 'timeout_sec': 0, 'variant': None, 'vext_spec': 1.0, 'vlen': 128, 'xlen': 32}
FEATURES = {'benchmark', 'gdbserver', 'log_instrs', 'pext', 'trace', 'vext'}
REQUIRED = {'ovpsim.exe', 'riscv_gcc.install_dir', 'riscv_gcc.name', 'riscv_gcc.variant'}
property end_to_end_cycles
exec(program, *args, cwd='/home/runner/work/mlonmcu/mlonmcu/docs', **kwargs)[source]

Use target to execute a executable with given arguments

property extensions
property gdbserver_attach
property gdbserver_enable
property gdbserver_port
get_backend_config(backend, optimized_layouts=False, optimized_schedules=False)[source]
get_default_ovpsim_args()[source]
get_metrics(elf, directory, *args, handle_exit=None)[source]
get_platform_defs(platform)[source]
property ovpsim_exe
parse_stdout(out)[source]
property variant
class mlonmcu.target.RiscvQemuTarget(name='riscv_qemu', features=None, config=None)[source]

Bases: RISCVTarget

Target using a spike machine in the QEMU simulator

DEFAULTS = {'abi': None, 'arch': None, 'atomic': True, 'attr': '', 'compressed': True, 'cpu': None, 'elen': 32, 'embedded': False, 'embedded_vext': False, 'enable_vext': False, 'extensions': [], 'extra_args': '', 'fpu': 'double', 'multiply': True, 'print_outputs': False, 'repeat': None, 'timeout_sec': 0, 'vext_spec': 1.0, 'vlen': 0, 'xlen': 32}
FEATURES = {'benchmark', 'vext'}
REQUIRED = {'riscv32_qemu.exe', 'riscv_gcc.install_dir', 'riscv_gcc.name', 'riscv_gcc.variant'}
property attr
property elen
property embedded_vext
property enable_vext
exec(program, *args, cwd='/home/runner/work/mlonmcu/mlonmcu/docs', **kwargs)[source]

Use target to execute a executable with given arguments

property extensions
get_cpu_str()[source]
get_metrics(elf, directory, *args, handle_exit=None)[source]
get_platform_defs(platform)[source]
get_qemu_args(program)[source]
get_target_system()[source]
parse_stdout(out, handle_exit=None)[source]
property riscv32_qemu_exe
property vext_spec
property vlen
class mlonmcu.target.SpikeTarget(name='spike', features=None, config=None)[source]

Bases: RVPTarget, RVVTarget, RVBTarget

Target using the riscv-isa-sim (Spike) RISC-V simulator.

DEFAULTS = {'abi': None, 'arch': None, 'atomic': True, 'attr': '', 'bext_spec': 0.92, 'bext_zba': False, 'bext_zbb': False, 'bext_zbc': False, 'bext_zbs': False, 'compressed': True, 'cpu': None, 'elen': 64, 'embedded': False, 'embedded_vext': False, 'enable_bext': False, 'enable_pext': False, 'enable_vext': False, 'extensions': [], 'extra_args': '', 'fpu': 'double', 'multiply': True, 'pext_spec': 0.92, 'print_outputs': False, 'repeat': None, 'spikepk_extra_args': [], 'timeout_sec': 0, 'vext_spec': 1.0, 'vlen': 128, 'xlen': 32}
FEATURES = {'benchmark', 'bext', 'cachesim', 'log_instrs', 'pext', 'vext'}
REQUIRED = {'riscv_gcc.install_dir', 'riscv_gcc.name', 'riscv_gcc.variant', 'spike.exe', 'spike.pk'}
exec(program, *args, cwd='/home/runner/work/mlonmcu/mlonmcu/docs', **kwargs)[source]

Use target to execute a executable with given arguments

property extensions
get_backend_config(backend, optimized_layouts=False, optimized_schedules=False)[source]
get_metrics(elf, directory, *args, handle_exit=None)[source]
get_platform_defs(platform)[source]
property isa
parse_stdout(out, metrics, exit_code=0)[source]
property spike_exe
property spike_pk
property spikepk_extra_args
class mlonmcu.target.Target(name: str, features: List[Feature] | None = None, config: dict | None = None)[source]

Bases: object

Base target class

Attributes:
namestr

Default name of the target

featureslist

List of target features which should be enabled

configdict

User config defined via key-value pairs

inspect_programstr

Program which can be used to inspect executables (i.e. readelf)

inspect_program_argslist

List of additional arguments to the inspect_program

envos._Environ

Optinal map of environment variables

DEFAULTS = {'print_outputs': False, 'repeat': None}
FEATURES = {'benchmark'}
OPTIONAL = {}
REQUIRED = {}
add_backend_config(backend, config, optimized_layouts=False, optimized_schedules=False)[source]
add_platform_config(platform, config)[source]
add_platform_defs(platform, defs)[source]
exec(program: Path, *args, cwd='/home/runner/work/mlonmcu/mlonmcu/docs', **kwargs)[source]

Use target to execute a executable with given arguments

export_artifacts(path)[source]
generate(elf) Tuple[dict, dict][source]
generate_artifacts(elf)[source]
get_arch()[source]
get_backend_config(backend, optimized_layouts=False, optimized_schedules=False)[source]
get_hardware_details()[source]
get_metrics(elf, directory, *args, handle_exit=None)[source]
get_platform_config(platform)[source]
get_platform_defs(platform)[source]
get_target_system()[source]
inspect(program: Path, *args, **kwargs)[source]

Use target to inspect a executable

parse_exit(out)[source]
property print_outputs
process_features(features)[source]
reconfigure()[source]
property repeat
mlonmcu.target.get_targets()[source]
mlonmcu.target.register_target(target_name, t, override=False)[source]