FA-89221 / Digital logic simulation / Open access
Unannotated nets charged unit capacitance · case 01
Nets without a capacitance annotation add energy to the estimate.
ROOT CAUSE
Missing capacitance defaults to 1 instead of 0.
VERIFIED REPAIR
Treat unannotated nets as unloaded (cap 0).
Unsuccessful approach: Defaulting to the cycle count invents a load.
Case 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].
Why this case matters
Power estimation from simulation activity separates functional toggles from glitch toggles; mis-counting either skews dynamic power reports.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(*args):
init, waves, cap = args
def ht(a, b):
if a == b: return 0
if 'x' in (a, b): return 1
return 2
func = tot = 0
for net in sorted(waves):
c = cap.get(net, 1)
ref = fref = init[net]
for cyc in waves[net]:
for v in cyc:
tot += ht(ref, v) * c
ref = v
if cyc:
func += ht(fref, cyc[-1]) * c
fref = cyc[-1]
return [func, tot]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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])]]
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 |
|---|---|---|---|
| full toggles and unknown transitions | [15, 15] | [15, 15] | Passed |
| glitch inside a cycle | [4, 20] | [4, 20] | Passed |
| cross-cycle glitch reference | [2, 6] | [2, 6] | Passed |
| unloaded net | [26, 26] | [20, 20] | Failed |
| empty cycles keep reference | [16, 32] | [16, 32] | Passed |
| from unknown initial value | [3, 5] | [3, 5] | Passed |
SHA-256 / de9a3efccbd6d1a407f630b279d2eae7e4ce4659a9f0b59c853bd0bd3077e704
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(*args):
init, waves, cap = args
def ht(a, b):
if a == b: return 0
if 'x' in (a, b): return 1
return 2
func = tot = 0
for net in sorted(waves):
c = cap[net] if net in cap else len(waves[net])
ref = fref = init[net]
for cyc in waves[net]:
for v in cyc:
tot += ht(ref, v) * c
ref = v
if cyc:
func += ht(fref, cyc[-1]) * c
fref = cyc[-1]
return [func, tot]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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])]]
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 |
|---|---|---|---|
| full toggles and unknown transitions | [15, 15] | [15, 15] | Passed |
| glitch inside a cycle | [4, 20] | [4, 20] | Passed |
| cross-cycle glitch reference | [2, 6] | [2, 6] | Passed |
| unloaded net | [38, 38] | [20, 20] | Failed |
| empty cycles keep reference | [16, 32] | [16, 32] | Passed |
| from unknown initial value | [3, 5] | [3, 5] | Passed |
SHA-256 / 4a4557e7a2158effbfd7a532b6ed45b410900ed680d407949cd8fd0b2a96d02d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(*args):
init, waves, cap = args
def ht(a, b):
if a == b: return 0
if 'x' in (a, b): return 1
return 2
func = tot = 0
for net in sorted(waves):
c = cap.get(net, 0)
ref = fref = init[net]
for cyc in waves[net]:
for v in cyc:
tot += ht(ref, v) * c
ref = v
if cyc:
func += ht(fref, cyc[-1]) * c
fref = cyc[-1]
return [func, tot]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('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])]]
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 |
|---|---|---|---|
| full toggles and unknown transitions | [15, 15] | [15, 15] | Passed |
| glitch inside a cycle | [4, 20] | [4, 20] | Passed |
| cross-cycle glitch reference | [2, 6] | [2, 6] | Passed |
| unloaded net | [20, 20] | [20, 20] | Passed |
| empty cycles keep reference | [16, 32] | [16, 32] | Passed |
| from unknown initial value | [3, 5] | [3, 5] | Passed |
SHA-256 / d3411b768528e256438611c5e9f662ba8e5ac35c349ee9564fa8fe35b84f189b
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.397870+00:00.
Case digest / fc703f0b3496c30afb049b27ec7e5fd9db5512fab6a8fa09a9272294743e496b