IO.
FuseInst:
PROC [civ: Sets.Value]
RETURNS [
BOOL] ~ {
ci: CellInstance ~ NARROW[civ.VA];
ws1: Set ~ ci.conns.Image[ps1];
IF ws1.Size.EN # 1 THEN RETURN [FALSE];
{ws2: Set ~ ci.conns.Image[ps2];
IF ws2.Size.EN # 1 THEN RETURN [FALSE];
IF inhibit#
NIL
THEN {
w: Wire ~ ConndWire[ci, inhibit];
IF w.conns.Size.EN # 1 THEN RETURN [FALSE];
};
{cct: CellType ~ d.CiCct[ci];
exp: Set ~ cct.asu.exports.Image[ws1, rightToLeft] .Union[ cct.asu.exports.Image[ws2, rightToLeft] ];
w1: Wire ~ NARROW[ws1.TheElt.VA];
w2: Wire ~ NARROW[ws2.TheElt.VA];
IF exp.Size.EN > 1 THEN ERROR;
IF w1#w2
THEN {
IF log#NIL THEN log.PutF["Fusing %g and %g, and deleting %g\n", [rope[Describe[d, w1, cct]]], [rope[Describe[d, w2, cct]]], [rope[Describe[d, ci, d]]]];
[] ← MergeNets[d, w1, w2, TRUE];
log ← log}
ELSE {
IF log#NIL THEN log.PutF["Deleting %g\n", [rope[Describe[d, ci, d]]]];
inhibit ← inhibit};
DeleteInsts[d, Sets.CreateSingleton[civ, d.eSpace], TRUE];
RETURN [FALSE]}}};