@@ -707,6 +707,24 @@ Sta::readLiberty(std::string_view filename,
707707 return library;
708708}
709709
710+ LibertyLibrary* Sta::readLiberty (std::istream& stream,
711+ std::string_view filename, Scene* scene,
712+ const MinMaxAll* min_max, bool infer_latches) {
713+ Stats stats (debug_, report_);
714+ LibertyLibrary* library =
715+ readLibertyFile (stream, filename, scene, min_max, infer_latches);
716+ if (library
717+ // The default library is the first library read.
718+ // This corresponds to a link_path of '*'.
719+ && network_->defaultLibertyLibrary () == nullptr ) {
720+ network_->setDefaultLibertyLibrary (library);
721+ // Set units from default (first) library.
722+ *units_ = *library->units ();
723+ }
724+ stats.report (" Read liberty" );
725+ return library;
726+ }
727+
710728LibertyLibrary *
711729Sta::readLibertyFile (std::string_view filename,
712730 Scene *scene,
@@ -723,6 +741,22 @@ Sta::readLibertyFile(std::string_view filename,
723741 return liberty;
724742}
725743
744+
745+ LibertyLibrary* Sta::readLibertyFile (std::istream& stream,
746+ std::string_view filename, Scene* scene,
747+ const MinMaxAll* min_max,
748+ bool infer_latches) {
749+ LibertyLibrary* liberty =
750+ sta::readLibertyFile (stream, filename, infer_latches, network_);
751+ if (liberty) {
752+ // Don't map liberty cells if they are redefined by reading another
753+ // library with the same cell names.
754+ readLibertyAfter (liberty, scene, min_max);
755+ network_->readLibertyAfter (liberty);
756+ }
757+ return liberty;
758+ }
759+
726760void
727761Sta::readLibertyAfter (LibertyLibrary *liberty,
728762 Scene *scene,
0 commit comments