Skip to content

bug(xcelium): cannot use the fusesoc run --xrun_options from command line because option is a string type #530

Description

@tymonx

Edalize is expecting that the xrun_options is a list. But the xrun_options defined in the TOOL_OPTIONS is using the str type:

"xrun_options": {"type": "str", "desc": "Additional run options for xrun"},

Unfortunately the mapping is limited on the FuseSoC side:

https://github.com/olofk/fusesoc/blob/f15e1c8a76815c4f391231dd0e743e2b683c6b45/fusesoc/edalizer.py#L478

Generally this is a common problem for all tools.

Proposition is to add a new small utility function:

import shlex
from typing import Any
from collections.abc import Iterable

def to_args(value: Any) -> list[str]:
    """Convert any provided value to list of strings."""
    if not value:
        return []

    if isinstance(value, str):
        return shlex.parse(value)

    if isinstance(value, Iterable):
        return [str(item) for item in value]

    return to_args(str(value))

Then it could be used like this:

args += to_args(self.tool_options.get("xrun_options"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions