The logic cone of an output is the set of cells that can influence it. It is found by walking fanin backward from the output to the primary inputs.
Cells outside the cone cannot affect the output. An ECO that stays inside one cone leaves every other output untouched by construction.
Cone of | Cells | Size |
|---|---|---|
y1 | g1, g2 | 2 |
y2 | g3, g4 | 2 |
Both together | g1, g2, g3, g4 | 4 |
The program below models a small netlist as a fanin graph. It walks backward from each output and checks the exact cell sets.
import sys
FANIN = {
"g1": ["a", "b"],
"g2": ["g1", "c"],
"g3": ["a", "b"],
"g4": ["g3", "d"],
}
OUTPUTS = {"y1": "g2", "y2": "g4"}
def cone_cells(output):
seen = set()
stack = [OUTPUTS[output]]
while stack:
cell = stack.pop()
if cell in seen:
continue
if cell not in FANIN:
continue
seen.add(cell)
for driver in FANIN[cell]:
if driver in FANIN:
stack.append(driver)
return seen
def cone_inputs(output):
inputs = set()
for cell in cone_cells(output):
for driver in FANIN[cell]:
if driver not in FANIN:
inputs.add(driver)
return inputs
def outputs_reached_by(cell):
hit = set()
for name in OUTPUTS:
if cell in cone_cells(name):
hit.add(name)
return hit
checks = [
(sorted(cone_cells("y1")), ["g1", "g2"]),
(sorted(cone_cells("y2")), ["g3", "g4"]),
(len(cone_cells("y1") | cone_cells("y2")), 4),
(sorted(outputs_reached_by("g1")), ["y1"]),
(sorted(outputs_reached_by("g3")), ["y2"]),
((sorted(cone_inputs("y1")), sorted(cone_inputs("y2"))), (["a", "b", "c"], ["a", "b", "d"])),
]
for i in range(len(checks)):
got, want = checks[i]
if got != want:
print("FAIL: check " + str(i + 1) + " got " + str(got) + " want " + str(want))
sys.exit(1)
print("PASS: 6 checks hold with 2 cells per cone, union 4, and shared input a in both")The six self-checks pin the cone of each output, their union, and which outputs a changed cell reaches. The support-input check pins the shared input a in both cones.
The cone of y1 holds 2 cells, g1 and g2. The cone of y2 holds 2 cells, g3 and g4, so the two cones together hold 4 cells.
A change at g1 reaches y1 only. A change at the shared input a reaches both outputs, since a feeds g1 and g3.
y1 only. Cell g2 sits in the cone of y1 and outside the cone of y2.
Both y1 and y2. Input a feeds g1 and g3, which sit in different cones.