1#!/usr/bin/env python3
2
3import sys, os
4
5dsptype = None
6dsppath = sys.argv[1].replace(".vsb", ".dsp")
7
8if os.path.exists(dsppath):
9    with open(dsppath, 'r') as f:
10        dsptype = f.readline().strip()
11
12with open("tmedges.tmp", "a") as outfile:
13    with open("tmedges_unrenamed.tmp", "r") as infile:
14        for line in infile:
15            if "SB_MAC16" in line:
16                if dsptype is not None:
17                    outfile.write(line.replace("SB_MAC16", dsptype))
18            else:
19                outfile.write(line)
20