Skip to content

Discussion: plus_args as a dict rather than a list #256

@manunited10

Description

@manunited10

I have recently started working with cocotb-test, trying to get away from the makefile method. It's amazing!

plus_args:

My understanding of plus_args usage (PLUSARGS in cocotb) is a way to send python parameters to python test - at least that's how I do it through makefile (e.g. to send x=1, y=10, etc to python). These values are accessible in python under cocotb.plusargs variable.

If what I think is true, shouldn't plus_args in cocotb-test be a dict (rather than a list) like below?

plus_args = {'x': 1, 'y': 10,}

And that means
in simulator.py under Class Questa(Simulator) we may need another method like

    def get_plus_args_commands(self, parameters): 
        return [f"+{name}={str(value)}" for name, value in parameters.items()]

which is basically (almost) identical to get_parameter_commands.
and then later we use this method like

if not self.compile_only:
    if self.toplevel_lang == "vhdl":
        cmd.append(
              ...
            + [as_tcl_value(v) for v in self.get_plus_args_commands(self.plus_args)]

Thank you in advance.

p.s. I'm using cocotb 1.8.1, cocotb-test 0.2.5 and python 3.10.14

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