-
Notifications
You must be signed in to change notification settings - Fork 296
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
flow: convert DONT_USE to text files if GZ, ensure files are read as … #373
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,10 @@ | |
|
||
# Read input file | ||
print("Opening file for replace:",args.inputFile) | ||
if args.inputFile.endswith(".gz"): | ||
f = gzip.open(args.inputFile, 'rt') | ||
if args.inputFile.endswith(".gz") or args.inputFile.endswith(".GZ"): | ||
f = gzip.open(args.inputFile, 'rt', encoding="ascii") | ||
else: | ||
f = open(args.inputFile) | ||
f = open(args.inputFile, encoding="ascii") | ||
content = f.read() | ||
f.close() | ||
|
||
|
@@ -45,6 +45,12 @@ | |
content, count = re.subn(pattern, replace, content) | ||
print("Commented", count, "lines containing \"original_pin\"") | ||
|
||
# Yosys, does not like properties that start with : !, without quotes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know I'm necroposting, but I'm revisiting the necessity for this script from the yosys side. Is this a workaround for YosysHQ/yosys#3498 which has been fixed? cc @povik There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Highly likely, you can try removing those lines (file is currently called |
||
pattern = r":\s+(!.*)\s+;" | ||
replace = r': "\1" ;' | ||
content, count = re.subn(pattern, replace, content) | ||
print("Replaced malformed functions", count) | ||
|
||
# Write output file | ||
print("Writing replaced file:",args.outputFile) | ||
f = open(args.outputFile, "w") | ||
|
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.
Based on your comments today, do you need to use utf8?
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 I read it as acsii, the characters are ignored, so it has the same effect as reading it as uft-8 and then converting (except being a little simpler)
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.
I was wrong, I had the wrong version of the file copied in