-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow write_lakeroad
backend to write output to file instead of stdout.
#9
Allow write_lakeroad
backend to write output to file instead of stdout.
#9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we run this test, it will generate a "junk" output file. If we run the tests with a clean git directory (that is, no changes made, all changes committed), it will become dirty. This isn't ideal. There are a few ways to fix this:
- Delete the file after it's written. Unsure if this can be done from within a Yosys script. Sometimes scripting languages let you run shell commands, e.g. by prefixing with
!
(like!rm file.egg
). Maybe see if this is the case in yosys? (from my simple test on my command line, this is the case!) - Generate the file to a temporary directory. This would also require getting the temporary directory within the Yosys script. Normally in a shell script this can be done e.g. with
mktemp
, but I'm not sure how to make that available in Yosys. - Add the generated file to the .gitignore (less ideal).
- Just add functionality for writing to a file, but don't test it. (Obviously testing everything is ideal, so this is the worst option.)
These are intentionally ordered best to worst. I think the first option should work -- can you try it?
backends/lakeroad/example.ys
Outdated
write_lakeroad file.egg | ||
# Write output to stdout | ||
# write_lakeroad |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Write output to file instead of stdout | |
write_lakeroad file.egg | |
# Write output to stdout | |
# write_lakeroad | |
write_lakeroad | |
write_lakeroad file.egg | |
!rm file.egg |
We might as well test both writing to a file and writing to stdout. Also added code solving my requested change above.
backends/lakeroad/lakeroad.cc
Outdated
// Copied from firrtl code. Not sure why "filename" is not set ever | ||
// even when I pass "write_lakeroad hello.egg" or something |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copied from firrtl code. Not sure why "filename" is not set ever | |
// even when I pass "write_lakeroad hello.egg" or something | |
// Copied from firrtl code. |
I'll explain to you why filename is not set, and then we can delete this comment (b/c the comment isn't actually relevant to the code). the filename
variable isn't set because, when you call write_lakeroad
from the Yosys shell (which is how you've been calling it), the Yosys internals call execute
without passing filename
. I don't know where in the Yosys codebase execute
is ever called with a filename, but there must be some place where it's used. When you do write_lakeroad hello.egg
, Yosys puts hello.egg
into args
, not into filename
. (that's why this block of code exists: it basically says, if filename
isn't set explicitly, then use the last argument as a filename)
Thanks!! A few comments and then we can merge. |
Bump on this! Would love to merge it and don't want it to go stale. |
@gussmith23 sorry for forgetting! I was busy with TA duties for the past couple of days (end of quarter is always crazy). |
2a18fe5
into
uwsampl:gussmith23/lakeroad-backend
No problem at all. Classes and TAing is more important! Just wanted to make sure it didn't get forgotten. Congrats on finishing your quarter! |
Add code to allow
write_lakeroad
backend to write to file instead of stdout.Example (in
example.ys
):@gussmith23