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

add setenv pass #4778

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

add setenv pass #4778

wants to merge 3 commits into from

Conversation

nakengelhardt
Copy link
Member

@nakengelhardt nakengelhardt commented Nov 28, 2024

What are the reasons/motivation for this change?

File lists (a verific feature) will often make use of environment variables in file paths, e.g. this example from the CV32E40P core. This provides a way to set these variables from within a yosys script.

Explain how this is achieved.

Add a setenv command that simply passes its arguments to the setenv() POSIX function.

If applicable, please suggest to reviewers how they can test the change.

There's a testcase included that can be used with verific.

In the absence of verific, it's possible to use this to set any other environment variable that yosys checks (although there aren't too many - you can change HOME or PATH and see what mayhem you can cause...) It would also be possible to use TCL to check that the value was updated correctly.

Unlike the TCL implementation, this is not thread-safe, but neither is most of the rest of yosys.

TODO:

  • add the right guards for windows. @mmicko, could you have a look at that?
  • handle quoted strings

@nakengelhardt nakengelhardt marked this pull request as ready for review November 28, 2024 14:22
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