Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verilator string parameters not generated correctly #181

Open
rishubn opened this issue Mar 22, 2022 · 2 comments
Open

Verilator string parameters not generated correctly #181

rishubn opened this issue Mar 22, 2022 · 2 comments

Comments

@rishubn
Copy link

rishubn commented Mar 22, 2022

Verilator requires string parameters to be surrounded by quotes:
-Gparam="value"

Strings

Strings must be in double quotes (“”). They must be escaped properly on the command line, e.g. as -GSTR="\"My String\"" or -GSTR='"My String"'

If given a dict like { "param" : "value" } cocotb_test will generate -Gparam=value and Verilator will fail to compile.

Some simple logic can be added to do this wrapping in simulator.py:

for name, value in parameters.items():
            parameters_cmd.append("-G" + name + "=\"" + str(value) + "\"") if type(value) is str else parameters_cmd.append("-G" + name + "=" + str(value))
@themperek
Copy link
Owner

@rishubn Does #200 work for you?

@themperek
Copy link
Owner

Adding quotes fails on my local machine. Maybe I am doing something wrong.

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

No branches or pull requests

2 participants