define_scene use filename or library name resolves #386

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2026-02-25 07:29:18 -08:00
parent 79ebc3469b
commit d1bfb1df2e
7 changed files with 1326 additions and 1323 deletions

View File

@ -3,6 +3,13 @@ OpenSTA Timing Analyzer Release Notes
This file summarizes user visible changes for each release. This file summarizes user visible changes for each release.
2025/02/24
----------
The define_scene -library argument now takes a the library name or a
library filename. If a filename is used, it must be the same as the
filename used to read the library with read_liberty.
Release 3.0.0 2025/11/26 Release 3.0.0 2025/11/26
------------------------ ------------------------

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -9,9 +9,9 @@ set_timing_derate -late 1.1
create_clock -name clk -period 10 {clk1 clk2 clk3} create_clock -name clk -period 10 {clk1 clk2 clk3}
set_input_delay -clock clk 0 {in1 in2} set_input_delay -clock clk 0 {in1 in2}
define_scene ss -liberty nangate45_slow define_scene ss -liberty NangateOpenCellLibrary_slow
define_scene tt -liberty nangate45_typ define_scene tt -liberty NangateOpenCellLibrary
define_scene ff -liberty nangate45_fast define_scene ff -liberty NangateOpenCellLibrary_fast
# report all scenes # report all scenes
report_checks -path_delay min_max report_checks -path_delay min_max

View File

@ -1591,9 +1591,8 @@ protected:
void setThreadCount1(int thread_count); void setThreadCount1(int thread_count);
void updateLibertyScenes(); void updateLibertyScenes();
void updateSceneLiberty(Scene *scene, void updateSceneLiberty(Scene *scene,
const StdStringSeq &liberty_files, const StdStringSeq &liberty_min_files,
const MinMax *min_max); const StdStringSeq &liberty_max_files);
LibertyLibrary *findLibertyFileBasename(const std::string &filename) const;
Scene *makeScene(const std::string &name, Scene *makeScene(const std::string &name,
Mode *mode, Mode *mode,

View File

@ -208,7 +208,6 @@ Network::checkNetworkLibertyScenes()
} }
} }
// Only used by Sta::setMinLibrary so linear search is acceptable.
LibertyLibrary * LibertyLibrary *
Network::findLibertyFilename(const char *filename) Network::findLibertyFilename(const char *filename)
{ {

View File

@ -2517,8 +2517,7 @@ Sta::makeScene(const std::string &name,
updateComponentsState(); updateComponentsState();
if (graph_) if (graph_)
graph_->makeSceneAfter(); graph_->makeSceneAfter();
updateSceneLiberty(scene, liberty_min_files, MinMax::min()); updateSceneLiberty(scene, liberty_min_files, liberty_max_files);
updateSceneLiberty(scene, liberty_max_files, MinMax::max());
cmd_scene_ = scene; cmd_scene_ = scene;
} }
else else
@ -2601,34 +2600,27 @@ Sta::findScenes(const std::string &name,
void void
Sta::updateSceneLiberty(Scene *scene, Sta::updateSceneLiberty(Scene *scene,
const StdStringSeq &liberty_files, const StdStringSeq &liberty_min_files,
const MinMax *min_max) const StdStringSeq &liberty_max_files)
{ {
StdStringSet warned_files;
for (const MinMax *min_max : MinMax::range()) {
const StdStringSeq &liberty_files = min_max == MinMax::min()
? liberty_min_files
: liberty_max_files;
for (const std::string &lib_file : liberty_files) { for (const std::string &lib_file : liberty_files) {
LibertyLibrary *lib = findLibertyFileBasename(lib_file); LibertyLibrary *lib = network_->findLiberty(lib_file.c_str());
if (lib == nullptr)
lib = network_->findLibertyFilename(lib_file.c_str());
if (lib) if (lib)
LibertyLibrary::makeSceneMap(lib, scene->libertyIndex(min_max), LibertyLibrary::makeSceneMap(lib, scene->libertyIndex(min_max),
network_, report_); network_, report_);
else else if (!warned_files.contains(lib_file)) {
report_->warn(1555, "liberty filename %s not found.", lib_file.c_str()); report_->warn(1555, "liberty name/filename %s not found.", lib_file.c_str());
} warned_files.insert(lib_file);
} }
LibertyLibrary *
Sta::findLibertyFileBasename(const std::string &filename) const
{
LibertyLibraryIterator *lib_iter = network_->libertyLibraryIterator();
while (lib_iter->hasNext()) {
LibertyLibrary *lib = lib_iter->next();
auto lib_file = std::filesystem::path(lib->filename()).filename().stem();
auto stem = lib_file.stem();
if (stem.string() == filename) {
delete lib_iter;
return lib;
} }
} }
delete lib_iter;
return nullptr;
} }
void void