aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-12-04 12:10:11 +0100
committerClifford Wolf <clifford@clifford.at>2015-12-04 12:10:11 +0100
commit5e1dc788c557e52154e7dd610edc4673094a7ba2 (patch)
treee5fa8b11b54ab9aeda4e8e252208cb0825c846ad
parent9c9983cff8d5ff4c410b6f4fcd1c78b5f9e1fd6b (diff)
downloadicestorm-5e1dc788c557e52154e7dd610edc4673094a7ba2.tar.gz
icestorm-5e1dc788c557e52154e7dd610edc4673094a7ba2.tar.bz2
icestorm-5e1dc788c557e52154e7dd610edc4673094a7ba2.zip
Python3 fixes
-rw-r--r--icebox/icebox.py6
-rwxr-xr-xicebox/icebox_html.py11
-rwxr-xr-xicebox/icebox_maps.py2
3 files changed, 10 insertions, 9 deletions
diff --git a/icebox/icebox.py b/icebox/icebox.py
index a6f3111..398bfe8 100644
--- a/icebox/icebox.py
+++ b/icebox/icebox.py
@@ -940,10 +940,8 @@ def get_carry_bit(tile):
def get_negclk_bit(tile):
return tile[0][0]
-def cmp_netnames(a, b):
- a = re.sub(r"\d+", lambda m: "%09d" % int(m.group(0)), a)
- b = re.sub(r"\d+", lambda m: "%09d" % int(m.group(0)), b)
- return cmp(a, b)
+def key_netname(netname):
+ return re.sub(r"\d+", lambda m: "%09d" % int(m.group(0)), netname)
def run_checks_neigh():
print("Running consistency checks on neighbour finder..")
diff --git a/icebox/icebox_html.py b/icebox/icebox_html.py
index ea27028..82389c0 100755
--- a/icebox/icebox_html.py
+++ b/icebox/icebox_html.py
@@ -457,7 +457,7 @@ The entries titled "routing" configure transfer gates, the entries titled
print('<h5>Connectivity Matrix</h5>')
print('<table style="font-size:x-small">')
dst_net_prefix = ""
- dst_net_list = sorted(dst_nets, icebox.cmp_netnames)
+ dst_net_list = sorted(dst_nets, key=icebox.key_netname)
if len(dst_net_list) > 1:
while len(set([n[0] for n in dst_net_list])) == 1:
dst_net_prefix += dst_net_list[0][0]
@@ -472,10 +472,10 @@ The entries titled "routing" configure transfer gates, the entries titled
for dn in dst_net_list:
print('<td>%s</td>' % dn)
print("</tr>")
- for sn in sorted(src_nets, icebox.cmp_netnames):
+ for sn in sorted(src_nets, key=icebox.key_netname):
print("<tr>")
print('<td>%s</td>' % sn)
- for dn in sorted(dst_nets, icebox.cmp_netnames):
+ for dn in sorted(dst_nets, key=icebox.key_netname):
if (sn, dn) in links:
print(links[(sn, dn)])
else:
@@ -563,7 +563,10 @@ if outdir is not None:
print_tile(x, y)
print("Writing %s/%s..." % (outdir, chipdbfile), file=stdout)
- os.system("python3 icebox_chipdb.py > %s/%s" % (outdir, chipdbfile))
+ if os.access("icebox_chipdb.py", os.R_OK):
+ os.system("python3 icebox_chipdb.py %s > %s/%s" % ("-8" if mode8k else "", outdir, chipdbfile))
+ else:
+ os.system("icebox_chipdb %s > %s/%s" % ("-8" if mode8k else "", outdir, chipdbfile))
sys.stdout = stdout
diff --git a/icebox/icebox_maps.py b/icebox/icebox_maps.py
index 49f2638..c791bea 100755
--- a/icebox/icebox_maps.py
+++ b/icebox/icebox_maps.py
@@ -93,7 +93,7 @@ def print_db_nets(stmt, db, pos):
if icebox.pos_has_net(pos[0], entry[2]): netnames.add(entry[2])
if icebox.pos_has_net(pos[0], entry[3]): netnames.add(entry[3])
last_prefix = ""
- for net in sorted(netnames, icebox.cmp_netnames):
+ for net in sorted(netnames, key=icebox.key_netname):
match = re.match(r"(.*?)(\d+)$", net)
if match:
if last_prefix == match.group(1):