Resolve warning with python 3.12

This commit is contained in:
Miodrag Milanovic 2024-12-11 13:09:43 +01:00
parent 461ba9dce9
commit 7190770949
4 changed files with 34 additions and 34 deletions

View File

@ -622,7 +622,7 @@ class iceconfig:
return funcnets
def ultraplus_follow_corner(self, corner, direction, netname):
m = re_match_cached("span4_(horz|vert)_([lrtb])_(\d+)$", netname)
m = re_match_cached(r"span4_(horz|vert)_([lrtb])_(\d+)$", netname)
if not m:
return None
cur_edge = m.group(2)
@ -744,8 +744,8 @@ class iceconfig:
s = self.ultraplus_follow_corner(self.get_corner(s[0], s[1]), direction, n)
if s is None:
continue
elif re_match_cached("span4_(vert|horz)_[lrtb]_\d+$", n) and not self.is_ultra():
m = re_match_cached("span4_(vert|horz)_([lrtb])_\d+$", n)
elif re_match_cached(r"span4_(vert|horz)_[lrtb]_\d+$", n) and not self.is_ultra():
m = re_match_cached(r"span4_(vert|horz)_([lrtb])_\d+$", n)
vert_net = n.replace("_l_", "_t_").replace("_r_", "_b_").replace("_horz_", "_vert_")
horz_net = n.replace("_t_", "_l_").replace("_b_", "_r_").replace("_vert_", "_horz_")
@ -1097,7 +1097,7 @@ else:
valid_sp12_v_b = set(range(24))
def sp4h_normalize(netname, edge=""):
m = re_match_cached("sp4_h_([lr])_(\d+)$", netname)
m = re_match_cached(r"sp4_h_([lr])_(\d+)$", netname)
assert m
if not m: return None
cur_edge = m.group(1)
@ -1120,7 +1120,7 @@ def sp4h_normalize(netname, edge=""):
# "Normalization" of span4 (not just sp4) is needed during Ultra/UltraPlus
# corner tracing
def ultra_span4_horz_normalize(netname, edge=""):
m = re_match_cached("span4_horz_([rl])_(\d+)$", netname)
m = re_match_cached(r"span4_horz_([rl])_(\d+)$", netname)
assert m
if not m: return None
cur_edge = m.group(1)
@ -1146,7 +1146,7 @@ def ultra_span4_horz_normalize(netname, edge=""):
assert False
def sp4v_normalize(netname, edge=""):
m = re_match_cached("sp4_v_([bt])_(\d+)$", netname)
m = re_match_cached(r"sp4_v_([bt])_(\d+)$", netname)
assert m
if not m: return None
cur_edge = m.group(1)
@ -1168,7 +1168,7 @@ def sp4v_normalize(netname, edge=""):
return netname
def sp12h_normalize(netname, edge=""):
m = re_match_cached("sp12_h_([lr])_(\d+)$", netname)
m = re_match_cached(r"sp12_h_([lr])_(\d+)$", netname)
assert m
if not m: return None
cur_edge = m.group(1)
@ -1190,7 +1190,7 @@ def sp12h_normalize(netname, edge=""):
return netname
def sp12v_normalize(netname, edge=""):
m = re_match_cached("sp12_v_([bt])_(\d+)$", netname)
m = re_match_cached(r"sp12_v_([bt])_(\d+)$", netname)
assert m
if not m: return None
cur_edge = m.group(1)
@ -1253,7 +1253,7 @@ def pos_has_net(pos, netname):
def pos_follow_net(pos, direction, netname, is_ultra):
if pos == "x" or ((pos in ("l", "r")) and is_ultra):
m = re_match_cached("sp4_h_[lr]_(\d+)$", netname)
m = re_match_cached(r"sp4_h_[lr]_(\d+)$", netname)
if m and direction in ("l", "L"):
n = sp4h_normalize(netname, "l")
if n is not None:
@ -1275,7 +1275,7 @@ def pos_follow_net(pos, direction, netname, is_ultra):
n = re_sub_cached("sp4_h_", "span4_horz_", n)
return n
m = re_match_cached("sp4_v_[tb]_(\d+)$", netname)
m = re_match_cached(r"sp4_v_[tb]_(\d+)$", netname)
if m and direction in ("t", "T"):
n = sp4v_normalize(netname, "t")
if n is not None:
@ -1301,7 +1301,7 @@ def pos_follow_net(pos, direction, netname, is_ultra):
n = re_sub_cached("sp4_v_", "span4_vert_", n)
return n
m = re_match_cached("sp12_h_[lr]_(\d+)$", netname)
m = re_match_cached(r"sp12_h_[lr]_(\d+)$", netname)
if m and direction in ("l", "L"):
n = sp12h_normalize(netname, "l")
if n is not None:
@ -1323,7 +1323,7 @@ def pos_follow_net(pos, direction, netname, is_ultra):
n = re_sub_cached("sp12_h_", "span12_horz_", n)
return n
m = re_match_cached("sp12_v_[tb]_(\d+)$", netname)
m = re_match_cached(r"sp12_v_[tb]_(\d+)$", netname)
if m and direction in ("t", "T"):
n = sp12v_normalize(netname, "t")
if n is not None:
@ -1350,7 +1350,7 @@ def pos_follow_net(pos, direction, netname, is_ultra):
return n
if (pos in ("l", "r" )) and (not is_ultra):
m = re_match_cached("span4_vert_([bt])_(\d+)$", netname)
m = re_match_cached(r"span4_vert_([bt])_(\d+)$", netname)
if m:
case, idx = direction + m.group(1), int(m.group(2))
if case == "tt":
@ -1363,7 +1363,7 @@ def pos_follow_net(pos, direction, netname, is_ultra):
return "span4_vert_t_%d" % idx
if pos in ("t", "b" ):
m = re_match_cached("span4_horz_([rl])_(\d+)$", netname)
m = re_match_cached(r"span4_horz_([rl])_(\d+)$", netname)
if m:
case, idx = direction + m.group(1), int(m.group(2))
if direction == "L":
@ -1380,27 +1380,27 @@ def pos_follow_net(pos, direction, netname, is_ultra):
return "span4_horz_l_%d" % idx
if pos == "l" and direction == "r" and (not is_ultra):
m = re_match_cached("span4_horz_(\d+)$", netname)
m = re_match_cached(r"span4_horz_(\d+)$", netname)
if m: return sp4h_normalize("sp4_h_l_%s" % m.group(1))
m = re_match_cached("span12_horz_(\d+)$", netname)
m = re_match_cached(r"span12_horz_(\d+)$", netname)
if m: return sp12h_normalize("sp12_h_l_%s" % m.group(1))
if pos == "r" and direction == "l" and (not is_ultra):
m = re_match_cached("span4_horz_(\d+)$", netname)
m = re_match_cached(r"span4_horz_(\d+)$", netname)
if m: return sp4h_normalize("sp4_h_r_%s" % m.group(1))
m = re_match_cached("span12_horz_(\d+)$", netname)
m = re_match_cached(r"span12_horz_(\d+)$", netname)
if m: return sp12h_normalize("sp12_h_r_%s" % m.group(1))
if pos == "t" and direction == "b":
m = re_match_cached("span4_vert_(\d+)$", netname)
m = re_match_cached(r"span4_vert_(\d+)$", netname)
if m: return sp4v_normalize("sp4_v_t_%s" % m.group(1))
m = re_match_cached("span12_vert_(\d+)$", netname)
m = re_match_cached(r"span12_vert_(\d+)$", netname)
if m: return sp12v_normalize("sp12_v_t_%s" % m.group(1))
if pos == "b" and direction == "t":
m = re_match_cached("span4_vert_(\d+)$", netname)
m = re_match_cached(r"span4_vert_(\d+)$", netname)
if m: return sp4v_normalize("sp4_v_b_%s" % m.group(1))
m = re_match_cached("span12_vert_(\d+)$", netname)
m = re_match_cached(r"span12_vert_(\d+)$", netname)
if m: return sp12v_normalize("sp12_v_b_%s" % m.group(1))
return None

View File

@ -71,7 +71,7 @@ def make_cache(stmt, raw_db):
if bit.startswith("!"):
value = "0"
bit = bit[1:]
match = re_match_cached("B([0-9]+)\[([0-9]+)\]", bit)
match = re_match_cached(r"B([0-9]+)\[([0-9]+)\]", bit)
cache_entry[1].append((int(match.group(1)), int(match.group(2)), value))
cache.append(cache_entry)
return cache
@ -121,7 +121,7 @@ def set_colbuf(ic, tile, bit, value):
tile_db = ic.tile_db(tile[0], tile[1])
for entry in tile_db:
if entry[1] == "ColBufCtrl" and entry[2] == "glb_netwk_%d" % bit:
match = re_match_cached("B([0-9]+)\[([0-9]+)\]", entry[0][0])
match = re_match_cached(r"B([0-9]+)\[([0-9]+)\]", entry[0][0])
l = tile_dat[int(match.group(1))]
n = int(match.group(2))
l = l[:n] + value + l[n+1:]

View File

@ -73,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_cached("io_(\d+)/D_(IN|OUT)_(\d+)", seg[2])
match = re_match_cached(r"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_cached("lutff_(\d)/in_\d", seg[2])
match = re_match_cached(r"lutff_(\d)/in_\d", seg[2])
if match:
loc = (seg[0], seg[1], int(match.group(1)))
lut_locations.add(loc)
match = re_match_cached("lutff_(\d)/cout", seg[2])
match = re_match_cached(r"lutff_(\d)/cout", seg[2])
if match:
loc = (seg[0], seg[1], int(match.group(1)))
carry_locations.add(loc)
match = re_match_cached("lutff_(\d)/out", seg[2])
match = re_match_cached(r"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])
@ -101,7 +101,7 @@ for segs in connections:
bram_locations.add(loc)
if seg[2].startswith("glb_netwk_"):
match = re_match_cached("glb_netwk_(\d)", seg[2])
match = re_match_cached(r"glb_netwk_(\d)", seg[2])
if match:
global_nets.add(int(match.group(1)))

View File

@ -235,8 +235,8 @@ for idx, tile in list(ic.io_tiles.items()):
iocells_negclk.add((idx[0], idx[1], 0))
iocells_negclk.add((idx[0], idx[1], 1))
if entry[1].startswith("IOB_") and entry[2].startswith("PINTYPE_") and tc.match(entry[0]):
match1 = re_match_cached("IOB_(\d+)", entry[1])
match2 = re_match_cached("PINTYPE_(\d+)", entry[2])
match1 = re_match_cached(r"IOB_(\d+)", entry[1])
match2 = re_match_cached(r"PINTYPE_(\d+)", entry[2])
assert match1 and match2
iocells_type[(idx[0], idx[1], int(match1.group(1)))][int(match2.group(1))] = "1"
iocells_type[(idx[0], idx[1], 0)] = "".join(iocells_type[(idx[0], idx[1], 0)])
@ -245,7 +245,7 @@ for idx, tile in list(ic.io_tiles.items()):
for segs in sorted(ic.group_segments()):
for seg in segs:
if ic.tile_type(seg[0], seg[1]) == "IO":
match = re_match_cached("io_(\d+)/D_(IN|OUT)_(\d+)", seg[2])
match = re_match_cached(r"io_(\d+)/D_(IN|OUT)_(\d+)", seg[2])
if match:
cell = (seg[0], seg[1], int(match.group(1)))
if cell in iocells_skip:
@ -288,7 +288,7 @@ for segs in sorted(ic.group_segments(extra_connections=extra_connections, extra_
renamed_net_to_port = False
for s in segs:
match = re_match_cached("io_(\d+)/PAD", s[2])
match = re_match_cached(r"io_(\d+)/PAD", s[2])
if match:
idx = (s[0], s[1], int(match.group(1)))
p = "io_%d_%d_%d" % idx
@ -323,7 +323,7 @@ for segs in sorted(ic.group_segments(extra_connections=extra_connections, extra_
text_ports.append("inout %s" % p)
text_wires.append("assign %s = %s;" % (p, n))
match = re_match_cached("lutff_(\d+)/", s[2])
match = re_match_cached(r"lutff_(\d+)/", s[2])
if match:
#IpCon and DSP tiles look like logic tiles, but aren't.
if ic.device in ["5k", "u4k"] and (s[0] == 0 or s[0] == ic.max_x):