3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-25 22:26:07 +00:00

Merge pull request #335 from YosysHQ/krys/fix_status_trace

Prefer traces even without depth
This commit is contained in:
KrystalDelusion 2025-08-05 15:32:03 +12:00 committed by GitHub
commit 12380801e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -452,7 +452,7 @@ class SbyStatusDb:
print(header) print(header)
# find summary for each task/property combo # 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(): for row, prop_status in all_properties.items():
if tasknames and prop_status['task_name'] not in tasknames: if tasknames and prop_status['task_name'] not in tasknames:
continue continue
@ -467,29 +467,38 @@ class SbyStatusDb:
except KeyError: except KeyError:
prop_map[key] = prop_status_map = {} prop_map[key] = prop_status_map = {}
current_depth, _ = prop_status_map.get(status, (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 update_map = False
if current_depth is None: if current_depth is None and current_kind is None:
# no depth or kind to compare, just take latest data
update_map = True update_map = True
elif this_depth is not None: 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 # earliest fail
update_map = True update_map = True
elif status != 'FAIL' and this_depth > current_depth: elif status != 'FAIL' and this_depth > current_depth:
# latest non-FAIL # latest non-FAIL
update_map = True update_map = True
elif this_depth == current_depth and this_kind in ['fst', 'vcd']: elif this_kind in ['fst', 'vcd']:
# prefer traces over witness files # prefer traces over witness files
update_map = True update_map = True
if update_map: 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(): for prop in prop_map.values():
# ignore UNKNOWNs if there are other statuses # ignore UNKNOWNs if there are other statuses
if len(prop) > 1 and "UNKNOWN" in prop: if len(prop) > 1 and "UNKNOWN" in prop:
del prop["UNKNOWN"] del prop["UNKNOWN"]
for _, row in prop.values(): for _, row, _ in prop.values():
line = format_status_data_fmtline(all_properties[row], status_format) line = format_status_data_fmtline(all_properties[row], status_format)
print(line) print(line)