{"abstract":"Glitchy cycles report functional activity based on a transient value rather than the settled value.","category":"Digital logic simulation","checks":6,"contract":"Input [init, waves, cap]: waves[net] is a list of cycles, each a list of sub-cycle values ('0','1','x'). A 0<->1 change costs 2 half-toggles, a change to or from x costs 1, no change 0. Total energy sums half-toggles times cap over every event, comparing each event with the previous event on that net (across cycle boundaries). Functional energy compares only the last value of each non-empty cycle with the previous such value. Nets without a cap entry are unloaded (cap 0). Return [functional, total].","contract_signature":"*args","evaluation_group":"w2-digital-logic-simulation-switching-energy","failed_approach":"Picking the middle event is still a transient value.","family":"w2-digital-logic-simulation-switching-energy-functional-value-per-cycle","id":"FA-89211","implementations":{"attempt":{"sha256":"89b397889a6f79cb127aa6339bb1b30a842026af8f6f7c486147b796946057fa","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(*args):\n    init, waves, cap = args\n    def ht(a, b):\n        if a == b: return 0\n        if 'x' in (a, b): return 1\n        return 2\n    func = tot = 0\n    for net in sorted(waves):\n        c = cap.get(net, 0)\n        ref = fref = init[net]\n        for cyc in waves[net]:\n            for v in cyc:\n                tot += ht(ref, v) * c\n                ref = v\n            if cyc:\n                func += ht(fref, cyc[len(cyc) // 2]) * c\n                fref = cyc[-1]\n    return [func, tot]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0']]}, {'h': 1}], [2, 6]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 1}], [3, 5])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [6, 10]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 2}], [6, 10])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [10, 14]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 3}], [9, 15])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [14, 18]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0'], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 4}], [12, 20])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1'], ['1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [18, 22]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0'], ['0'], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 5}], [15, 25])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"adb6fcfb948c7765b1eac88f59fc9ca8d8c90b33746c7749db5c20bb7f250c96","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(*args):\n    init, waves, cap = args\n    def ht(a, b):\n        if a == b: return 0\n        if 'x' in (a, b): return 1\n        return 2\n    func = tot = 0\n    for net in sorted(waves):\n        c = cap.get(net, 0)\n        ref = fref = init[net]\n        for cyc in waves[net]:\n            for v in cyc:\n                tot += ht(ref, v) * c\n                ref = v\n            if cyc:\n                func += ht(fref, cyc[0]) * c\n                fref = cyc[-1]\n    return [func, tot]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0']]}, {'h': 1}], [2, 6]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 1}], [3, 5])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [6, 10]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 2}], [6, 10])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [10, 14]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 3}], [9, 15])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [14, 18]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0'], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 4}], [12, 20])], [('full toggles and unknown transitions', [{'a': '0'}, {'a': [['1'], ['x'], ['0'], ['x']]}, {'a': 3}], [15, 15]), ('glitch inside a cycle', [{'g': '0'}, {'g': [['1', '0'], ['1', '0', '1'], ['1'], ['1'], ['1'], ['1'], ['1']]}, {'g': 2}], [4, 20]), ('cross-cycle glitch reference', [{'h': '1'}, {'h': [['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0'], ['0', '1'], ['0']]}, {'h': 1}], [18, 22]), ('unloaded net', [{'a': '0', 'u': '0'}, {'a': [['1'], ['0']], 'u': [['1'], ['0'], ['1']]}, {'a': 5}], [20, 20]), ('empty cycles keep reference', [{'e': '0'}, {'e': [['1'], [], ['0', '1'], [], ['0'], ['0'], ['0'], ['0'], ['0']]}, {'e': 4}], [16, 32]), ('from unknown initial value', [{'k': 'x'}, {'k': [['0'], ['1', 'x', '1']]}, {'k': 5}], [15, 25])]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-digital-logic-simulation-switching-energy-functional-value-per-cycle","generated_at":"2026-09-29T14:51:15.397870+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Power estimation from simulation activity separates functional toggles from glitch toggles; mis-counting either skews dynamic power reports.","root_cause":"Functional activity compares the first sub-cycle value instead of the settled last value.","sha256":"f8bd5e0412b8514740974081f0ec78a7f337ad669f27a38f597bb9eb1a0e60b8","title":"Functional toggle taken from the first value of a cycle · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":43.436,"exit_code":1,"observations":[{"actual":[15,15],"check":"full toggles and unknown transitions","expected":[15,15],"passed":true},{"actual":[0,20],"check":"glitch inside a cycle","expected":[4,20],"passed":false},{"actual":[2,6],"check":"cross-cycle glitch reference","expected":[2,6],"passed":true},{"actual":[20,20],"check":"unloaded net","expected":[20,20],"passed":true},{"actual":[16,32],"check":"empty cycles keep reference","expected":[16,32],"passed":true},{"actual":[2,5],"check":"from unknown initial value","expected":[3,5],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"full toggles and unknown transitions\", \"actual\": [15, 15], \"expected\": [15, 15], \"passed\": true}, {\"check\": \"glitch inside a cycle\", \"actual\": [0, 20], \"expected\": [4, 20], \"passed\": false}, {\"check\": \"cross-cycle glitch reference\", \"actual\": [2, 6], \"expected\": [2, 6], \"passed\": true}, {\"check\": \"unloaded net\", \"actual\": [20, 20], \"expected\": [20, 20], \"passed\": true}, {\"check\": \"empty cycles keep reference\", \"actual\": [16, 32], \"expected\": [16, 32], \"passed\": true}, {\"check\": \"from unknown initial value\", \"actual\": [2, 5], \"expected\": [3, 5], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.099,"exit_code":1,"observations":[{"actual":[15,15],"check":"full toggles and unknown transitions","expected":[15,15],"passed":true},{"actual":[8,20],"check":"glitch inside a cycle","expected":[4,20],"passed":false},{"actual":[4,6],"check":"cross-cycle glitch reference","expected":[2,6],"passed":false},{"actual":[20,20],"check":"unloaded net","expected":[20,20],"passed":true},{"actual":[24,32],"check":"empty cycles keep reference","expected":[16,32],"passed":false},{"actual":[3,5],"check":"from unknown initial value","expected":[3,5],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"full toggles and unknown transitions\", \"actual\": [15, 15], \"expected\": [15, 15], \"passed\": true}, {\"check\": \"glitch inside a cycle\", \"actual\": [8, 20], \"expected\": [4, 20], \"passed\": false}, {\"check\": \"cross-cycle glitch reference\", \"actual\": [4, 6], \"expected\": [2, 6], \"passed\": false}, {\"check\": \"unloaded net\", \"actual\": [20, 20], \"expected\": [20, 20], \"passed\": true}, {\"check\": \"empty cycles keep reference\", \"actual\": [24, 32], \"expected\": [16, 32], \"passed\": false}, {\"check\": \"from unknown initial value\", \"actual\": [3, 5], \"expected\": [3, 5], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}