Skip to content

Instantly share code, notes, and snippets.

@liangfu
Created September 22, 2019 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liangfu/eddaf21bef499040b2b35db54428893f to your computer and use it in GitHub Desktop.
Save liangfu/eddaf21bef499040b2b35db54428893f to your computer and use it in GitHub Desktop.
Strip Comment Sections in Chisel Generated Verilog files
#!/usr/bin/env python3
import os, sys
out = ""
with open(sys.argv[1], 'r') as fp:
lines = fp.readlines()
for idx, line in enumerate(lines):
end = line.find(" // @[")
line = line[:end] + '\n'
out += line
with open(sys.argv[1], 'w') as fp:
fp.write(out)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment