From 990d8db9a25ac01faf5542adff29e1977754fed4 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:12:15 +1200 Subject: [PATCH 1/3] Prefer traces even without depth --- sbysrc/sby_status.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sbysrc/sby_status.py b/sbysrc/sby_status.py index a8fc3a1..9daa76e 100644 --- a/sbysrc/sby_status.py +++ b/sbysrc/sby_status.py @@ -450,7 +450,7 @@ class SbyStatusDb: print(csvheader) # find summary for each task/property combo - prop_map: dict[(str, str), dict[str, (int, int)]] = {} + prop_map: dict[(str, str, str), dict[str, (int, int)]] = {} for row, prop_status in all_properties.items(): if tasknames and prop_status['task_name'] not in tasknames: continue @@ -465,10 +465,14 @@ class SbyStatusDb: except KeyError: prop_map[key] = prop_status_map = {} - current_depth, _ = prop_status_map.get(status, (None, None)) + current_depth, _, current_kind = prop_status_map.get(status, (None, None, None)) update_map = False if current_depth is None: - update_map = True + if current_kind is None: + update_map = True + elif this_kind in ['fst', 'vcd']: + # prefer traces over witness files + update_map = True elif this_depth is not None: if status == 'FAIL' and this_depth < current_depth: # earliest fail @@ -477,17 +481,17 @@ class SbyStatusDb: # latest non-FAIL update_map = True elif this_depth == current_depth and this_kind in ['fst', 'vcd']: - # prefer traces over witness files - update_map = True + # prefer traces over witness files + update_map = True if update_map: - prop_status_map[status] = (this_depth, row) + prop_status_map[status] = (this_depth, row, this_kind) for prop in prop_map.values(): # ignore UNKNOWNs if there are other statuses if len(prop) > 1 and "UNKNOWN" in prop: del prop["UNKNOWN"] - for _, row in prop.values(): + for _, row, _ in prop.values(): csvline = format_status_data_csvline(all_properties[row]) print(csvline) From 9cb368b9c8e50faafd6d6f5f08e8fe74fd244822 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:26:51 +1200 Subject: [PATCH 2/3] Re-order status evaluation Always add the current row to the status map if there's a key error instead of trying to be clever with `.get()` and `None`s. --- sbysrc/sby_status.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/sbysrc/sby_status.py b/sbysrc/sby_status.py index 9daa76e..f608b18 100644 --- a/sbysrc/sby_status.py +++ b/sbysrc/sby_status.py @@ -465,24 +465,26 @@ class SbyStatusDb: except KeyError: prop_map[key] = prop_status_map = {} - current_depth, _, current_kind = prop_status_map.get(status, (None, None, None)) + try: + current_depth, _, current_kind = prop_status_map[status] + except KeyError: + prop_status_map[status] = (this_depth, row, this_kind) + continue + update_map = False - if current_depth is None: - if current_kind is None: - update_map = True - elif this_kind in ['fst', 'vcd']: - # prefer traces over witness files - update_map = True - elif this_depth is not None: + if current_depth is None and current_kind is None: + # no depth or kind to compare, just take latest data + update_map = True + elif this_depth is not None and this_depth != current_depth: if status == 'FAIL' and this_depth < current_depth: # earliest fail update_map = True elif status != 'FAIL' and this_depth > current_depth: # latest non-FAIL update_map = True - elif this_depth == current_depth and this_kind in ['fst', 'vcd']: - # prefer traces over witness files - update_map = True + elif this_kind in ['fst', 'vcd']: + # prefer traces over witness files + update_map = True if update_map: prop_status_map[status] = (this_depth, row, this_kind) From 599216790980a7ad0dda4fe0bb4449d30b0aee28 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:33:59 +1200 Subject: [PATCH 3/3] Fix comparing int with None --- sbysrc/sby_status.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbysrc/sby_status.py b/sbysrc/sby_status.py index f608b18..846597b 100644 --- a/sbysrc/sby_status.py +++ b/sbysrc/sby_status.py @@ -476,7 +476,10 @@ class SbyStatusDb: # no depth or kind to compare, just take latest data update_map = True elif this_depth is not None and this_depth != current_depth: - if status == 'FAIL' and this_depth < current_depth: + if current_depth is None: + # always prefer a known depth to an unknown + update_map = True + elif status == 'FAIL' and this_depth < current_depth: # earliest fail update_map = True elif status != 'FAIL' and this_depth > current_depth: