Assertion and bounded-trace model — checker
Phase 7 Wave 3 Python 3 checker file.
Download original fileimport json
from pathlib import Path
d = json.loads(Path('starter.json').read_text())
def stable_while_stalled(trace):
for cycle in range(len(trace['valid']) - 1):
if trace['valid'][cycle] and not trace['ready'][cycle]:
if not trace['valid'][cycle + 1] or trace['data'][cycle + 1] != trace['data'][cycle]:
return False
return True
results = {trace['name']: stable_while_stalled(trace) for trace in d['traces']}
assert results == {'passing': True, 'failing': False}
print(f"PASS assertion_traces evaluated={len(results)} pass_detected=yes failure_detected=yes bound={d['max_latency']}")