File: rename_dsps.py

package info (click to toggle)
fpga-icestorm 0~20250207git7fbf8c0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,440 kB
  • sloc: python: 28,401; cpp: 4,970; sh: 2,594; ansic: 1,206; makefile: 697; xml: 16
file content (19 lines) | stat: -rw-r--r-- 535 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3

import sys, os

dsptype = None
dsppath = sys.argv[1].replace(".vsb", ".dsp")

if os.path.exists(dsppath):
    with open(dsppath, 'r') as f:
        dsptype = f.readline().strip()
        
with open("tmedges.tmp", "a") as outfile:
    with open("tmedges_unrenamed.tmp", "r") as infile:
        for line in infile:
            if "SB_MAC16" in line:
                if dsptype is not None:
                    outfile.write(line.replace("SB_MAC16", dsptype))
            else:
                outfile.write(line)