rearrange netlist edit api for opendb

This commit is contained in:
James Cherry 2020-11-09 20:50:05 -07:00
parent b5bc2f948f
commit 8ced99d0fa
2 changed files with 53 additions and 56 deletions

View File

@ -1103,6 +1103,8 @@ public:
LibertyCell *cell,
Instance *parent);
virtual void deleteInstance(Instance *inst);
void deleteLeafInstanceBefore(Instance *inst);
void deleteInstancePinsBefore(Instance *inst);
// replace_cell
virtual void replaceCell(Instance *inst,
Cell *to_cell);
@ -1322,16 +1324,13 @@ protected:
int pin_level);
void findRegisterPreamble();
bool crossesHierarchy(Edge *edge) const;
void deleteLeafInstanceBefore(Instance *inst);
void readLibertyAfter(LibertyLibrary *liberty,
Corner *corner,
const MinMax *min_max);
void powerPreamble();
void disableFanoutCrprPruning(Vertex *vertex,
int &fanou);
LibertyPort *findCellPort(LibertyCell *cell,
PortDirection *dir);
void replaceCell(Instance *inst,
virtual void replaceCell(Instance *inst,
Cell *to_cell,
LibertyCell *to_lib_cell);
void sdcChangedGraph();

View File

@ -3803,19 +3803,6 @@ Sta::disconnectPin(Pin *pin)
network->disconnectPin(pin);
}
LibertyPort *
Sta::findCellPort(LibertyCell *cell,
PortDirection *dir)
{
LibertyCellPortIterator port_iter(cell);
while (port_iter.hasNext()) {
LibertyPort *port = port_iter.next();
if (port->direction() == dir)
return port;
}
return nullptr;
}
////////////////////////////////////////////////////////////////
//
// Network edit before/after methods.
@ -4176,8 +4163,10 @@ Sta::deleteNetBefore(Net *net)
void
Sta::deleteInstanceBefore(Instance *inst)
{
if (network_->isLeaf(inst))
if (network_->isLeaf(inst)) {
deleteInstancePinsBefore(inst);
deleteLeafInstanceBefore(inst);
}
else {
// Delete hierarchical instance children.
InstanceChildIterator *child_iter = network_->childIterator(inst);
@ -4191,6 +4180,12 @@ Sta::deleteInstanceBefore(Instance *inst)
void
Sta::deleteLeafInstanceBefore(Instance *inst)
{
sim_->deleteInstanceBefore(inst);
}
void
Sta::deleteInstancePinsBefore(Instance *inst)
{
InstancePinIterator *pin_iter = network_->pinIterator(inst);
while (pin_iter->hasNext()) {
@ -4198,7 +4193,6 @@ Sta::deleteLeafInstanceBefore(Instance *inst)
deletePinBefore(pin);
}
delete pin_iter;
sim_->deleteInstanceBefore(inst);
}
void
@ -4207,7 +4201,7 @@ Sta::deletePinBefore(Pin *pin)
if (graph_) {
if (network_->isLoad(pin)) {
Vertex *vertex = graph_->pinLoadVertex(pin);
if (vertex) {
levelize_->deleteVertexBefore(vertex);
graph_delay_calc_->deleteVertexBefore(vertex);
search_->deleteVertexBefore(vertex);
@ -4224,9 +4218,10 @@ Sta::deletePinBefore(Pin *pin)
}
graph_->deleteVertex(vertex);
}
}
if (network_->isDriver(pin)) {
Vertex *vertex = graph_->pinDrvrVertex(pin);
if (vertex) {
levelize_->deleteVertexBefore(vertex);
graph_delay_calc_->deleteVertexBefore(vertex);
search_->deleteVertexBefore(vertex);
@ -4246,15 +4241,18 @@ Sta::deletePinBefore(Pin *pin)
}
graph_->deleteVertex(vertex);
}
}
if (network_->direction(pin) == PortDirection::internal()) {
// Internal pins are not loads or drivers.
Vertex *vertex = graph_->pinLoadVertex(pin);
if (vertex) {
levelize_->deleteVertexBefore(vertex);
graph_delay_calc_->deleteVertexBefore(vertex);
search_->deleteVertexBefore(vertex);
graph_->deleteVertex(vertex);
}
}
}
sim_->deletePinBefore(pin);
clk_network_->deletePinBefore(pin);
}