FAILURE MAP
← Case archive

FA-89091 / Digital logic simulation / Open access

Synchronous reset changes the output in the same cycle · case 01

The reset state output appears in the cycle reset is asserted instead of the following cycle.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Reset is treated as asynchronous when computing the cycle output.

VERIFIED REPAIR

Compute the output from the current state; reset only affects the next state.

Unsuccessful approach: Special-casing reset in the unknown state still produces a definite output before the edge.

Case contract

Input [table, start, stream]: table[state] = {'out': o, 'next': {bit: state}}; stream items are [bit, rst] with bit 0/1/'x'. Each cycle outputs the current state's output (or 'x' in the unknown state 'X'), then clocks: rst==1 -> start (synchronous), else unknown input or state 'X' -> 'X', else follow next[bit], staying put if that transition is absent. Return [outputs, final state].

Why this case matters

Cycle-based simulators must emit Moore outputs from the pre-edge state and model unknown propagation through state registers.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    table, start, stream = args
    state = start
    outs = []
    for bit, rst in stream:
        o = table[start]['out'] if rst == 1 else ('x' if state == 'X' else table[state]['out'])
        if rst == 1:
            state = start
        elif state == 'X' or bit == 'x':
            state = 'X'
        else:
            state = table[state]['next'].get(str(bit), state)
        outs.append(o)
    return [outs, state]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0]]], [[0, 0, 1, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0]]], [[0, 'x', 0], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [0, 0], [1, 0]]], [[1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0]]], [[0, 'x', 0, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0]]], [[0, 0, 0], 'C']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0]]], [[0, 0, 0], 'C']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 1, 1, 0], 'B'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
detects two ones[[0, 0, 1, 0, 0], 'A'][[0, 0, 1, 0, 0], 'A']Passed
reset while in output state[[0, 0, 0, 0, 0], 'C'][[0, 0, 1, 0, 0], 'C']Failed
missing transition holds state[[0, 0, 1, 1], 'A'][[0, 0, 1, 1], 'A']Passed
unknown input poisons state[[0, 0, 'x', 'x', 0, 0], 'B'][[0, 0, 'x', 'x', 'x', 0], 'B']Failed
reset from unknown state[[0, 0, 0], 'C'][[0, 'x', 0], 'C']Failed
reset asserted in first cycle[[0, 0, 0, 1], 'A'][[0, 0, 0, 1], 'A']Passed
start in accepting state[[1, 1, 0], 'B'][[1, 1, 0], 'B']Passed

SHA-256 / 83f46e23c715dc876015f98e23facac180d2f2ff34d847912791ab90d8c62dbc

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    table, start, stream = args
    state = start
    outs = []
    for bit, rst in stream:
        o = 'x' if state == 'X' and rst != 1 else table[state if state != 'X' else start]['out']
        if rst == 1:
            state = start
        elif state == 'X' or bit == 'x':
            state = 'X'
        else:
            state = table[state]['next'].get(str(bit), state)
        outs.append(o)
    return [outs, state]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0]]], [[0, 0, 1, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0]]], [[0, 'x', 0], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [0, 0], [1, 0]]], [[1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0]]], [[0, 'x', 0, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0]]], [[0, 0, 0], 'C']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0]]], [[0, 0, 0], 'C']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 1, 1, 0], 'B'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
detects two ones[[0, 0, 1, 0, 0], 'A'][[0, 0, 1, 0, 0], 'A']Passed
reset while in output state[[0, 0, 1, 0, 0], 'C'][[0, 0, 1, 0, 0], 'C']Passed
missing transition holds state[[0, 0, 1, 1], 'A'][[0, 0, 1, 1], 'A']Passed
unknown input poisons state[[0, 0, 'x', 'x', 0, 0], 'B'][[0, 0, 'x', 'x', 'x', 0], 'B']Failed
reset from unknown state[[0, 0, 0], 'C'][[0, 'x', 0], 'C']Failed
reset asserted in first cycle[[0, 0, 0, 1], 'A'][[0, 0, 0, 1], 'A']Passed
start in accepting state[[1, 1, 0], 'B'][[1, 1, 0], 'B']Passed

SHA-256 / 7f3f030123382b8342ef30967a2bf7021c275ed9dc44718562d4a60ff552f4cc

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(*args):
    table, start, stream = args
    state = start
    outs = []
    for bit, rst in stream:
        o = 'x' if state == 'X' else table[state]['out']
        if rst == 1:
            state = start
        elif state == 'X' or bit == 'x':
            state = 'X'
        else:
            state = table[state]['next'].get(str(bit), state)
        outs.append(o)
    return [outs, state]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0]]], [[0, 0, 1, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0]]], [[0, 'x', 0], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [0, 0], [1, 0]]], [[1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0]]], [[0, 'x', 0, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0]]], [[0, 0, 0], 'C']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0]]], [[0, 0, 0], 'C']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 1, 0], 'B'])], [('detects two ones', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [0, 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [[0, 0, 1, 0, 0, 0, 0, 0, 0], 'A']), ('reset while in output state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 0, 1, 0, 0, 1, 1, 1, 1], 'C']), ('missing transition holds state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [[0, 0, 1, 1, 1, 1, 1, 1], 'A']), ('unknown input poisons state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 1], [1, 0]]], [[0, 0, 'x', 'x', 'x', 'x', 'x', 'x', 'x', 0], 'B']), ('reset from unknown state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'B', [['x', 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [[0, 'x', 0, 1, 1, 1, 1], 'C']), ('reset asserted in first cycle', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'A', [[1, 1], [1, 0], [1, 0], [0, 0]]], [[0, 0, 0, 1], 'A']), ('start in accepting state', [{'A': {'out': 0, 'next': {'1': 'B'}}, 'B': {'out': 0, 'next': {'0': 'A', '1': 'C'}}, 'C': {'out': 1, 'next': {'0': 'A'}}}, 'C', [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0], [1, 0]]], [[1, 1, 1, 1, 1, 1, 0], 'B'])]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
detects two ones[[0, 0, 1, 0, 0], 'A'][[0, 0, 1, 0, 0], 'A']Passed
reset while in output state[[0, 0, 1, 0, 0], 'C'][[0, 0, 1, 0, 0], 'C']Passed
missing transition holds state[[0, 0, 1, 1], 'A'][[0, 0, 1, 1], 'A']Passed
unknown input poisons state[[0, 0, 'x', 'x', 'x', 0], 'B'][[0, 0, 'x', 'x', 'x', 0], 'B']Passed
reset from unknown state[[0, 'x', 0], 'C'][[0, 'x', 0], 'C']Passed
reset asserted in first cycle[[0, 0, 0, 1], 'A'][[0, 0, 0, 1], 'A']Passed
start in accepting state[[1, 1, 0], 'B'][[1, 1, 0], 'B']Passed

SHA-256 / 50f0c6fdd66f8e8e0d34caaf42086b1fc25540a03a4454ac77426eecfbedca84

Verification & scope

A deterministic bounded teaching model of one simulator rule set; the contract is stipulated and is not a claim of conformance to any HDL standard or commercial simulator. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:51:14.189713+00:00.

Case digest / e55677c985291d859b59a876bce7522fe0b125e2c22f59b3438e3cc96a894fe1