makeSceneMap rm dup warnings

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2026-04-18 08:45:04 -07:00
parent 48febcf785
commit 668cfb26af
4 changed files with 61 additions and 66 deletions

View File

@ -374,19 +374,15 @@ public:
static void
makeSceneMap(LibertyLibrary *lib,
size_t lib_ap_index,
Scene *scene,
const MinMaxAll *min_max,
Network *network,
Report *report);
static void
makeSceneMap(LibertyCell *link_cell,
LibertyCell *scene_cell,
size_t lib_ap_index,
Report *report);
static void
makeSceneMap(LibertyCell *cell1,
LibertyCell *cell2,
bool link,
size_t lib_ap_index,
Scene *scene,
const MinMaxAll *min_max,
Report *report);
static void
checkScenes(LibertyCell *cell,

View File

@ -154,7 +154,7 @@ public:
// tmp public
void readLibertyAfter(LibertyLibrary *liberty,
Scene *scene,
const MinMax *min_max);
const MinMaxAll *min_max);
bool readVerilog(std::string_view filename);
// Network readers call this to notify the Sta to delete any previously
// linked network.
@ -1597,6 +1597,9 @@ protected:
void updateSceneLiberty(Scene *scene,
const StringSeq &liberty_min_files,
const StringSeq &liberty_max_files);
void updateSceneLiberty(Scene *scene,
const StringSeq &liberty_files,
const MinMaxAll *min_max);
Scene *makeScene(const std::string &name,
Mode *mode,

View File

@ -707,7 +707,8 @@ LibertyLibrary::makeScaledCell(std::string_view name,
void
LibertyLibrary::makeSceneMap(LibertyLibrary *lib,
size_t lib_ap_index,
Scene *scene,
const MinMaxAll *min_max,
Network *network,
Report *report)
{
@ -716,38 +717,33 @@ LibertyLibrary::makeSceneMap(LibertyLibrary *lib,
LibertyCell *cell = cell_iter.next();
LibertyCell *link_cell = network->findLibertyCell(cell->name());
if (link_cell)
makeSceneMap(link_cell, cell, lib_ap_index, report);
makeSceneMap(link_cell, cell, scene, min_max, report);
}
}
// Map a cell linked in the network to the corresponding liberty cell
// to use for delay calculation at a scene.
void
LibertyLibrary::makeSceneMap(LibertyCell *link_cell,
LibertyCell *scene_cell,
size_t lib_ap_index,
Report *report)
{
link_cell->setSceneCell(scene_cell, lib_ap_index);
makeSceneMap(link_cell, scene_cell, true, lib_ap_index, report);
// Check for brain damage in the other direction.
makeSceneMap(scene_cell, link_cell, false, lib_ap_index, report);
}
void
LibertyLibrary::makeSceneMap(LibertyCell *cell1,
LibertyCell *cell2,
bool link,
size_t lib_ap_index,
Scene *scene,
const MinMaxAll *min_max,
Report *report)
{
for (const MinMax *mm : min_max->range()) {
size_t lib_ap_index = scene->libertyIndex(mm);
cell1->setSceneCell(cell2, lib_ap_index);
}
LibertyCellPortBitIterator port_iter1(cell1);
while (port_iter1.hasNext()) {
LibertyPort *port1 = port_iter1.next();
LibertyPort *port2 = cell2->findLibertyPort(port1->name());
if (port2) {
if (link)
for (const MinMax *mm : min_max->range()) {
size_t lib_ap_index = scene->libertyIndex(mm);
port1->setScenePort(port2, lib_ap_index);
}
}
else
report->warn(1110, "cell {}/{} port {} not found in cell {}/{}.",
@ -761,17 +757,19 @@ LibertyLibrary::makeSceneMap(LibertyCell *cell1,
for (TimingArcSet *arc_set1 : cell1->timing_arc_sets_) {
TimingArcSet *arc_set2 = cell2->findTimingArcSet(arc_set1);
if (arc_set2) {
if (link) {
const TimingArcSeq &arcs1 = arc_set1->arcs();
const TimingArcSeq &arcs2 = arc_set2->arcs();
auto arc_itr1 = arcs1.begin(), arc_itr2 = arcs2.begin();
for (;
arc_itr1 != arcs1.end() && arc_itr2 != arcs2.end();
arc_itr1++, arc_itr2++) {
TimingArc *arc1 = *arc_itr1;
TimingArc *arc2 = *arc_itr2;
if (TimingArc::equiv(arc1, arc2))
const TimingArcSeq &arcs1 = arc_set1->arcs();
const TimingArcSeq &arcs2 = arc_set2->arcs();
auto arc_itr1 = arcs1.begin(), arc_itr2 = arcs2.begin();
for (;
arc_itr1 != arcs1.end() && arc_itr2 != arcs2.end();
arc_itr1++, arc_itr2++) {
TimingArc *arc1 = *arc_itr1;
TimingArc *arc2 = *arc_itr2;
if (TimingArc::equiv(arc1, arc2)) {
for (const MinMax *mm : min_max->range()) {
size_t lib_ap_index = scene->libertyIndex(mm);
arc1->setSceneArc(arc2, lib_ap_index);
}
}
}
}

View File

@ -713,12 +713,7 @@ Sta::readLibertyFile(std::string_view filename,
if (liberty) {
// Don't map liberty cells if they are redefined by reading another
// library with the same cell names.
if (min_max == MinMaxAll::all()) {
readLibertyAfter(liberty, scene, MinMax::min());
readLibertyAfter(liberty, scene, MinMax::max());
}
else
readLibertyAfter(liberty, scene, min_max->asMinMax());
readLibertyAfter(liberty, scene, min_max);
network_->readLibertyAfter(liberty);
}
return liberty;
@ -727,11 +722,11 @@ Sta::readLibertyFile(std::string_view filename,
void
Sta::readLibertyAfter(LibertyLibrary *liberty,
Scene *scene,
const MinMax *min_max)
const MinMaxAll *min_max)
{
scene->addLiberty(liberty, min_max);
LibertyLibrary::makeSceneMap(liberty, scene->libertyIndex(min_max), network_,
report_);
for (const MinMax *mm : min_max->range())
scene->addLiberty(liberty, mm);
LibertyLibrary::makeSceneMap(liberty, scene, min_max, network_, report_);
}
bool
@ -2624,22 +2619,27 @@ Sta::updateSceneLiberty(Scene *scene,
const StringSeq &liberty_min_files,
const StringSeq &liberty_max_files)
{
StringSet warned_files;
for (const MinMax *min_max : MinMax::range()) {
const StringSeq &liberty_files =
min_max == MinMax::min() ? liberty_min_files : liberty_max_files;
for (const std::string &lib_file : liberty_files) {
LibertyLibrary *lib = network_->findLiberty(lib_file);
if (lib == nullptr)
lib = network_->findLibertyFilename(lib_file);
if (lib)
LibertyLibrary::makeSceneMap(lib, scene->libertyIndex(min_max), network_,
report_);
else if (!warned_files.contains(lib_file)) {
report_->warn(1555, "liberty name/filename {} not found.", lib_file);
warned_files.insert(lib_file);
}
}
if (liberty_min_files == liberty_max_files)
updateSceneLiberty(scene, liberty_max_files, MinMaxAll::minMax());
else {
updateSceneLiberty(scene, liberty_min_files, MinMaxAll::min());
updateSceneLiberty(scene, liberty_max_files, MinMaxAll::max());
}
}
void
Sta::updateSceneLiberty(Scene *scene,
const StringSeq &liberty_files,
const MinMaxAll *min_max)
{
for (const std::string &lib_file : liberty_files) {
LibertyLibrary *lib = network_->findLiberty(lib_file);
if (lib == nullptr)
lib = network_->findLibertyFilename(lib_file);
if (lib)
LibertyLibrary::makeSceneMap(lib, scene, min_max, network_, report_);
else
report_->warn(1555, "liberty name/filename {} not found.", lib_file);
}
}
@ -2650,10 +2650,8 @@ Sta::updateLibertyScenes()
LibertyLibraryIterator *iter = network_->libertyLibraryIterator();
while (iter->hasNext()) {
LibertyLibrary *lib = iter->next();
for (const MinMax *min_max : MinMax::range()) {
LibertyLibrary::makeSceneMap(lib, scene->libertyIndex(min_max), network_,
report_);
}
LibertyLibrary::makeSceneMap(lib, scene, MinMaxAll::minMax(),
network_, report_);
}
}
}