Last active
July 3, 2018 12:48
-
-
Save shtaxxx/eb8d7355fdf52b5ff1802b701544a683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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