FAILURE MAP
← Case archive

FA-89286 / Digital logic simulation / Open access

Capture evaluates next state from partially updated flops · case 01

Flops later in the chain capture values computed from already-updated earlier flops.

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

ROOT CAUSE

Captured values are written into the live state while other flops are still being evaluated.

VERIFIED REPAIR

Evaluate every next-state function from the old state, then update all flops together.

Unsuccessful approach: Keeping only AND captures off the live state still lets XOR and inverter captures leak into later evaluations.

Case contract

Input [chain, logic, state, ops]: chain lists flops from scan-in to scan-out. 'shift' with bit b: scan-out observes the last flop before the edge, then every flop takes its predecessor's old value and the first takes b. 'capture': every flop loads its functional next state logic[f] = [op, inputs] (and/xor/not) computed from the old state of all flops simultaneously. Return [scan-out bits, final chain values].

Why this case matters

Scan-based test simulation must shift and capture as simultaneous register updates.

1 / The failure

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

N = 1
observations = []
def solve(*args):
    chain, logic, state, ops = args
    state = dict(state)
    sout = []
    for op, bit in ops:
        if op == 'shift':
            sout.append(state[chain[-1]])
            vals = [bit] + [state[f] for f in chain[:-1]]
            for f, v in zip(chain, vals):
                state[f] = v
        else:
            nxt = {}
            for f in chain:
                kind, ins = logic[f]
                bits = [state[i] for i in ins]
                nxt[f] = state[f] = int(all(bits)) if kind == 'and' else (sum(bits) % 2 if kind == 'xor' else 1 - bits[0])
            state.update(nxt)
    return [sout, [state[f] for f in chain]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1], ['shift', 0]]], [[1, 1], [0, 1, 1, 0]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1]]], [[0], [1, 1, 0, 0]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1]]], [[1, 0], [1, 1, 0, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['shift', 1], ['shift', 0], ['shift', 1]]], [[0, 1, 0], [1, 0, 1, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[1, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1]]], [[1, 0], [1, 1, 1, 0]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1], [1, 1, 1, 0]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1]]], [[1], [1, 1, 0, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1]]], [[0, 0, 0], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0], [1, 1, 1, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['shift', 1], ['shift', 0]]], [[0, 1], [0, 1, 1, 0]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[1, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 0, 1], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0, 1], [1, 1, 1, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1], ['shift', 0], ['shift', 1]]], [[1, 1, 0], [1, 0, 1, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[0, 0, 0, 1, 1], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0, 1, 1], [1, 1, 1, 1]])]]
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
shift in a pattern[[1, 1], [0, 1, 1, 0]][[1, 1], [0, 1, 1, 0]]Passed
capture then unload[[1, 0, 1, 1], [0, 0, 0, 0]][[0, 0, 1, 1], [0, 0, 0, 0]]Failed
load capture unload[[0, 0, 0, 0], [0, 0, 1, 0]][[0, 0, 0, 0], [0, 0, 1, 0]]Passed
double capture[[1], [1, 1, 0, 0]][[0], [1, 1, 0, 0]]Failed
short chain[[0, 1], [1, 0]][[0, 1], [1, 0]]Passed
flush ones[[1, 0], [1, 1, 0, 1]][[1, 0], [1, 1, 0, 1]]Passed

SHA-256 / 9261fa14db3abb5f63ee5e4a4c9e8e28d67fdd35fb876d01f4f9a097b7f2f663

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(*args):
    chain, logic, state, ops = args
    state = dict(state)
    sout = []
    for op, bit in ops:
        if op == 'shift':
            sout.append(state[chain[-1]])
            vals = [bit] + [state[f] for f in chain[:-1]]
            for f, v in zip(chain, vals):
                state[f] = v
        else:
            nxt = {}
            for f in chain:
                kind, ins = logic[f]
                bits = [state[i] for i in ins]
                nxt[f] = int(all(bits)) if kind == 'and' else (sum(bits) % 2 if kind == 'xor' else 1 - bits[0])
                if kind != 'and':
                    state[f] = nxt[f]
            state.update(nxt)
    return [sout, [state[f] for f in chain]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1], ['shift', 0]]], [[1, 1], [0, 1, 1, 0]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1]]], [[0], [1, 1, 0, 0]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1]]], [[1, 0], [1, 1, 0, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['shift', 1], ['shift', 0], ['shift', 1]]], [[0, 1, 0], [1, 0, 1, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[1, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1]]], [[1, 0], [1, 1, 1, 0]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1], [1, 1, 1, 0]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1]]], [[1], [1, 1, 0, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1]]], [[0, 0, 0], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0], [1, 1, 1, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['shift', 1], ['shift', 0]]], [[0, 1], [0, 1, 1, 0]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[1, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 0, 1], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0, 1], [1, 1, 1, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1], ['shift', 0], ['shift', 1]]], [[1, 1, 0], [1, 0, 1, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[0, 0, 0, 1, 1], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0, 1, 1], [1, 1, 1, 1]])]]
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
shift in a pattern[[1, 1], [0, 1, 1, 0]][[1, 1], [0, 1, 1, 0]]Passed
capture then unload[[1, 0, 1, 1], [0, 0, 0, 0]][[0, 0, 1, 1], [0, 0, 0, 0]]Failed
load capture unload[[0, 0, 0, 0], [0, 0, 1, 0]][[0, 0, 0, 0], [0, 0, 1, 0]]Passed
double capture[[1], [1, 1, 0, 0]][[0], [1, 1, 0, 0]]Failed
short chain[[0, 1], [1, 0]][[0, 1], [1, 0]]Passed
flush ones[[1, 0], [1, 1, 0, 1]][[1, 0], [1, 1, 0, 1]]Passed

SHA-256 / c939f4af742b1ef6358a5114a97ab6940e2d16ef2a5531909be7b3152d3c98b3

3 / The verified repair

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

N = 1
observations = []
def solve(*args):
    chain, logic, state, ops = args
    state = dict(state)
    sout = []
    for op, bit in ops:
        if op == 'shift':
            sout.append(state[chain[-1]])
            vals = [bit] + [state[f] for f in chain[:-1]]
            for f, v in zip(chain, vals):
                state[f] = v
        else:
            nxt = {}
            for f in chain:
                kind, ins = logic[f]
                bits = [state[i] for i in ins]
                nxt[f] = int(all(bits)) if kind == 'and' else (sum(bits) % 2 if kind == 'xor' else 1 - bits[0])
            state.update(nxt)
    return [sout, [state[f] for f in chain]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1], ['shift', 0]]], [[1, 1], [0, 1, 1, 0]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1]]], [[0], [1, 1, 0, 0]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1]]], [[1, 0], [1, 1, 0, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['shift', 1], ['shift', 0], ['shift', 1]]], [[0, 1, 0], [1, 0, 1, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[1, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1]]], [[1, 0], [1, 1, 1, 0]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1], [1, 1, 1, 0]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1]]], [[1], [1, 1, 0, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1]]], [[0, 0, 0], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0], [1, 1, 1, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['shift', 1], ['shift', 0]]], [[0, 1], [0, 1, 1, 0]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[1, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 0}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 0, 1], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0, 1], [1, 1, 1, 1]])], [('shift in a pattern', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['shift', 1], ['shift', 0], ['shift', 1]]], [[1, 1, 0], [1, 0, 1, 1]]), ('capture then unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['shift', 0], ['shift', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 1, 1], [0, 0, 0, 0]]), ('load capture unload', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 0, 'f2': 0, 'f3': 0}, [['shift', 1], ['shift', 1], ['capture', 0], ['shift', 0], ['shift', 0]]], [[0, 0, 0, 0], [0, 0, 1, 0]]), ('double capture', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 1, 'f1': 0, 'f2': 1, 'f3': 1}, [['capture', 0], ['capture', 0], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[0, 0, 0, 1, 1], [1, 1, 1, 1]]), ('short chain', [['f0', 'f2'], {'f0': ['not', ['f2']], 'f2': ['xor', ['f0', 'f2']]}, {'f0': 1, 'f2': 0}, [['shift', 0], ['capture', 0], ['shift', 1]]], [[0, 1], [1, 0]]), ('flush ones', [['f0', 'f1', 'f2', 'f3'], {'f0': ['xor', ['f1', 'f2']], 'f1': ['and', ['f0', 'f2']], 'f2': ['not', ['f0']], 'f3': ['xor', ['f2', 'f3']]}, {'f0': 0, 'f1': 1, 'f2': 0, 'f3': 1}, [['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1], ['shift', 1]]], [[1, 0, 1, 0, 1, 1], [1, 1, 1, 1]])]]
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
shift in a pattern[[1, 1], [0, 1, 1, 0]][[1, 1], [0, 1, 1, 0]]Passed
capture then unload[[0, 0, 1, 1], [0, 0, 0, 0]][[0, 0, 1, 1], [0, 0, 0, 0]]Passed
load capture unload[[0, 0, 0, 0], [0, 0, 1, 0]][[0, 0, 0, 0], [0, 0, 1, 0]]Passed
double capture[[0], [1, 1, 0, 0]][[0], [1, 1, 0, 0]]Passed
short chain[[0, 1], [1, 0]][[0, 1], [1, 0]]Passed
flush ones[[1, 0], [1, 1, 0, 1]][[1, 0], [1, 1, 0, 1]]Passed

SHA-256 / 2aeb52de2b29fa584b4a2d2c78f71bd6fa0b33b59bb35fcabdd069b46cb3095a

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:16.015525+00:00.

Case digest / 7b892497848450a549866f89d795c3d9b3536e7ae545c0d3a20f928cb5e42007