icebox_maps: Use cached re functions

This commit is contained in:
Michael Buesch 2019-06-07 23:51:40 +02:00
parent e0642ba06e
commit 51a11ffc81
1 changed files with 3 additions and 2 deletions

View File

@ -16,6 +16,7 @@
# #
import icebox import icebox
from icebox import re_match_cached
import getopt, sys, re import getopt, sys, re
mode = None mode = None
@ -58,7 +59,7 @@ def get_bit_group(x, y, db):
funcs.add("r") funcs.add("r")
elif entry[1] == "buffer": elif entry[1] == "buffer":
funcs.add("b") funcs.add("b")
elif re.match("LC_", entry[1]): elif re_match_cached("LC_", entry[1]):
funcs.add("l") funcs.add("l")
elif entry[1] == "NegClk": elif entry[1] == "NegClk":
funcs.add("N") funcs.add("N")
@ -94,7 +95,7 @@ def print_db_nets(stmt, db, pos):
if icebox.pos_has_net(pos[0], entry[3]): netnames.add(entry[3]) if icebox.pos_has_net(pos[0], entry[3]): netnames.add(entry[3])
last_prefix = "" last_prefix = ""
for net in sorted(netnames, key=icebox.key_netname): for net in sorted(netnames, key=icebox.key_netname):
match = re.match(r"(.*?)(\d+)$", net) match = re_match_cached(r"(.*?)(\d+)$", net)
if match: if match:
if last_prefix == match.group(1): if last_prefix == match.group(1):
print(",%s" % match.group(2), end="") print(",%s" % match.group(2), end="")