File: glbmapbits.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 (31 lines) | stat: -rw-r--r-- 819 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3

import re
import fileinput

tiletype = ""
x, y = 0, 0

for line in fileinput.input():
    if line.startswith("LogicTile"):
        fields = line.split("_")
        tiletype = "Logic"
        x, y = int(fields[1]), int(fields[2])
        continue

    if line.startswith("RAM_Tile") or line.startswith("IO_Tile"):
        fields = line.split("_")
        tiletype = fields[0]
        x, y = int(fields[2]), int(fields[3])
        continue

    if line.startswith("GlobalNetwork"):
        tiletype = ""
        continue

    if tiletype != "":
        fields = re.split('[ ()]*', line.strip())
        if len(fields) <= 1: continue
        fields = [int(fields[i+1]) for i in range(4)]
        print("%-5s %2d %2d %2d %2d %3d %3d" % (tiletype, x, y, fields[0], fields[1], fields[2], fields[3]))