From b2e1df618c01194011926b3e42b07a2257c249a6 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Tue, 3 Jul 2018 10:28:09 -0700 Subject: icebox_vlog: Better information about drivers for nets. --- icebox/icebox_vlog.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/icebox/icebox_vlog.py b/icebox/icebox_vlog.py index a86f11e..21ffb12 100755 --- a/icebox/icebox_vlog.py +++ b/icebox/icebox_vlog.py @@ -345,21 +345,21 @@ for segs in sorted(ic.group_segments(extra_connections=extra_connections, extra_ else: net_segs.add(s) - count_drivers = 0 + count_drivers = [] for s in segs: - if re.match(r"ram/RDATA_", s[2]): count_drivers += 1 - if re.match(r"io_./D_IN_", s[2]): count_drivers += 1 - if re.match(r"lutff_./out", s[2]): count_drivers += 1 - if re.match(r"lutff_./lout", s[2]): count_drivers += 1 + if re.match(r"ram/RDATA_", s[2]): count_drivers.append(s[2]) + if re.match(r"io_./D_IN_", s[2]): count_drivers.append(s[2]) + if re.match(r"lutff_./out", s[2]): count_drivers.append(s[2]) + if re.match(r"lutff_./lout", s[2]): count_drivers.append(s[2]) - if count_drivers != 1 and check_driver: - failed_drivers_check.append(n) + if len(count_drivers) != 1 and check_driver: + failed_drivers_check.append((n, count_drivers)) if not strip_comments: for s in sorted(net_segs): text_wires.append("// %s" % (s,)) if count_drivers != 1 and check_driver: - text_wires.append("// Number of drivers: %d" % count_drivers) + text_wires.append("// Number of drivers: %d %s" % (len(count_drivers), count_drivers)) text_wires.append("") def seg_to_net(seg, default=None): @@ -942,6 +942,7 @@ print() if failed_drivers_check: print("// Single-driver-check failed for %d nets:" % len(failed_drivers_check)) - print("// %s" % " ".join(failed_drivers_check)) + for net, drivers in failed_drivers_check: + print("// %s has %d drivers: %s" % (net, len(drivers), drivers)) assert False -- cgit v1.2.3 From ef618927caa8468ef8afcd38d7b4e15938580d81 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sun, 8 Jul 2018 15:59:53 -0700 Subject: icebox_vlog: Save error message to file and print it. Previously if you were doing; `icebox_vlog example.asc > example_bit.v` you would just get; ``` Traceback (most recent call last): File "icebox_vlog.py", line 947, in assert False AssertionError ``` Now you get; ``` Traceback (most recent call last): File "icebox_vlog.py", line 948, in assert False, "\n ".join(emsg) AssertionError: Single-driver-check failed for 2 nets: n10 has 0 drivers: [] n15 has 2 drivers: ['clk', 'clk2'] ``` --- icebox/icebox_vlog.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/icebox/icebox_vlog.py b/icebox/icebox_vlog.py index 21ffb12..9f5b602 100755 --- a/icebox/icebox_vlog.py +++ b/icebox/icebox_vlog.py @@ -941,8 +941,9 @@ print("endmodule") print() if failed_drivers_check: - print("// Single-driver-check failed for %d nets:" % len(failed_drivers_check)) + emsg = ["Single-driver-check failed for %d nets:" % len(failed_drivers_check)] for net, drivers in failed_drivers_check: - print("// %s has %d drivers: %s" % (net, len(drivers), drivers)) - assert False + emsg.append("%s has %d drivers: %s" % (net, len(drivers), drivers)) + print("//", "\n//".join(emsg)) + assert False, "\n ".join(emsg) -- cgit v1.2.3