replace_cell equiv funcs, diff arcs resolves #267

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2025-07-09 11:50:36 -07:00
parent cda30445d6
commit 5e4ce2fd23
3 changed files with 23 additions and 2 deletions

View File

@ -57,11 +57,17 @@ protected:
};
// Predicate that is true when the ports, functions, sequentials and
// timing arcs match.
// functions or timing arcs match.
bool
equivCells(const LibertyCell *cell1,
const LibertyCell *cell2);
// Predicate that is true when the ports, functions, sequentials and
// timing arcs match.
bool
equivCellsArcs(const LibertyCell *cell1,
const LibertyCell *cell2);
// Predicate that is true when the ports match.
bool
equivCellPorts(const LibertyCell *cell1,

View File

@ -341,6 +341,19 @@ equivCells(const LibertyCell *cell1,
|| equivCellTimingArcSets(cell1, cell2));
}
bool
equivCellsArcs(const LibertyCell *cell1,
const LibertyCell *cell2)
{
return equivCellPorts(cell1, cell2)
&& equivCellFuncs(cell1, cell2)
&& equivCellPgPorts(cell1, cell2)
&& equivCellSequentials(cell1, cell2)
&& equivCellStatetables(cell1, cell2)
// Reqwuire timing arc equivalence if there are no functions.
&& equivCellTimingArcSets(cell1, cell2);
}
static bool
cellHasFuncs(const LibertyCell *cell)
{

View File

@ -4089,7 +4089,9 @@ Sta::replaceCell(Instance *inst,
{
NetworkEdit *network = networkCmdEdit();
LibertyCell *from_lib_cell = network->libertyCell(inst);
if (sta::equivCells(from_lib_cell, to_lib_cell)) {
if (sta::equivCellsArcs(from_lib_cell, to_lib_cell)) {
// Replace celll optimized for less disruption to graph
// when ports and timing arcs are equivalent.
replaceEquivCellBefore(inst, to_lib_cell);
network->replaceCell(inst, to_cell);
replaceEquivCellAfter(inst);