Skip to content

Instantly share code, notes, and snippets.

@buhii
Created January 11, 2012 04:29
Show Gist options
  • Save buhii/1593025 to your computer and use it in GitHub Desktop.
Save buhii/1593025 to your computer and use it in GitHub Desktop.
verilog file's correct tool
import re
import sys
re_v = re.compile('(\s+)(reg|wire)(\s+)(\w+)\s*(\[\d+:0\]);')
for line in sys.stdin:
line = line[:-1] # to remove new line
result = re_v.search(line)
if result:
g = result.groups()
print "%s%s\t%s\t%s;" % (g[0], g[1], g[4], g[3])
else:
print line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment