updates for resizer

This commit is contained in:
James Cherry 2019-11-05 07:51:54 -07:00
parent 3179c5a343
commit 6934b4ebcd
3 changed files with 37 additions and 27 deletions

View File

@ -1029,17 +1029,21 @@ LibertyCell::setClockGateType(ClockGateType type)
bool bool
LibertyCell::isBuffer() const LibertyCell::isBuffer() const
{ {
if (ports_.size() == 2) { int input_count = 0;
LibertyPort *port1 = static_cast<LibertyPort*>(ports_[0]); int output_count = 0;
LibertyPort *port2 = static_cast<LibertyPort*>(ports_[1]); for (ConcretePort *cport : ports_) {
return (port1->direction()->isInput() LibertyPort *port = static_cast<LibertyPort*>(cport);
&& port2->direction()->isOutput() PortDirection *dir = port->direction();
&& hasBufferFunc(port1, port2)) if (dir->isInput())
|| (port2->direction()->isInput() input_count++;
&& port1->direction()->isOutput() else if (dir->isOutput())
&& hasBufferFunc(port2, port1)); output_count++;
} else if (!dir->isPowerGround())
return false; return false;
if (input_count > 1 || output_count > 1)
break;
}
return input_count == 1 && output_count == 1;
} }
bool bool
@ -1057,16 +1061,17 @@ LibertyCell::bufferPorts(// Return values.
LibertyPort *&input, LibertyPort *&input,
LibertyPort *&output) LibertyPort *&output)
{ {
LibertyPort *port1 = static_cast<LibertyPort*>(ports_[0]); input = nullptr;
LibertyPort *port2 = static_cast<LibertyPort*>(ports_[1]); output = nullptr;
if (port1->direction()->isInput() for (ConcretePort *cport : ports_) {
&& port2->direction()->isOutput()) { LibertyPort *port = static_cast<LibertyPort*>(cport);
input = port1; PortDirection *dir = port->direction();
output = port2; if (dir->isInput())
} input = port;
else { else if (dir->isOutput())
input = port2; output = port;
output = port1; if (input && output)
return;
} }
} }

View File

@ -1077,7 +1077,7 @@ LeafInstanceIterator1::LeafInstanceIterator1(const Instance *inst,
child_iter_(network->childIterator(inst)), child_iter_(network->childIterator(inst)),
next_(nullptr) next_(nullptr)
{ {
pending_child_iters_.reserve(512); pending_child_iters_.reserve(8);
nextInst(); nextInst();
} }

View File

@ -579,9 +579,9 @@ Sim::propagateToInvalidLoads()
while (load_iter.hasNext()) { while (load_iter.hasNext()) {
Pin *load_pin = load_iter.next(); Pin *load_pin = load_iter.next();
Net *net = network_->net(load_pin); Net *net = network_->net(load_pin);
if (network_->isGround(net)) if (net && network_->isGround(net))
setPinValue(load_pin, LogicValue::zero, true); setPinValue(load_pin, LogicValue::zero, true);
else if (network_->isPower(net)) else if (net && network_->isPower(net))
setPinValue(load_pin, LogicValue::one, true); setPinValue(load_pin, LogicValue::one, true);
else { else {
Pin *drvr_pin = findDrvrPin(load_pin, network_); Pin *drvr_pin = findDrvrPin(load_pin, network_);
@ -701,10 +701,15 @@ Sim::connectPinAfter(Pin *pin)
void void
Sim::disconnectPinBefore(Pin *pin) Sim::disconnectPinBefore(Pin *pin)
{ {
if (incremental_ if (incremental_) {
&& network_->isLoad(pin)) if (network_->isLoad(pin)) {
invalid_load_pins_.insert(pin);
removePropagatedValue(pin); removePropagatedValue(pin);
} }
if (network_->isDriver(pin))
invalid_drvr_pins_.insert(pin);
}
}
void void
Sim::pinSetFuncAfter(Pin *pin) Sim::pinSetFuncAfter(Pin *pin)