mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-23 13:04:28 +00:00
34 lines
742 B
Python
Executable File
34 lines
742 B
Python
Executable File
#!/usr/bin/env python3
|
|
import sys
|
|
import re
|
|
|
|
def usage():
|
|
print("Usage: ./renumber.py <input xdc file> <output xdc file>")
|
|
|
|
def main(args):
|
|
if (len(args) != 2):
|
|
usage()
|
|
exit()
|
|
|
|
probenum = 0
|
|
countLines = 1
|
|
|
|
with open(args[0],'r') as xdcfile, open(args[1], 'w') as outfile:
|
|
Lines = xdcfile.readlines()
|
|
for line in Lines:
|
|
t = re.sub("probe[0-9]+", f"probe{probenum}",line)
|
|
|
|
if line.find("probe") >= 0:
|
|
countLines = countLines + 1
|
|
|
|
if countLines == 4:
|
|
countLines = 0
|
|
probenum = probenum + 1
|
|
|
|
outfile.write(t)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main(sys.argv[1:])
|