Skip to content

Instantly share code, notes, and snippets.

@shtaxxx
Last active July 3, 2018 12:48
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 shtaxxx/eb8d7355fdf52b5ff1802b701544a683 to your computer and use it in GitHub Desktop.
Save shtaxxx/eb8d7355fdf52b5ff1802b701544a683 to your computer and use it in GitHub Desktop.
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
try:
repname = os.path.dirname(os.path.abspath(sys.argv[1])) + '/tmp.v'
rep = open(repname, 'r')
f = open(sys.argv[1], 'r')
except:
exit(0)
new_lines = []
while True:
line = f.readline()
if line.startswith('expected_verilog'):
while True:
line = f.readline()
if line.startswith('"""'):
break
new_lines.append('expected_verilog = """')
new_lines.extend(rep.readlines())
new_lines.append('"""')
new_lines.extend(f.readlines())
break
else:
new_lines.append(line)
with open(sys.argv[1], 'w') as f:
f.writelines(new_lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment