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 --synthesis-template arg to parse.py #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ballifatih
Copy link
Contributor

@ballifatih ballifatih commented Oct 18, 2023

I like the fact that parse.py has create_yosys_script function, that takes a yosys template synthesis script and produces the final script by populating READ_FILES, TOP_MODULE etc. variables conveniently.

In my use case, I needed to make a quite a few modifications in the yosys script so I was using --synthesis-file to provide the script. However, since this argument does not pass through create_yosys_script function, parse.py does not automatically handle source files, module names etc. On the other hand, as far as I understand, there is not an elegant way to access environment inside a yosys script, and therefore one ends up hard coding the source file paths into the yosys script. This was problematic in my use case, because

  1. I invoke CocoAlma flow outside its own directory, and
  2. My source files are spread around few different directories, and hard coded paths would not work for other folks who would like to run the same flow.

I think it would be great to have a arg to pass template yosys script (instead of the final yosys script). This PR brings this change.

It could also be possible to remove this --synthesis-template and instead define a new arg --path-synthesis-file that changes how --synthesis-file is interpreted.

cc: @vedadux @vogelpi

Even though existing `--synthesis-file` parameter allows one to bring
a custom yosys script, this is not very flexible, because it needs the
source files hardcoded into the script. This is because, this argument
 does not use the yosys patching function `create_yosys_script` in
  `parse.py`.

The new optional `--synthesis-template` allows one to pass
a *template* yosys script that is still patched by `parse.py` so
that source files do not have to be hard coded into the script.
This gives the caller a good flexibility of controlling the synthesis
flow without having to deal with source files.

Ideal use case would be to pass both `--source` and
`--synthesis-template` together.
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.

1 participant