FA-89201 / Digital logic simulation / Open access
Unknown toggle enable holds the flop · case 01
A T flip-flop with T='x' keeps its value instead of going unknown.
ROOT CAUSE
An unknown T input is treated as 0 (hold).
THE FAILURE
An unknown T input is treated as 0 (hold).
Unsuccessful approach: Treating an unknown T as a toggle still produces a definite value.
Case contract
Input [kind, q0, ins] with one [a, b] pair per clock edge. jk (a=J, b=K): 00 hold, 10 set, 01 reset, 11 toggle. sr (a=S, b=R): 10 set, 01 reset, 00 hold, 11 is forbidden and makes q 'x'. t (a=T): 1 toggles, 0 holds, 'x' makes q 'x'. Toggling 'x' gives 'x'. Return q after each edge.
Why this case matters
Behavioural flip-flop primitives in gate-level libraries must reproduce characteristic tables, including unknown handling.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(*args):
kind, q, ins = args
def tog(v):
return {0: 1, 1: 0}.get(v, 'x')
out = []
for a, b in ins:
if kind == 't':
if a == 'x': q = q
elif a == 1: q = tog(q)
elif kind == 'jk':
if a == 1 and b == 1: q = tog(q)
elif a == 1: q = 1
elif b == 1: q = 0
else:
if a == 1 and b == 1: q = 'x'
elif (a, b) == (1, 0): q = 1
elif (a, b) == (0, 1): q = 0
out.append(q)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [0, 1]]], [1, 1, 0, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0], [0, 1]]], [0, 0, 1, 0]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0]]], [1, 'x', 'x', 0, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0]]], [0, 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [0, 0]]], [1, 0, 0])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0]]], [0, 0, 1]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 1])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0], [0, 1]]], [0, 0, 1, 0]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 0, 0])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0, 1, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0]]], [0, 0, 1]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 0, 1, 1])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0, 1, 0, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0], [0, 1]]], [0, 0, 1, 0]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1, 1, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 0, 1, 0, 0])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| jk toggles from known state | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| jk toggle from unknown | ['x', 1, 0] | ['x', 1, 0] | Passed |
| jk reset only | [0, 0, 1, 0] | [0, 0, 1, 0] | Passed |
| sr forbidden input | [1, 'x', 'x', 0, 1] | [1, 'x', 'x', 0, 1] | Passed |
| sr hold and set | [1, 0, 1] | [1, 0, 1] | Passed |
| t unknown enable | [0, 0, 1, 1] | [0, 'x', 'x', 'x'] | Failed |
| t toggles | [1, 0, 0] | [1, 0, 0] | Passed |
SHA-256 / 665cb19217ba9a8102839d59cc8b5ecbe2753a16e5df4124b419c55ad3487c40
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(*args):
kind, q, ins = args
def tog(v):
return {0: 1, 1: 0}.get(v, 'x')
out = []
for a, b in ins:
if kind == 't':
if a == 'x': q = tog(q)
elif a == 1: q = tog(q)
elif kind == 'jk':
if a == 1 and b == 1: q = tog(q)
elif a == 1: q = 1
elif b == 1: q = 0
else:
if a == 1 and b == 1: q = 'x'
elif (a, b) == (1, 0): q = 1
elif (a, b) == (0, 1): q = 0
out.append(q)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [0, 1]]], [1, 1, 0, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0], [0, 1]]], [0, 0, 1, 0]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0]]], [1, 'x', 'x', 0, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0]]], [0, 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [0, 0]]], [1, 0, 0])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0]]], [0, 0, 1]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 1])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0], [0, 1]]], [0, 0, 1, 0]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 0, 0])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0, 1, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0]]], [0, 0, 1]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 0, 1, 1])], [('jk toggles from known state', ['jk', 0, [[1, 0], [0, 0], [1, 1], [1, 1], [1, 1], [1, 1], [1, 1], [0, 1]]], [1, 1, 0, 1, 0, 1, 0, 0]), ('jk toggle from unknown', ['jk', 'x', [[1, 1], [1, 0], [1, 1]]], ['x', 1, 0]), ('jk reset only', ['jk', 1, [[0, 1], [0, 0], [1, 0], [0, 1]]], [0, 0, 1, 0]), ('sr forbidden input', ['sr', 0, [[1, 0], [1, 1], [0, 0], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]], [1, 'x', 'x', 0, 1, 1, 1, 1, 1]), ('sr hold and set', ['sr', 1, [[0, 0], [0, 1], [1, 0]]], [1, 0, 1]), ('t unknown enable', ['t', 1, [[1, 0], ['x', 0], [1, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]], [0, 'x', 'x', 'x', 'x', 'x', 'x', 'x']), ('t toggles', ['t', 0, [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [0, 0]]], [1, 0, 1, 0, 1, 0, 0])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| jk toggles from known state | [1, 1, 0, 0] | [1, 1, 0, 0] | Passed |
| jk toggle from unknown | ['x', 1, 0] | ['x', 1, 0] | Passed |
| jk reset only | [0, 0, 1, 0] | [0, 0, 1, 0] | Passed |
| sr forbidden input | [1, 'x', 'x', 0, 1] | [1, 'x', 'x', 0, 1] | Passed |
| sr hold and set | [1, 0, 1] | [1, 0, 1] | Passed |
| t unknown enable | [0, 1, 0, 0] | [0, 'x', 'x', 'x'] | Failed |
| t toggles | [1, 0, 0] | [1, 0, 0] | Passed |
SHA-256 / 0000ee34832a6a1a15352046a7112dce04971ecbf7f8ea9efe51c03279ea94f2
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:15.305929+00:00.
Case digest / c9157205f950908b870207b5cd6ac07b38f965777a2fc8a08214c8a5dcec1e0a