From 00213ed9c39e291a8750e1425b059f617219533b Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Fri, 7 Jun 2019 23:52:47 +0200 Subject: icebox_stat: Use cached re functions --- icebox/icebox_stat.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/icebox/icebox_stat.py b/icebox/icebox_stat.py index ffb7b6a..ec404fb 100755 --- a/icebox/icebox_stat.py +++ b/icebox/icebox_stat.py @@ -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))) -- cgit v1.2.3