11// OpenSTA, Static Timing Analyzer
22// Copyright (c) 2026, Parallax Software, Inc.
3- //
3+ //
44// This program is free software: you can redistribute it and/or modify
55// it under the terms of the GNU General Public License as published by
66// the Free Software Foundation, either version 3 of the License, or
77// (at your option) any later version.
8- //
8+ //
99// This program is distributed in the hope that it will be useful,
1010// but WITHOUT ANY WARRANTY; without even the implied warranty of
1111// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212// GNU General Public License for more details.
13- //
13+ //
1414// You should have received a copy of the GNU General Public License
1515// along with this program. If not, see <https://www.gnu.org/licenses/>.
16- //
16+ //
1717// The origin of this software must not be misrepresented; you must not
1818// claim that you wrote the original software.
19- //
19+ //
2020// Altered source versions must be plainly marked as such, and must not be
2121// misrepresented as being the original software.
22- //
22+ //
2323// This notice may not be removed or altered from any source distribution.
2424
2525#pragma once
2626
27+ #include < iosfwd>
2728#include < map>
2829#include < string>
2930#include < string_view>
@@ -76,19 +77,20 @@ class StaSimObserver;
7677class LevelizeObserver ;
7778class GraphLoop ;
7879
79- using ModeNameMap = std::map<std::string, Mode*, std::less<>>;
80- using SceneNameMap = std::map<std::string, Scene*>;
81- using SlowDrvrIterator = Iterator<Instance*>;
80+ using ModeNameMap = std::map<std::string, Mode *, std::less<>>;
81+ using SceneNameMap = std::map<std::string, Scene *>;
82+ using SlowDrvrIterator = Iterator<Instance *>;
8283using CheckError = StringSeq;
83- using CheckErrorSeq = std::vector<CheckError*>;
84+ using CheckErrorSeq = std::vector<CheckError *>;
8485enum class CmdNamespace { sta, sdc };
85- using ParasiticsNameMap = std::map<std::string, Parasitics*, std::less<>>;
86- using GraphLoopSeq = std::vector<GraphLoop*>;
87- using ReportFieldGetValue = std::function<std::string ( const Path *path,
88- const StaState *sta)>;
86+ using ParasiticsNameMap = std::map<std::string, Parasitics *, std::less<>>;
87+ using GraphLoopSeq = std::vector<GraphLoop *>;
88+ using ReportFieldGetValue =
89+ std::function<std::string( const Path *path, const StaState *sta)>;
8990
9091// Initialize sta functions that are not part of the Sta class.
91- void initSta ();
92+ void
93+ initSta ();
9294
9395// Call before exit to make leak detection simpler for purify and valgrind.
9496void
@@ -148,10 +150,25 @@ public:
148150 ModeSeq findModes (const std::string &mode_name) const ;
149151 Sdc *cmdSdc () const ;
150152
153+ // Parse a Liberty file from a file.
154+ //
155+ // filename should be the path to the file, if ZLIB is included it may be
156+ // either compressed or uncompressed.
151157 virtual LibertyLibrary *readLiberty (std::string_view filename,
152158 Scene *scene,
153159 const MinMaxAll *min_max,
154160 bool infer_latches);
161+ // Read a Liberty file from an input stream.
162+ //
163+ // filename is used only as a label in diagnostic messages; it may but need
164+ // not correspond to a file on disk.
165+ //
166+ // The input stream should provide uncompressed text.
167+ virtual LibertyLibrary *readLiberty (std::istream &stream,
168+ std::string_view filename,
169+ Scene *scene,
170+ const MinMaxAll *min_max,
171+ bool infer_latches);
155172 // tmp public
156173 void readLibertyAfter (LibertyLibrary *liberty,
157174 Scene *scene,
@@ -602,9 +619,9 @@ public:
602619 float delay,
603620 Sdc *sdc);
604621 void removeInputDelay (const Pin *pin,
605- const RiseFallBoth *rf,
622+ const RiseFallBoth *rf,
606623 const Clock *clk,
607- const RiseFall *clk_rf,
624+ const RiseFall *clk_rf,
608625 const MinMaxAll *min_max,
609626 Sdc *sdc);
610627 void setOutputDelay (const Pin *pin,
@@ -619,9 +636,9 @@ public:
619636 float delay,
620637 Sdc *sdc);
621638 void removeOutputDelay (const Pin *pin,
622- const RiseFallBoth *rf,
639+ const RiseFallBoth *rf,
623640 const Clock *clk,
624- const RiseFall *clk_rf,
641+ const RiseFall *clk_rf,
625642 const MinMaxAll *min_max,
626643 Sdc *sdc);
627644 void makeFalsePath (ExceptionFrom *from,
@@ -656,7 +673,7 @@ public:
656673 Sdc *sdc);
657674 // Deprecated 10/24/2025
658675 bool isGroupPathName (std::string_view group_name,
659- const Sdc *sdc) __attribute__ ((deprecated));
676+ const Sdc *sdc) __attribute__((deprecated));
660677 bool isPathGroupName (std::string_view group_name,
661678 const Sdc *sdc) const ;
662679 StringSeq pathGroupNames (const Sdc *sdc) const ;
@@ -729,33 +746,30 @@ public:
729746 bool thru_disabled,
730747 bool thru_constants,
731748 const Mode *mode);
732- InstanceSet
733- findFaninInstances (PinSeq *to,
734- bool flat,
735- bool startpoints_only,
736- int inst_levels,
737- int pin_levels,
738- bool thru_disabled,
739- bool thru_constants,
740- const Mode *mode);
741- PinSet
742- findFanoutPins (PinSeq *from,
743- bool flat,
744- bool endpoints_only,
745- int inst_levels,
746- int pin_levels,
747- bool thru_disabled,
748- bool thru_constants,
749- const Mode *mode);
750- InstanceSet
751- findFanoutInstances (PinSeq *from,
752- bool flat,
753- bool endpoints_only,
754- int inst_levels,
755- int pin_levels,
756- bool thru_disabled,
757- bool thru_constants,
758- const Mode *mode);
749+ InstanceSet findFaninInstances (PinSeq *to,
750+ bool flat,
751+ bool startpoints_only,
752+ int inst_levels,
753+ int pin_levels,
754+ bool thru_disabled,
755+ bool thru_constants,
756+ const Mode *mode);
757+ PinSet findFanoutPins (PinSeq *from,
758+ bool flat,
759+ bool endpoints_only,
760+ int inst_levels,
761+ int pin_levels,
762+ bool thru_disabled,
763+ bool thru_constants,
764+ const Mode *mode);
765+ InstanceSet findFanoutInstances (PinSeq *from,
766+ bool flat,
767+ bool endpoints_only,
768+ int inst_levels,
769+ int pin_levels,
770+ bool thru_disabled,
771+ bool thru_constants,
772+ const Mode *mode);
759773
760774 // The set of clocks that arrive at vertex in the clock network.
761775 ClockSet clocks (const Pin *pin,
@@ -784,11 +798,11 @@ public:
784798 float &slack,
785799 const RiseFall *&rf,
786800 const Scene *&Scene);
787- void maxSlewCheck (// Return values.
788- const Pin *&pin,
789- Slew &slew,
790- float &slack,
791- float &limit);
801+ void maxSlewCheck ( // Return values.
802+ const Pin *&pin,
803+ Slew &slew,
804+ float &slack,
805+ float &limit);
792806 void findSlewLimit (const LibertyPort *port,
793807 const Scene *scene,
794808 const MinMax *min_max,
@@ -845,11 +859,11 @@ public:
845859 float &slack,
846860 const RiseFall *&rf,
847861 const Scene *&scene);
848- void maxCapacitanceCheck (// Return values.
849- const Pin *&pin,
850- float &capacitance,
851- float &slack,
852- float &limit);
862+ void maxCapacitanceCheck ( // Return values.
863+ const Pin *&pin,
864+ float &capacitance,
865+ float &slack,
866+ float &limit);
853867
854868 // //////////////////////////////////////////////////////////////
855869 void reportMinPulseWidthChecks (const Net *net,
@@ -871,7 +885,7 @@ public:
871885 bool violators,
872886 bool verbose,
873887 const SceneSeq &scenes);
874-
888+
875889 // //////////////////////////////////////////////////////////////
876890 // User visible but non SDC commands.
877891
@@ -1188,7 +1202,7 @@ public:
11881202 TagGroupIndex tagGroupCount () const ;
11891203 int clkInfoCount () const ;
11901204 int pathCount () const ;
1191- int vertexPathCount (Vertex *vertex) const ;
1205+ int vertexPathCount (Vertex *vertex) const ;
11921206 Vertex *maxPathCountVertex () const ;
11931207
11941208 // Propagate liberty constant functions and pins tied high/low through
@@ -1498,7 +1512,7 @@ protected:
14981512 virtual void makeArcDelayCalc ();
14991513 virtual void makeGraphDelayCalc ();
15001514 virtual void makeSearch ();
1501- virtual void makeLatches ();
1515+ virtual void makeLatches ();
15021516 virtual void makeCheckTiming ();
15031517 virtual void makeCheckSlews ();
15041518 virtual void makeCheckFanouts ();
@@ -1516,6 +1530,11 @@ protected:
15161530 Scene *scene,
15171531 const MinMaxAll *min_max,
15181532 bool infer_latches);
1533+ LibertyLibrary *readLibertyFile (std::istream &stream,
1534+ std::string_view filename,
1535+ Scene *scene,
1536+ const MinMaxAll *min_max,
1537+ bool infer_latches);
15191538 void delayCalcPreamble ();
15201539 void delaysInvalidFrom (const Port *port);
15211540 void delaysInvalidFromFanin (const Port *port);
@@ -1596,7 +1615,7 @@ protected:
15961615 SearchPred *pred,
15971616 int inst_level,
15981617 int pin_level,
1599- const Mode *mode);
1618+ const Mode *mode);
16001619 void findRegisterPreamble (const Mode *mode);
16011620 bool crossesHierarchy (Edge *edge) const ;
16021621 void powerPreamble ();
@@ -1652,4 +1671,4 @@ protected:
16521671 inline static Sta *sta_{nullptr };
16531672};
16541673
1655- } // namespace sta
1674+ } // namespace sta
0 commit comments