mirror of
https://github.com/The-OpenROAD-Project/OpenSTA.git
synced 2026-05-30 00:24:12 +08:00
picked changes from upstream master, resolved conflict for levelized driververtices, parseBus for weird defs
Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
This commit is contained in:
@@ -28,11 +28,11 @@
|
||||
#include <cstdlib>
|
||||
#include <limits>
|
||||
|
||||
#include "ConcreteNetwork.hh"
|
||||
#include "ContainerHelpers.hh"
|
||||
#include "ParseBus.hh"
|
||||
#include "PatternMatch.hh"
|
||||
#include "PortDirection.hh"
|
||||
#include "ParseBus.hh"
|
||||
#include "ConcreteNetwork.hh"
|
||||
|
||||
namespace sta {
|
||||
|
||||
@@ -44,9 +44,7 @@ ConcreteLibrary::ConcreteLibrary(std::string_view name,
|
||||
name_(name),
|
||||
id_(ConcreteNetwork::nextObjectId()),
|
||||
filename_(filename),
|
||||
is_liberty_(is_liberty),
|
||||
bus_brkt_left_('['),
|
||||
bus_brkt_right_(']')
|
||||
is_liberty_(is_liberty)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -125,9 +123,6 @@ ConcreteCell::ConcreteCell(std::string_view name,
|
||||
id_(ConcreteNetwork::nextObjectId()),
|
||||
filename_(filename),
|
||||
library_(library),
|
||||
liberty_cell_(nullptr),
|
||||
ext_cell_(nullptr),
|
||||
port_bit_count_(0),
|
||||
is_leaf_(is_leaf)
|
||||
{
|
||||
}
|
||||
@@ -234,7 +229,7 @@ ConcreteCell::makeBusPortBit(ConcretePort *bus_port,
|
||||
}
|
||||
|
||||
ConcretePort *
|
||||
ConcreteCell::makePort(std::string bit_name,
|
||||
ConcreteCell::makePort(std::string_view bit_name,
|
||||
int bit_index)
|
||||
{
|
||||
ConcretePort *port = new ConcretePort(bit_name, false,
|
||||
@@ -351,9 +346,9 @@ BusPort::addBusBit(ConcretePort *port,
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteCell::groupBusPorts(const char bus_brkt_left,
|
||||
const char bus_brkt_right,
|
||||
std::function<bool(std::string_view)> port_msb_first)
|
||||
ConcreteCell::groupBusPorts(char bus_brkt_left,
|
||||
char bus_brkt_right,
|
||||
const std::function<bool(std::string_view)> &port_msb_first)
|
||||
{
|
||||
const char bus_brkts_left[2]{bus_brkt_left, '\0'};
|
||||
const char bus_brkts_right[2]{bus_brkt_right, '\0'};
|
||||
@@ -415,15 +410,11 @@ ConcretePort::ConcretePort(std::string_view name,
|
||||
id_(ConcreteNetwork::nextObjectId()),
|
||||
cell_(cell),
|
||||
direction_(PortDirection::unknown()),
|
||||
liberty_port_(nullptr),
|
||||
ext_port_(nullptr),
|
||||
pin_index_(-1),
|
||||
is_bundle_(is_bundle),
|
||||
is_bus_(is_bus),
|
||||
from_index_(from_index),
|
||||
to_index_(to_index),
|
||||
member_ports_(member_ports),
|
||||
bundle_port_(nullptr)
|
||||
member_ports_(member_ports)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -575,9 +566,7 @@ ConcretePort::memberIterator() const
|
||||
|
||||
ConcreteCellPortBitIterator::ConcreteCellPortBitIterator(const ConcreteCell* cell) :
|
||||
ports_(cell->ports_),
|
||||
port_iter_(ports_.begin()),
|
||||
member_iter_(nullptr),
|
||||
next_(nullptr)
|
||||
port_iter_(ports_.begin())
|
||||
{
|
||||
findNext();
|
||||
}
|
||||
@@ -625,4 +614,4 @@ ConcreteCellPortBitIterator::findNext()
|
||||
next_ = nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -24,15 +24,16 @@
|
||||
|
||||
#include "ConcreteNetwork.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <string_view>
|
||||
|
||||
#include "PatternMatch.hh"
|
||||
#include "Report.hh"
|
||||
#include "Liberty.hh"
|
||||
#include "PortDirection.hh"
|
||||
#include "ConcreteLibrary.hh"
|
||||
#include "Liberty.hh"
|
||||
#include "Network.hh"
|
||||
#include "PatternMatch.hh"
|
||||
#include "PortDirection.hh"
|
||||
#include "Report.hh"
|
||||
|
||||
namespace sta {
|
||||
|
||||
@@ -105,13 +106,12 @@ private:
|
||||
|
||||
ConcreteInstanceNetMap *nets_;
|
||||
ConcreteInstanceNetMap::iterator iter_;
|
||||
ConcreteNet *next_;
|
||||
ConcreteNet *next_{nullptr};
|
||||
};
|
||||
|
||||
ConcreteInstanceNetIterator::
|
||||
ConcreteInstanceNetIterator(ConcreteInstanceNetMap *nets):
|
||||
nets_(nets),
|
||||
next_(nullptr)
|
||||
nets_(nets)
|
||||
{
|
||||
if (nets) {
|
||||
iter_ = nets->begin();
|
||||
@@ -161,7 +161,7 @@ private:
|
||||
|
||||
const ConcretePinSeq &pins_;
|
||||
int pin_count_;
|
||||
int pin_index_;
|
||||
int pin_index_{0};
|
||||
ConcretePin *next_;
|
||||
};
|
||||
|
||||
@@ -169,8 +169,7 @@ ConcreteInstancePinIterator::
|
||||
ConcreteInstancePinIterator(const ConcreteInstance *inst,
|
||||
int pin_count) :
|
||||
pins_(inst->pins_),
|
||||
pin_count_(pin_count),
|
||||
pin_index_(0)
|
||||
pin_count_(pin_count)
|
||||
{
|
||||
findNext();
|
||||
}
|
||||
@@ -271,24 +270,31 @@ ObjectId ConcreteNetwork::object_id_ = 0;
|
||||
|
||||
ConcreteNetwork::ConcreteNetwork() :
|
||||
NetworkReader(),
|
||||
top_instance_(nullptr),
|
||||
constant_nets_{NetSet(this), NetSet(this)},
|
||||
link_func_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
ConcreteNetwork::~ConcreteNetwork()
|
||||
{
|
||||
clear();
|
||||
// Cannot call virtual functions in destructor.
|
||||
clearImpl();
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteNetwork::clearImpl()
|
||||
{
|
||||
if (top_instance_)
|
||||
deleteInstanceImpl(top_instance_);
|
||||
top_instance_ = nullptr;
|
||||
deleteCellNetworkViewsImpl();
|
||||
deleteContents(library_seq_);
|
||||
library_map_.clear();
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteNetwork::clear()
|
||||
{
|
||||
deleteTopInstance();
|
||||
deleteCellNetworkViews();
|
||||
deleteContents(library_seq_);
|
||||
library_map_.clear();
|
||||
clearImpl();
|
||||
Network::clear();
|
||||
}
|
||||
|
||||
@@ -303,6 +309,12 @@ ConcreteNetwork::deleteTopInstance()
|
||||
|
||||
void
|
||||
ConcreteNetwork::deleteCellNetworkViews()
|
||||
{
|
||||
deleteCellNetworkViewsImpl();
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteNetwork::deleteCellNetworkViewsImpl()
|
||||
{
|
||||
for (auto [cell, view] : cell_network_view_map_) {
|
||||
if (view)
|
||||
@@ -361,7 +373,6 @@ class ConcreteLibertyLibraryIterator : public Iterator<LibertyLibrary*>
|
||||
{
|
||||
public:
|
||||
ConcreteLibertyLibraryIterator(const ConcreteNetwork *network);
|
||||
virtual ~ConcreteLibertyLibraryIterator();
|
||||
bool hasNext() override;
|
||||
LibertyLibrary *next() override;
|
||||
|
||||
@@ -370,22 +381,17 @@ private:
|
||||
|
||||
const ConcreteLibrarySeq &libs_;
|
||||
ConcreteLibrarySeq::const_iterator iter_;
|
||||
LibertyLibrary *next_;
|
||||
LibertyLibrary *next_{nullptr};
|
||||
};
|
||||
|
||||
ConcreteLibertyLibraryIterator::
|
||||
ConcreteLibertyLibraryIterator(const ConcreteNetwork *network):
|
||||
libs_(network->library_seq_),
|
||||
iter_(libs_.begin()),
|
||||
next_(nullptr)
|
||||
iter_(libs_.begin())
|
||||
{
|
||||
findNext();
|
||||
}
|
||||
|
||||
ConcreteLibertyLibraryIterator::~ConcreteLibertyLibraryIterator()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ConcreteLibertyLibraryIterator::hasNext()
|
||||
{
|
||||
@@ -462,7 +468,7 @@ ConcreteNetwork::deleteLibrary(Library *library)
|
||||
{
|
||||
ConcreteLibrary *clib = reinterpret_cast<ConcreteLibrary*>(library);
|
||||
library_map_.erase(clib->name());
|
||||
library_seq_.erase(std::find(library_seq_.begin(), library_seq_.end(), clib));
|
||||
library_seq_.erase(std::ranges::find(library_seq_, clib));
|
||||
delete clib;
|
||||
}
|
||||
|
||||
@@ -721,7 +727,7 @@ class ConcreteCellPortIterator1 : public CellPortIterator
|
||||
{
|
||||
public:
|
||||
ConcreteCellPortIterator1(const ConcreteCell *cell);
|
||||
~ConcreteCellPortIterator1();
|
||||
~ConcreteCellPortIterator1() override;
|
||||
bool hasNext() override { return iter_->hasNext(); }
|
||||
Port *next() override;
|
||||
|
||||
@@ -758,7 +764,7 @@ class ConcreteCellPortBitIterator1 : public CellPortIterator
|
||||
{
|
||||
public:
|
||||
ConcreteCellPortBitIterator1(const ConcreteCell *cell);
|
||||
~ConcreteCellPortBitIterator1();
|
||||
~ConcreteCellPortBitIterator1() override;
|
||||
bool hasNext() override { return iter_->hasNext(); }
|
||||
Port *next() override;
|
||||
|
||||
@@ -905,19 +911,18 @@ class ConcretePortMemberIterator1 : public PortMemberIterator
|
||||
{
|
||||
public:
|
||||
ConcretePortMemberIterator1(const ConcretePort *port);
|
||||
~ConcretePortMemberIterator1();
|
||||
~ConcretePortMemberIterator1() override;
|
||||
bool hasNext() override;
|
||||
Port *next() override;
|
||||
|
||||
private:
|
||||
ConcretePortMemberIterator *iter_;
|
||||
ConcretePort *next_;
|
||||
ConcretePort *next_{nullptr};
|
||||
};
|
||||
|
||||
ConcretePortMemberIterator1::ConcretePortMemberIterator1(const ConcretePort *
|
||||
port) :
|
||||
iter_(port->memberIterator()),
|
||||
next_(nullptr)
|
||||
iter_(port->memberIterator())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1051,7 +1056,7 @@ ConcreteNetwork::findInstNetsMatching(const Instance *instance,
|
||||
{
|
||||
const ConcreteInstance *inst =
|
||||
reinterpret_cast<const ConcreteInstance*>(instance);
|
||||
return inst->findNetsMatching(pattern, matches);
|
||||
inst->findNetsMatching(pattern, matches);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
@@ -1191,13 +1196,13 @@ ConcreteNetwork::instance(const Net *net) const
|
||||
bool
|
||||
ConcreteNetwork::isPower(const Net *net) const
|
||||
{
|
||||
return constant_nets_[int(LogicValue::one)].contains(const_cast<Net*>(net));
|
||||
return constant_nets_[static_cast<int>(LogicValue::one)].contains(const_cast<Net*>(net));
|
||||
}
|
||||
|
||||
bool
|
||||
ConcreteNetwork::isGround(const Net *net) const
|
||||
{
|
||||
return constant_nets_[int(LogicValue::zero)].contains(const_cast<Net*>(net));
|
||||
return constant_nets_[static_cast<int>(LogicValue::zero)].contains(const_cast<Net*>(net));
|
||||
}
|
||||
|
||||
NetPinIterator *
|
||||
@@ -1308,6 +1313,12 @@ ConcreteNetwork::replaceCell(Instance *inst,
|
||||
|
||||
void
|
||||
ConcreteNetwork::deleteInstance(Instance *inst)
|
||||
{
|
||||
deleteInstanceImpl(inst);
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteNetwork::deleteInstanceImpl(Instance *inst)
|
||||
{
|
||||
ConcreteInstance *cinst = reinterpret_cast<ConcreteInstance*>(inst);
|
||||
ConcreteInstanceNetMap *nets = cinst->nets_;
|
||||
@@ -1504,8 +1515,7 @@ ConcreteNetwork::deletePin(Pin *pin)
|
||||
ConcreteNet *cnet = cpin->net();
|
||||
if (cnet)
|
||||
disconnectNetPin(cnet, cpin);
|
||||
ConcreteInstance *cinst =
|
||||
reinterpret_cast<ConcreteInstance*>(cpin->instance());
|
||||
ConcreteInstance *cinst = cpin->instance();
|
||||
if (cinst)
|
||||
cinst->deletePin(cpin);
|
||||
delete cpin;
|
||||
@@ -1533,16 +1543,15 @@ ConcreteNetwork::deleteNet(Net *net)
|
||||
pin->net_ = nullptr;
|
||||
}
|
||||
|
||||
constant_nets_[int(LogicValue::zero)].erase(net);
|
||||
constant_nets_[int(LogicValue::one)].erase(net);
|
||||
constant_nets_[static_cast<int>(LogicValue::zero)].erase(net);
|
||||
constant_nets_[static_cast<int>(LogicValue::one)].erase(net);
|
||||
PinSet *drvrs = findKey(net_drvr_pin_map_, net);
|
||||
if (drvrs) {
|
||||
delete drvrs;
|
||||
net_drvr_pin_map_.erase(net);
|
||||
}
|
||||
|
||||
ConcreteInstance *cinst =
|
||||
reinterpret_cast<ConcreteInstance*>(cnet->instance());
|
||||
ConcreteInstance *cinst = cnet->instance();
|
||||
cinst->deleteNet(cnet);
|
||||
delete cnet;
|
||||
}
|
||||
@@ -1550,8 +1559,8 @@ ConcreteNetwork::deleteNet(Net *net)
|
||||
void
|
||||
ConcreteNetwork::clearConstantNets()
|
||||
{
|
||||
constant_nets_[int(LogicValue::zero)].clear();
|
||||
constant_nets_[int(LogicValue::one)].clear();
|
||||
constant_nets_[static_cast<int>(LogicValue::zero)].clear();
|
||||
constant_nets_[static_cast<int>(LogicValue::one)].clear();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1560,15 +1569,15 @@ ConcreteNetwork::addConstantNet(Net *net,
|
||||
{
|
||||
if (value == LogicValue::zero
|
||||
|| value == LogicValue::one)
|
||||
constant_nets_[int(value)].insert(net);
|
||||
constant_nets_[static_cast<int>(value)].insert(net);
|
||||
}
|
||||
|
||||
ConstantPinIterator *
|
||||
ConcreteNetwork::constantPinIterator()
|
||||
{
|
||||
return new NetworkConstantPinIterator(this,
|
||||
constant_nets_[int(LogicValue::zero)],
|
||||
constant_nets_[int(LogicValue::one)]);
|
||||
constant_nets_[static_cast<int>(LogicValue::zero)],
|
||||
constant_nets_[static_cast<int>(LogicValue::one)]);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
@@ -1617,9 +1626,7 @@ ConcreteInstance::ConcreteInstance(std::string_view name,
|
||||
name_(name),
|
||||
id_(ConcreteNetwork::nextObjectId()),
|
||||
cell_(cell),
|
||||
parent_(parent),
|
||||
children_(nullptr),
|
||||
nets_(nullptr)
|
||||
parent_(parent)
|
||||
{
|
||||
initPins();
|
||||
}
|
||||
@@ -1738,13 +1745,13 @@ ConcreteInstance::addChild(ConcreteInstance *child)
|
||||
{
|
||||
if (children_ == nullptr)
|
||||
children_ = new ConcreteInstanceChildMap;
|
||||
(*children_)[child->name().data()] = child;
|
||||
(*children_)[child->name()] = child;
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteInstance::deleteChild(ConcreteInstance *child)
|
||||
{
|
||||
children_->erase(child->name().data());
|
||||
children_->erase(child->name());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1769,7 +1776,7 @@ ConcreteInstance::addNet(ConcreteNet *net)
|
||||
{
|
||||
if (nets_ == nullptr)
|
||||
nets_ = new ConcreteInstanceNetMap;
|
||||
(*nets_)[net->name().data()] = net;
|
||||
(*nets_)[net->name()] = net;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1778,13 +1785,13 @@ ConcreteInstance::addNet(std::string_view,
|
||||
{
|
||||
if (nets_ == nullptr)
|
||||
nets_ = new ConcreteInstanceNetMap;
|
||||
(*nets_)[net->name().data()] = net;
|
||||
(*nets_)[net->name()] = net;
|
||||
}
|
||||
|
||||
void
|
||||
ConcreteInstance::deleteNet(ConcreteNet *net)
|
||||
{
|
||||
nets_->erase(net->name().data());
|
||||
nets_->erase(net->name());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1801,15 +1808,11 @@ ConcretePin::ConcretePin(ConcreteInstance *instance,
|
||||
instance_(instance),
|
||||
port_(port),
|
||||
net_(net),
|
||||
term_(nullptr),
|
||||
id_(ConcreteNetwork::nextObjectId()),
|
||||
net_next_(nullptr),
|
||||
net_prev_(nullptr),
|
||||
vertex_id_(vertex_id_null)
|
||||
id_(ConcreteNetwork::nextObjectId())
|
||||
{
|
||||
}
|
||||
|
||||
std::string_view
|
||||
const std::string&
|
||||
ConcretePin::name() const
|
||||
{
|
||||
return port_->name();
|
||||
@@ -1823,12 +1826,11 @@ ConcretePin::setVertexId(VertexId id)
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string_view
|
||||
const std::string &
|
||||
ConcreteTerm::name() const
|
||||
{
|
||||
ConcretePin *cpin = reinterpret_cast<ConcretePin*>(pin_);
|
||||
const ConcretePort *cport =
|
||||
reinterpret_cast<const ConcretePort*>(cpin->port());
|
||||
const ConcretePort *cport = cpin->port();
|
||||
return cport->name();
|
||||
}
|
||||
|
||||
@@ -1836,8 +1838,7 @@ ConcreteTerm::ConcreteTerm(ConcretePin *pin,
|
||||
ConcreteNet *net) :
|
||||
pin_(pin),
|
||||
net_(net),
|
||||
id_(ConcreteNetwork::nextObjectId()),
|
||||
net_next_(nullptr)
|
||||
id_(ConcreteNetwork::nextObjectId())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1847,10 +1848,7 @@ ConcreteNet::ConcreteNet(std::string_view name,
|
||||
ConcreteInstance *instance) :
|
||||
name_(name),
|
||||
id_(ConcreteNetwork::nextObjectId()),
|
||||
instance_(instance),
|
||||
pins_(nullptr),
|
||||
terms_(nullptr),
|
||||
merged_into_(nullptr)
|
||||
instance_(instance)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2125,4 +2123,4 @@ ConcreteBindingTbl::ensureBinding(Net *proto_net,
|
||||
return net;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace sta {
|
||||
|
||||
typedef std::set<HpinDrvrLoad*, HpinDrvrLoadLess> HpinDrvrLoads;
|
||||
using HpinDrvrLoads = std::set<HpinDrvrLoad*, HpinDrvrLoadLess>;
|
||||
|
||||
static void
|
||||
visitPinsAboveNet2(const Pin *hpin,
|
||||
@@ -52,8 +52,8 @@ visitPinsBelowNet2(const Pin *hpin,
|
||||
PinSet *hpin_path,
|
||||
const Network *network);
|
||||
static void
|
||||
visitHpinDrvrLoads(HpinDrvrLoads drvrs,
|
||||
HpinDrvrLoads loads,
|
||||
visitHpinDrvrLoads(HpinDrvrLoads &drvrs,
|
||||
HpinDrvrLoads &loads,
|
||||
HpinDrvrLoadVisitor *visitor);
|
||||
|
||||
void
|
||||
@@ -249,8 +249,8 @@ visitPinsBelowNet2(const Pin *hpin,
|
||||
}
|
||||
|
||||
static void
|
||||
visitHpinDrvrLoads(HpinDrvrLoads drvrs,
|
||||
HpinDrvrLoads loads,
|
||||
visitHpinDrvrLoads(HpinDrvrLoads &drvrs,
|
||||
HpinDrvrLoads &loads,
|
||||
HpinDrvrLoadVisitor *visitor)
|
||||
{
|
||||
for (HpinDrvrLoad *drvr : drvrs) {
|
||||
@@ -326,4 +326,4 @@ HpinDrvrLoadLess::operator()(const HpinDrvrLoad *drvr_load1,
|
||||
return load1 < load2;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -29,22 +29,15 @@
|
||||
#include <set>
|
||||
|
||||
#include "ContainerHelpers.hh"
|
||||
#include "StringUtil.hh"
|
||||
#include "PatternMatch.hh"
|
||||
#include "Liberty.hh"
|
||||
#include "ParseBus.hh"
|
||||
#include "PatternMatch.hh"
|
||||
#include "PortDirection.hh"
|
||||
#include "Scene.hh"
|
||||
#include "ParseBus.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
namespace sta {
|
||||
|
||||
Network::Network() :
|
||||
default_liberty_(nullptr),
|
||||
divider_('/'),
|
||||
escape_('\\')
|
||||
{
|
||||
}
|
||||
|
||||
Network::~Network()
|
||||
{
|
||||
deleteContents(net_drvr_pin_map_);
|
||||
@@ -264,7 +257,7 @@ Network::pathName(const Instance *instance) const
|
||||
InstanceSeq inst_path;
|
||||
path(instance, inst_path);
|
||||
std::string path_name;
|
||||
while (inst_path.size()) {
|
||||
while (!inst_path.empty()) {
|
||||
const Instance *inst = inst_path.back();
|
||||
path_name += name(inst);
|
||||
inst_path.pop_back();
|
||||
@@ -1184,7 +1177,7 @@ Network::setPathEscape(char escape)
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef std::vector<InstanceChildIterator *> InstanceChildIteratorSeq;
|
||||
using InstanceChildIteratorSeq = std::vector<InstanceChildIterator *>;
|
||||
|
||||
class LeafInstanceIterator1 : public LeafInstanceIterator
|
||||
{
|
||||
@@ -1200,15 +1193,14 @@ private:
|
||||
const Network *network_;
|
||||
InstanceChildIteratorSeq pending_child_iters_;
|
||||
InstanceChildIterator *child_iter_;
|
||||
Instance *next_;
|
||||
Instance *next_{nullptr};
|
||||
|
||||
};
|
||||
|
||||
LeafInstanceIterator1::LeafInstanceIterator1(const Instance *inst,
|
||||
const Network *network) :
|
||||
network_(network),
|
||||
child_iter_(network->childIterator(inst)),
|
||||
next_(nullptr)
|
||||
child_iter_(network->childIterator(inst))
|
||||
{
|
||||
pending_child_iters_.reserve(8);
|
||||
nextInst();
|
||||
@@ -1632,7 +1624,6 @@ Network::pathNameLast(std::string_view path_name,
|
||||
char divider = pathDivider();
|
||||
|
||||
size_t div_pos = path_name.rfind(divider);
|
||||
size_t path_end = path_name.size();
|
||||
while (div_pos > 0) {
|
||||
if (div_pos == std::string_view::npos)
|
||||
return;
|
||||
@@ -1642,27 +1633,18 @@ Network::pathNameLast(std::string_view path_name,
|
||||
last = path_name.substr(div_pos + 1);
|
||||
return;
|
||||
}
|
||||
path_end = div_pos - 1;
|
||||
div_pos = path_name.rfind(divider, path_end);
|
||||
div_pos = path_name.rfind(divider, div_pos - 1);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
NetworkEdit::NetworkEdit() :
|
||||
Network()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
NetworkConstantPinIterator::
|
||||
NetworkConstantPinIterator(const Network *network,
|
||||
NetSet &zero_nets,
|
||||
NetSet &one_nets) :
|
||||
ConstantPinIterator(),
|
||||
network_(network),
|
||||
constant_pins_{PinSet(network), PinSet(network)}
|
||||
network_(network)
|
||||
{
|
||||
findConstantPins(zero_nets, constant_pins_[0]);
|
||||
findConstantPins(one_nets, constant_pins_[1]);
|
||||
@@ -1687,7 +1669,7 @@ NetworkConstantPinIterator::findConstantPins(NetSet &nets,
|
||||
bool
|
||||
NetworkConstantPinIterator::hasNext()
|
||||
{
|
||||
if (pin_iter_ != constant_pins_[(int)value_].end())
|
||||
if (pin_iter_ != constant_pins_[static_cast<int>(value_)].end())
|
||||
return true;
|
||||
else if (value_ == LogicValue::zero) {
|
||||
value_ = LogicValue::one;
|
||||
@@ -1818,8 +1800,8 @@ visitPinsBelowNet1(const Pin *hpin,
|
||||
}
|
||||
|
||||
static void
|
||||
visitDrvrLoads(PinSet drvrs,
|
||||
PinSet loads,
|
||||
visitDrvrLoads(PinSet &drvrs,
|
||||
PinSet &loads,
|
||||
HierPinThruVisitor *visitor)
|
||||
{
|
||||
for (const Pin *drvr : drvrs) {
|
||||
@@ -1921,8 +1903,8 @@ visitDrvrLoadsThruNet(const Net *net,
|
||||
char
|
||||
logicValueString(LogicValue value)
|
||||
{
|
||||
static char str[] = "01X^v";
|
||||
return str[int(value)];
|
||||
static char names[] = "01X^v";
|
||||
return names[static_cast<int>(value)];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
@@ -2040,4 +2022,4 @@ NetSet::NetSet(const Network *network) :
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
|
||||
%{
|
||||
#include "Network.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "StringUtil.hh"
|
||||
%}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "StringUtil.hh"
|
||||
#include "Liberty.hh"
|
||||
#include "Network.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
namespace sta {
|
||||
|
||||
@@ -137,4 +137,4 @@ sortByPathName(NetSet *set,
|
||||
return nets;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -90,7 +90,7 @@ parseBusName(std::string_view name,
|
||||
&& left + 1 < len
|
||||
&& isdigit(name[left + 1])) {
|
||||
is_bus = true;
|
||||
bus_name.append(name.data(), left);
|
||||
bus_name.append(name.substr(0, left));
|
||||
// Simple bus subscript.
|
||||
index = std::stoi(std::string(name.substr(left + 1)));
|
||||
}
|
||||
@@ -146,17 +146,17 @@ parseBusName(std::string_view name,
|
||||
&& left + 1 < len
|
||||
&& (isdigit(name[left + 1]) || name[left + 1] == '*')) {
|
||||
is_bus = true;
|
||||
bus_name.append(name.data(), left);
|
||||
if (name[left + 1] == '*')
|
||||
subscript_wild = true;
|
||||
bus_name.append(name.substr(0, left));
|
||||
// Check for bus range.
|
||||
size_t range = name.find(':', left);
|
||||
if (range != std::string_view::npos) {
|
||||
is_range = true;
|
||||
from = std::stoi(std::string(name.substr(left + 1)));
|
||||
to = std::stoi(std::string(name.substr(range + 1)));
|
||||
}
|
||||
else {
|
||||
// Check for bus range.
|
||||
size_t range = name.find(':', left);
|
||||
if (range != std::string_view::npos) {
|
||||
is_range = true;
|
||||
from = std::stoi(std::string(name.substr(left + 1)));
|
||||
to = std::stoi(std::string(name.substr(range + 1)));
|
||||
}
|
||||
if (left + 1 < len && name[left + 1] == '*')
|
||||
subscript_wild = true;
|
||||
else
|
||||
from = to = std::stoi(std::string(name.substr(left + 1)));
|
||||
}
|
||||
@@ -194,4 +194,4 @@ escapeChars(std::string_view token,
|
||||
return escaped;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -76,7 +76,7 @@ PortDirection::destroy()
|
||||
}
|
||||
|
||||
PortDirection::PortDirection(const char *name,
|
||||
int index) :
|
||||
size_t index) :
|
||||
name_(name),
|
||||
index_(index)
|
||||
{
|
||||
@@ -135,4 +135,4 @@ PortDirection::isPowerGround() const
|
||||
|| this == well_;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -24,14 +24,13 @@
|
||||
|
||||
#include "SdcNetwork.hh"
|
||||
|
||||
#include "StringUtil.hh"
|
||||
#include "PatternMatch.hh"
|
||||
#include "ParseBus.hh"
|
||||
#include "PatternMatch.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
namespace sta {
|
||||
|
||||
NetworkNameAdapter::NetworkNameAdapter(Network *network) :
|
||||
NetworkEdit(),
|
||||
network_(network),
|
||||
network_edit_(dynamic_cast<NetworkEdit*>(network))
|
||||
{
|
||||
@@ -822,9 +821,8 @@ SdcNetwork::findInstancesMatching1(const Instance *context,
|
||||
InstanceSeq &matches) const
|
||||
{
|
||||
visitMatches(context, pattern,
|
||||
[&](const Instance *instance,
|
||||
const PatternMatch *tail)
|
||||
{
|
||||
[&] (const Instance *instance,
|
||||
const PatternMatch *tail) {
|
||||
size_t match_count = matches.size();
|
||||
network_->findChildrenMatching(instance, tail, matches);
|
||||
return matches.size() != match_count;
|
||||
@@ -1193,7 +1191,7 @@ SdcNetwork::visitMatches(const Instance *parent,
|
||||
const PatternMatch *pattern,
|
||||
const std::function<bool (const Instance *instance,
|
||||
const PatternMatch *tail)>
|
||||
visit_tail) const
|
||||
&visit_tail) const
|
||||
{
|
||||
int divider_count, path_length;
|
||||
scanPath(pattern->pattern(), divider_count, path_length);
|
||||
@@ -1271,4 +1269,4 @@ escapeBrackets(std::string_view name,
|
||||
return escapeChars(name, '[', ']', network->pathEscape());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
#include <cctype>
|
||||
|
||||
#include "StringUtil.hh"
|
||||
#include "ParseBus.hh"
|
||||
#include "StringUtil.hh"
|
||||
|
||||
namespace sta {
|
||||
|
||||
@@ -38,7 +38,7 @@ staToVerilog(std::string_view sta_name);
|
||||
static std::string
|
||||
staToVerilog2(std::string_view sta_name);
|
||||
static std::string
|
||||
verilogToSta(const std::string_view verilog_name);
|
||||
verilogToSta(std::string_view verilog_name);
|
||||
|
||||
std::string
|
||||
cellVerilogName(std::string_view sta_name)
|
||||
@@ -219,4 +219,4 @@ verilogToSta(std::string_view verilog_name)
|
||||
return std::string(verilog_name);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace sta
|
||||
|
||||
Reference in New Issue
Block a user