Skip to content

Workaround for empty macro issue in Riviera-PRO#681

Merged
eine merged 2 commits into
VUnit:masterfrom
pib88:riviera_empty_define_fix
Sep 23, 2020
Merged

Workaround for empty macro issue in Riviera-PRO#681
eine merged 2 commits into
VUnit:masterfrom
pib88:riviera_empty_define_fix

Conversation

@pib88

@pib88 pib88 commented Sep 22, 2020

Copy link
Copy Markdown
Contributor

When you add sources and create empty macro like following:
VU.add_library("tb_uart_lib").add_source_files(SRC_PATH / "test" / "*.sv", defines={"EMPTY_MACRO" : ""})

It adds to vlog command a following switch:
vlog +define+EMPTY_MACRO=

However in Riviera-PRO it ends with following error:
ERROR VCP0501 "Missing option argument in command line. Option -dv requires an argument."

To workaround this you need to remove '=' operator when macro has no value.

Comment thread vunit/sim_if/rivierapro.py Outdated
args += ["+incdir+%s" % include_dir]
for key, value in source_file.defines.items():
args += ["+define+%s=%s" % (key, value)]
if value != "":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about the following?

args += ["+define+%s" % key]
if value:
    args[-1] += "=%s" % value

Also, please, run tox -e py38-fmt for getting rid of CI errors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated code with your solution. Seems like it passes in tox tests now

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Errors were produced because of an indentation issue. Your code was otherwise correct too. The change was just a style preference, since it had to be edited.

Thanks!

Workaround for empty macro issue in Riviera-PRO - more elegant solution
@eine eine merged commit f1dacbe into VUnit:master Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants