diff --git a/liberty/Liberty.cc b/liberty/Liberty.cc index fb1dcb09..ec9f5aec 100644 --- a/liberty/Liberty.cc +++ b/liberty/Liberty.cc @@ -60,7 +60,7 @@ deleteLiberty() LibertyLibrary::LibertyLibrary(const char *name, const char *filename) : - ConcreteLibrary(name, filename), + ConcreteLibrary(name, filename, true), units_(new Units()), delay_model_type_(DelayModelType::cmos_linear), // default nominal_process_(0.0), @@ -137,7 +137,7 @@ LibertyLibrary::~LibertyLibrary() LibertyCell * LibertyLibrary::findLibertyCell(const char *name) const { - return dynamic_cast(findCell(name)); + return static_cast(findCell(name)); } void @@ -832,7 +832,7 @@ LibertyCellIterator::hasNext() LibertyCell * LibertyCellIterator::next() { - return dynamic_cast(iter_.next()); + return static_cast(iter_.next()); } //////////////////////////////////////////////////////////////// @@ -898,7 +898,7 @@ LibertyCell::deleteTimingArcAttrs() LibertyPort * LibertyCell::findLibertyPort(const char *name) const { - return dynamic_cast(findPort(name)); + return static_cast(findPort(name)); } void @@ -1751,7 +1751,7 @@ LibertyCellPortIterator::hasNext() LibertyPort * LibertyCellPortIterator::next() { - return dynamic_cast(iter_.next()); + return static_cast(iter_.next()); } //////////////////////////////////////////////////////////////// @@ -1775,7 +1775,7 @@ LibertyCellPortBitIterator::hasNext() LibertyPort * LibertyCellPortBitIterator::next() { - return dynamic_cast(iter_->next()); + return static_cast(iter_->next()); } //////////////////////////////////////////////////////////////// @@ -1837,13 +1837,13 @@ LibertyPort::setDirection(PortDirection *dir) LibertyPort * LibertyPort::findLibertyMember(int index) const { - return dynamic_cast(findMember(index)); + return static_cast(findMember(index)); } LibertyPort * LibertyPort::findLibertyBusBit(int index) const { - return dynamic_cast(findBusBit(index)); + return static_cast(findBusBit(index)); } void @@ -2299,7 +2299,7 @@ LibertyPortMemberIterator::hasNext() LibertyPort * LibertyPortMemberIterator::next() { - return dynamic_cast(iter_->next()); + return static_cast(iter_->next()); } //////////////////////////////////////////////////////////////// diff --git a/liberty/Liberty.hh b/liberty/Liberty.hh index 806ffa7a..3b62acc7 100644 --- a/liberty/Liberty.hh +++ b/liberty/Liberty.hh @@ -114,7 +114,7 @@ class LibertyLibrary : public ConcreteLibrary public: LibertyLibrary(const char *name, const char *filename); - virtual ~LibertyLibrary(); + ~LibertyLibrary(); LibertyCell *findLibertyCell(const char *name) const; void findLibertyCellsMatching(PatternMatch *pattern, LibertyCellSeq *cells); @@ -383,7 +383,7 @@ public: LibertyCell(LibertyLibrary *library, const char *name, const char *filename); - virtual ~LibertyCell(); + ~LibertyCell(); LibertyLibrary *libertyLibrary() const { return liberty_library_; } LibertyLibrary *libertyLibrary() { return liberty_library_; } LibertyPort *findLibertyPort(const char *name) const; @@ -471,11 +471,11 @@ public: // Add scaled cell after it is complete. void addScaledCell(OperatingConditions *op_cond, LibertyCell *scaled_cell); - virtual unsigned addTimingArcSet(TimingArcSet *set); + unsigned addTimingArcSet(TimingArcSet *set); void addTimingArcAttrs(TimingArcAttrs *attrs); - virtual void addInternalPower(InternalPower *power); + void addInternalPower(InternalPower *power); void addInternalPowerAttrs(InternalPowerAttrs *attrs); - virtual void addLeakagePower(LeakagePower *power); + void addLeakagePower(LeakagePower *power); void setLeakagePower(float leakage); void setOcvArcDepth(float depth); void setOcvDerate(OcvDerate *derate); @@ -487,9 +487,9 @@ public: void setCornerCell(LibertyCell *corner_cell, int ap_index); // Call after cell is finished being constructed. - virtual void finish(bool infer_latches, - Report *report, - Debug *debug); + void finish(bool infer_latches, + Report *report, + Debug *debug); bool isBuffer() const; // Only valid when isBuffer() returns true. void bufferPorts(// Return values. @@ -497,7 +497,7 @@ public: LibertyPort *&output); protected: - virtual void addPort(ConcretePort *port); + void addPort(ConcretePort *port); void setHasInternalPorts(bool has_internal); void setLibertyLibrary(LibertyLibrary *library); void deleteTimingArcAttrs(); @@ -513,8 +513,8 @@ protected: TimingArcSet *setup_check, Debug *debug); void findDefaultCondArcs(); - virtual void translatePresetClrCheckRoles(); - virtual void inferLatchRoles(Debug *debug); + void translatePresetClrCheckRoles(); + void inferLatchRoles(Debug *debug); void deleteInternalPowerAttrs(); void makeTimingArcMap(Report *report); void makeTimingArcPortMaps(); @@ -750,8 +750,8 @@ protected: int to_index, bool is_bundle, ConcretePortSeq *members); - virtual ~LibertyPort(); - virtual void setDirection(PortDirection *dir); + ~LibertyPort(); + void setDirection(PortDirection *dir); void setMinPort(LibertyPort *min); void addScaledPort(OperatingConditions *op_cond, LibertyPort *scaled_port); diff --git a/liberty/LibertyExt.cc b/liberty/LibertyExt.cc index afdc5d5e..afea8066 100644 --- a/liberty/LibertyExt.cc +++ b/liberty/LibertyExt.cc @@ -19,8 +19,8 @@ // * code is called at the beginning of a library definition // * a string attribute named "thingy" is parsed -#include "Machine.hh" #include +#include "Machine.hh" #include "StringUtil.hh" #include "LibertyReader.hh" #include "LibertyReaderPvt.hh" @@ -222,7 +222,7 @@ BigcoLibertyReader::visitAttr1(LibertyAttr *attr) if (thingy) { printf("Bigco thingy attribute value is %s.\n", thingy); if (cell_) - dynamic_cast(cell_)->setThingy(thingy); + static_cast(cell_)->setThingy(thingy); } } @@ -248,8 +248,6 @@ public: protected: virtual LibertyLibrary *readLibertyFile(const char *filename, bool infer_latches, - Report *report, - Debug *debug, Network *network); }; @@ -262,12 +260,9 @@ BigcoSta::BigcoSta() : LibertyLibrary * Sta::readLibertyFile(const char *filename, bool infer_latches, - Report *report, - Debug *debug, Network *network) { BigcoLibertyBuilder builder; BigcoLibertyReader reader(&builder); - return reader.readLibertyFile(filename, infer_latches, - report, debug, network); + return reader.readLibertyFile(filename, infer_latches, network); } diff --git a/network/ConcreteLibrary.cc b/network/ConcreteLibrary.cc index 91af1998..018e62e8 100644 --- a/network/ConcreteLibrary.cc +++ b/network/ConcreteLibrary.cc @@ -25,9 +25,11 @@ namespace sta { ConcreteLibrary::ConcreteLibrary(const char *name, - const char *filename) : + const char *filename, + bool is_liberty) : name_(stringCopy(name)), filename_(stringCopy(filename)), + is_liberty_(is_liberty), bus_brkt_left_('['), bus_brkt_right_(']') { diff --git a/network/ConcreteLibrary.hh b/network/ConcreteLibrary.hh index 162b8d1a..2d40c8d6 100644 --- a/network/ConcreteLibrary.hh +++ b/network/ConcreteLibrary.hh @@ -48,22 +48,24 @@ class ConcreteLibrary { public: explicit ConcreteLibrary(const char *name, - const char *filename); - virtual ~ConcreteLibrary(); - virtual const char *name() const { return name_; } + const char *filename, + bool is_liberty); + ~ConcreteLibrary(); + const char *name() const { return name_; } void setName(const char *name); - virtual const char *filename() const { return filename_; } + bool isLiberty() const { return is_liberty_; } + const char *filename() const { return filename_; } void addCell(ConcreteCell *cell); - virtual ConcreteCell *makeCell(const char *name, - bool is_leaf, - const char *filename); + ConcreteCell *makeCell(const char *name, + bool is_leaf, + const char *filename); void deleteCell(ConcreteCell *cell); ConcreteLibraryCellIterator *cellIterator() const; - virtual ConcreteCell *findCell(const char *name) const; - virtual void findCellsMatching(const PatternMatch *pattern, - CellSeq *cells) const; - virtual char busBrktLeft() { return bus_brkt_left_; } - virtual char busBrktRight() { return bus_brkt_right_; } + ConcreteCell *findCell(const char *name) const; + void findCellsMatching(const PatternMatch *pattern, + CellSeq *cells) const; + char busBrktLeft() { return bus_brkt_left_; } + char busBrktRight() { return bus_brkt_right_; } void setBusBrkts(char left, char right); @@ -73,6 +75,7 @@ protected: const char *name_; const char *filename_; + bool is_liberty_; char bus_brkt_left_; char bus_brkt_right_; ConcreteCellMap cell_map_; @@ -87,19 +90,19 @@ class ConcreteCell { public: // Use ConcreteLibrary::deleteCell. - virtual ~ConcreteCell(); - virtual ConcreteLibrary *library() const { return library_; } - virtual const char *name() const { return name_; } - virtual const char *filename() const { return filename_; } + ~ConcreteCell(); + ConcreteLibrary *library() const { return library_; } + const char *name() const { return name_; } + const char *filename() const { return filename_; } LibertyCell *libertyCell() const { return liberty_cell_; } void setLibertyCell(LibertyCell *cell); - virtual int portBitCount() const { return port_bit_count_; } - virtual ConcretePort *findPort(const char *name) const; - virtual void findPortsMatching(const PatternMatch *pattern, - PortSeq *ports) const; - virtual ConcreteCellPortIterator *portIterator() const; - virtual ConcreteCellPortBitIterator *portBitIterator() const; - virtual bool isLeaf() const { return is_leaf_; } + int portBitCount() const { return port_bit_count_; } + ConcretePort *findPort(const char *name) const; + void findPortsMatching(const PatternMatch *pattern, + PortSeq *ports) const; + ConcreteCellPortIterator *portIterator() const; + ConcreteCellPortBitIterator *portBitIterator() const; + bool isLeaf() const { return is_leaf_; } void setIsLeaf(bool is_leaf); // Cell acts as port factory. @@ -116,7 +119,7 @@ public: const char bus_brkt_right); size_t portCount() const; void setName(const char *name); - virtual void addPort(ConcretePort *port); + void addPort(ConcretePort *port); void addPortBit(ConcretePort *port); protected: @@ -133,8 +136,8 @@ protected: int from_index, int to_index); // Bus port bit (internal to makeBusPortBits). - virtual ConcretePort *makePort(const char *bit_name, - int bit_index); + ConcretePort *makePort(const char *bit_name, + int bit_index); void makeBusPortBit(ConcretePort *bus_port, const char *name, int index); @@ -161,45 +164,45 @@ private: class ConcretePort { public: - virtual ~ConcretePort(); - virtual const char *name() const { return name_; } - virtual const char *busName() const; - virtual Cell *cell() const; - virtual ConcreteLibrary *library() const { return cell_->library(); } - virtual PortDirection *direction() const { return direction_; } + ~ConcretePort(); + const char *name() const { return name_; } + const char *busName() const; + Cell *cell() const; + ConcreteLibrary *library() const { return cell_->library(); } + PortDirection *direction() const { return direction_; } LibertyPort *libertyPort() { return liberty_port_; } void setLibertyPort(LibertyPort *port); - virtual void setDirection(PortDirection *dir); + void setDirection(PortDirection *dir); // Bundles are groups of related ports that do not use // bus notation. - virtual bool isBundle() const { return is_bundle_; } - virtual bool isBus() const { return is_bus_; } + bool isBundle() const { return is_bundle_; } + bool isBus() const { return is_bus_; } // Index of cell bit ports. // Bus/bundle ports do not have an pin index. - virtual int pinIndex() const { return pin_index_; } + int pinIndex() const { return pin_index_; } void setPinIndex(int index); // Size is the bus/bundle member count (1 for non-bus/bundle ports). - virtual int size() const; - virtual int fromIndex() const { return from_index_; } - virtual int toIndex() const { return to_index_; } + int size() const; + int fromIndex() const { return from_index_; } + int toIndex() const { return to_index_; } // Bus member, bus[subscript]. - virtual ConcretePort *findBusBit(int index) const; + ConcretePort *findBusBit(int index) const; // Predicate to determine if subscript is within bus range. // (toIndex > fromIndex) && fromIndex <= subscript <= toIndex // || (fromIndex > toIndex) && fromIndex >= subscript >= toIndex bool busIndexInRange(int index) const; // A port has members if it is a bundle or bus. bool hasMembers() const; - virtual ConcretePort *findMember(int index) const; - virtual ConcretePortMemberIterator *memberIterator() const; + ConcretePort *findMember(int index) const; + ConcretePortMemberIterator *memberIterator() const; void setBusBitIndex(int index); // Bus bit port functions. // Bus bit is one bit of a bus port. - virtual bool isBusBit() const; + bool isBusBit() const; // Bit index within bus port. // The bit index of A[3] is 3. - virtual int busBitIndex() const { return to_index_; } + int busBitIndex() const { return to_index_; } ConcretePortSeq *memberPorts() const { return member_ports_; } void addPortBit(ConcretePort *port); @@ -208,7 +211,7 @@ protected: ConcretePort(ConcreteCell *cell, const char *name, bool is_bus, - int from_index, + int from_index, int to_index, bool is_bundle, ConcretePortSeq *member_ports); diff --git a/network/ConcreteNetwork.cc b/network/ConcreteNetwork.cc index 2b306e1b..4e872ae3 100644 --- a/network/ConcreteNetwork.cc +++ b/network/ConcreteNetwork.cc @@ -387,10 +387,12 @@ ConcreteLibertyLibraryIterator::findNext() next_ = nullptr; while (iter_.hasNext()) { ConcreteLibrary *lib = iter_.next(); - LibertyLibrary *liberty = dynamic_cast(lib); - if (liberty) { - next_ = liberty; - break; + if (lib->isLiberty()) { + LibertyLibrary *liberty = static_cast(lib); + if (liberty) { + next_ = liberty; + break; + } } } } @@ -407,7 +409,7 @@ Library * ConcreteNetwork::makeLibrary(const char *name, const char *filename) { - ConcreteLibrary *library = new ConcreteLibrary(name, filename); + ConcreteLibrary *library = new ConcreteLibrary(name, filename, false); addLibrary(library); return reinterpret_cast(library); } @@ -454,14 +456,14 @@ LibertyLibrary * ConcreteNetwork::findLiberty(const char *name) { ConcreteLibrary *lib = library_map_.findKey(name); - return dynamic_cast(lib); + return static_cast(lib); } LibertyLibrary * ConcreteNetwork::libertyLibrary(Library *library) const { - ConcreteLibrary *lib = reinterpret_cast(library); - return dynamic_cast(lib); + ConcreteLibrary *lib = reinterpret_cast(library); + return static_cast(lib); } Cell * diff --git a/network/ConcreteNetwork.hh b/network/ConcreteNetwork.hh index 0bbc0ba2..5f7d49d5 100644 --- a/network/ConcreteNetwork.hh +++ b/network/ConcreteNetwork.hh @@ -381,7 +381,7 @@ protected: DISALLOW_COPY_AND_ASSIGN(ConcreteNet); ConcreteNet(const char *name, ConcreteInstance *instance); - virtual ~ConcreteNet(); + ~ConcreteNet(); private: const char *name_; diff --git a/tcl/Sdc.tcl b/tcl/Sdc.tcl index f0094b9a..777e4daa 100644 --- a/tcl/Sdc.tcl +++ b/tcl/Sdc.tcl @@ -579,10 +579,11 @@ proc get_lib_cells { args } { $regexp $nocase] if {$matches != {}} { set cells [concat $cells $matches] - } else { - if {!$quiet} { - sta_warn "cell '$cell_pattern' not found." - } + } + } + if { $cells == {} } { + if {!$quiet} { + sta_warn "cell '$cell_pattern' not found." } } }