icebox_stat: Use cached re functions

This commit is contained in:
Michael Buesch 2019-06-07 23:52:47 +02:00
parent 51a11ffc81
commit 00213ed9c3
1 changed files with 7 additions and 6 deletions

View File

@ -16,6 +16,7 @@
#
import icebox
from icebox import re_match_cached
import getopt, sys, re
verbose = False
@ -72,23 +73,23 @@ if verbose:
for segs in connections:
for seg in segs:
if ic.tile_type(seg[0], seg[1]) == "IO" and seg[2].startswith("io_"):
match = re.match("io_(\d+)/D_(IN|OUT)_(\d+)", seg[2])
match = re_match_cached("io_(\d+)/D_(IN|OUT)_(\d+)", seg[2])
if match:
loc = (seg[0], seg[1], int(match.group(1)))
io_locations.add(loc)
if ic.tile_type(seg[0], seg[1]) == "LOGIC" and seg[2].startswith("lutff_"):
match = re.match("lutff_(\d)/in_\d", seg[2])
match = re_match_cached("lutff_(\d)/in_\d", seg[2])
if match:
loc = (seg[0], seg[1], int(match.group(1)))
lut_locations.add(loc)
match = re.match("lutff_(\d)/cout", seg[2])
match = re_match_cached("lutff_(\d)/cout", seg[2])
if match:
loc = (seg[0], seg[1], int(match.group(1)))
carry_locations.add(loc)
match = re.match("lutff_(\d)/out", seg[2])
match = re_match_cached("lutff_(\d)/out", seg[2])
if match:
loc = (seg[0], seg[1], int(match.group(1)))
seq_bits = icebox.get_lutff_seq_bits(ic.tile(loc[0], loc[1]), loc[2])
@ -100,7 +101,7 @@ for segs in connections:
bram_locations.add(loc)
if seg[2].startswith("glb_netwk_"):
match = re.match("glb_netwk_(\d)", seg[2])
match = re_match_cached("glb_netwk_(\d)", seg[2])
if match:
global_nets.add(int(match.group(1)))
@ -108,7 +109,7 @@ pll_config_bitidx = dict()
for entry in icebox.iotile_l_db:
if entry[1] == "PLL":
match = re.match(r"B(\d+)\[(\d+)\]", entry[0][0]);
match = re_match_cached(r"B(\d+)\[(\d+)\]", entry[0][0]);
assert match
pll_config_bitidx[entry[2]] = (int(match.group(1)), int(match.group(2)))