Skip to content

Commit e5abfab

Browse files
authored
Merge pull request The-OpenROAD-Project#9498 from The-OpenROAD-Project-staging/sta-mcmm
Update to build with multi-mode STA
2 parents 81a44e8 + 7e1659b commit e5abfab

File tree

178 files changed

+9368
-9546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+9368
-9546
lines changed

include/ord/Timing.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class dbNet;
2222

2323
namespace sta {
2424
class dbSta;
25-
class Corner;
25+
class Scene;
2626
class LibertyCell;
2727
class Network;
2828
class Sta;
@@ -67,17 +67,17 @@ class Timing
6767
bool isEndpoint(odb::dbITerm* db_pin);
6868
bool isEndpoint(odb::dbBTerm* db_pin);
6969

70-
float getNetCap(odb::dbNet* net, sta::Corner* corner, MinMax minmax);
71-
float getPortCap(odb::dbITerm* pin, sta::Corner* corner, MinMax minmax);
70+
float getNetCap(odb::dbNet* net, sta::Scene* corner, MinMax minmax);
71+
float getPortCap(odb::dbITerm* pin, sta::Scene* corner, MinMax minmax);
7272
float getMaxCapLimit(odb::dbMTerm* pin);
7373
float getMaxSlewLimit(odb::dbMTerm* pin);
74-
float staticPower(odb::dbInst* inst, sta::Corner* corner);
75-
float dynamicPower(odb::dbInst* inst, sta::Corner* corner);
74+
float staticPower(odb::dbInst* inst, sta::Scene* corner);
75+
float dynamicPower(odb::dbInst* inst, sta::Scene* corner);
7676

7777
std::vector<odb::dbMTerm*> getTimingFanoutFrom(odb::dbMTerm* input);
78-
std::vector<sta::Corner*> getCorners();
79-
sta::Corner* cmdCorner();
80-
sta::Corner* findCorner(const char* name);
78+
std::vector<sta::Scene*> getCorners();
79+
sta::Scene* cmdCorner();
80+
sta::Scene* findCorner(const char* name);
8181

8282
void makeEquivCells();
8383
std::vector<odb::dbMaster*> equivCells(odb::dbMaster* master);

src/Metrics.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ proc report_erc_metrics { } {
161161
define_cmd_args "report_power_metric" {[-corner corner_name]}
162162
proc report_power_metric { args } {
163163
parse_key_args "report_power_metric" args keys {-corner} flags {}
164-
set corner [sta::parse_corner keys]
164+
set corner [sta::parse_scene keys]
165165
set power_result [design_power $corner]
166166
set totals [lrange $power_result 0 3]
167167
lassign $totals design_internal design_switching design_leakage design_total

src/OpenRoad-py.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ get_db_block();
4747

4848
%}
4949

50-
%template(Corners) std::vector<sta::Corner*>;
50+
%template(Corners) std::vector<sta::Scene*>;
5151
%template(MTerms) std::vector<odb::dbMTerm*>;
5252
%template(Masters) std::vector<odb::dbMaster*>;
5353

src/OpenRoad.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,10 @@ void OpenRoad::setThreadCount(int threads, bool print_info)
661661
}
662662

663663
// place limits on tools with threads
664-
sta_->setThreadCount(threads_);
664+
// sta_->setThreadCount(threads_);
665+
666+
// Temporary until some issues can be resolved related to multi-mode.
667+
sta_->setThreadCount(1);
665668
}
666669

667670
void OpenRoad::setThreadCount(const char* threads, bool print_info)

src/Tech.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#include "db_sta/dbSta.hh"
1010
#include "odb/db.h"
1111
#include "ord/OpenRoad.hh"
12-
#include "sta/Corner.hh"
1312
#include "sta/Liberty.hh"
1413
#include "sta/MinMax.hh"
14+
#include "sta/Scene.hh"
1515
#include "sta/Units.hh"
1616
#include "tcl.h"
1717

@@ -73,7 +73,7 @@ void Tech::readLiberty(const std::string& file_name)
7373
{
7474
// TODO: take corner & min/max args
7575
getSta()->readLiberty(file_name.c_str(),
76-
getSta()->cmdCorner(),
76+
getSta()->cmdScene(),
7777
sta::MinMaxAll::all(),
7878
true /* infer_latches */);
7979
}

src/Timing.cc

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
#include "ord/Tech.h"
1919
#include "rsz/Resizer.hh"
2020
#include "sta/Clock.hh"
21-
#include "sta/Corner.hh"
2221
#include "sta/DelayFloat.hh"
2322
#include "sta/Graph.hh"
2423
#include "sta/Liberty.hh"
2524
#include "sta/LibertyClass.hh"
2625
#include "sta/MinMax.hh"
26+
#include "sta/Mode.hh"
2727
#include "sta/PowerClass.hh"
28+
#include "sta/Scene.hh"
2829
#include "sta/SdcClass.hh"
2930
#include "sta/Search.hh"
3031
#include "sta/TimingArc.hh"
@@ -79,15 +80,8 @@ bool Timing::isEndpoint(sta::Pin* sta_pin)
7980
float Timing::slewAllCorners(sta::Vertex* vertex, const sta::MinMax* minmax)
8081
{
8182
auto sta = getSta();
82-
bool max = (minmax == sta::MinMax::max());
83-
float slew = (max) ? -sta::INF : sta::INF;
84-
float slew_corner;
85-
for (auto corner : getCorners()) {
86-
slew_corner = sta::delayAsFloat(
87-
sta->vertexSlew(vertex, sta::RiseFall::rise(), corner, minmax));
88-
slew = (max) ? std::max(slew, slew_corner) : std::min(slew, slew_corner);
89-
}
90-
return slew;
83+
return sta::delayAsFloat(
84+
sta->slew(vertex, sta::RiseFallBoth::riseFall(), sta->scenes(), minmax));
9185
}
9286

9387
float Timing::getPinSlew(odb::dbITerm* db_pin, MinMax minmax)
@@ -145,24 +139,6 @@ std::array<sta::Vertex*, 2> Timing::vertices(const sta::Pin* pin)
145139
return vertices;
146140
}
147141

148-
std::vector<float> Timing::arrivalsClk(const sta::RiseFall* rf,
149-
sta::Clock* clk,
150-
const sta::RiseFall* clk_rf,
151-
sta::Vertex* vertex)
152-
{
153-
auto sta = getSta();
154-
std::vector<float> arrivals;
155-
const sta::ClockEdge* clk_edge = nullptr;
156-
if (clk) {
157-
clk_edge = clk->edge(clk_rf);
158-
}
159-
for (auto path_ap : sta->corners()->pathAnalysisPts()) {
160-
arrivals.push_back(sta::delayAsFloat(
161-
sta->vertexArrival(vertex, rf, clk_edge, path_ap, nullptr)));
162-
}
163-
return arrivals;
164-
}
165-
166142
bool Timing::isTimeInf(float time)
167143
{
168144
return (time > 1e+10 || time < -1e+10);
@@ -171,16 +147,15 @@ bool Timing::isTimeInf(float time)
171147
float Timing::getPinArrivalTime(sta::Clock* clk,
172148
const sta::RiseFall* clk_rf,
173149
sta::Vertex* vertex,
174-
const sta::RiseFall* arrive_hold)
150+
const sta::RiseFall* rf)
175151
{
176-
std::vector<float> times = arrivalsClk(arrive_hold, clk, clk_rf, vertex);
177-
float delay = -sta::INF;
178-
for (float delay_time : times) {
179-
if (!isTimeInf(delay_time)) {
180-
delay = std::max(delay, delay_time);
181-
}
152+
sta::dbSta* sta = getSta();
153+
if (clk) {
154+
return sta::delayAsFloat(sta->arrival(
155+
vertex, rf, clk->edge(clk_rf), sta->scenes(), sta::MinMax::max()));
182156
}
183-
return delay;
157+
return sta::delayAsFloat(sta->arrival(
158+
vertex, rf->asRiseFallBoth(), sta->scenes(), sta::MinMax::max()));
184159
}
185160

186161
sta::ClockSeq Timing::findClocksMatching(const char* pattern,
@@ -190,7 +165,7 @@ sta::ClockSeq Timing::findClocksMatching(const char* pattern,
190165
auto sta = getSta();
191166
cmdLinkedNetwork();
192167
sta::PatternMatch matcher(pattern, regexp, nocase, sta->tclInterp());
193-
return sta->sdc()->findClocksMatching(&matcher);
168+
return sta->cmdMode()->sdc()->findClocksMatching(&matcher);
194169
}
195170

196171
float Timing::getPinArrival(odb::dbITerm* db_pin, RiseFall rf, MinMax minmax)
@@ -212,7 +187,8 @@ float Timing::getPinArrival(sta::Pin* sta_pin, RiseFall rf, MinMax minmax)
212187
auto vertex_array = vertices(sta_pin);
213188
float delay = (minmax == Max) ? -sta::INF : sta::INF;
214189
float d1, d2;
215-
sta::Clock* default_arrival_clock = getSta()->sdc()->defaultArrivalClock();
190+
sta::Clock* default_arrival_clock
191+
= getSta()->cmdMode()->sdc()->defaultArrivalClock();
216192
for (auto vertex : vertex_array) {
217193
if (vertex == nullptr) {
218194
continue;
@@ -234,21 +210,21 @@ float Timing::getPinArrival(sta::Pin* sta_pin, RiseFall rf, MinMax minmax)
234210
return delay;
235211
}
236212

237-
std::vector<sta::Corner*> Timing::getCorners()
213+
std::vector<sta::Scene*> Timing::getCorners()
238214
{
239-
sta::Corners* corners = getSta()->corners();
240-
return {corners->begin(), corners->end()};
215+
auto& corners = getSta()->scenes();
216+
return {corners.begin(), corners.end()};
241217
}
242218

243-
sta::Corner* Timing::cmdCorner()
219+
sta::Scene* Timing::cmdCorner()
244220
{
245-
return getSta()->cmdCorner();
221+
return getSta()->cmdScene();
246222
}
247223

248-
sta::Corner* Timing::findCorner(const char* name)
224+
sta::Scene* Timing::findCorner(const char* name)
249225
{
250226
for (auto* corner : getCorners()) {
251-
if (strcmp(corner->name(), name) == 0) {
227+
if (strcmp(corner->name().c_str(), name) == 0) {
252228
return corner;
253229
}
254230
}
@@ -274,7 +250,8 @@ float Timing::getPinSlack(sta::Pin* sta_pin, RiseFall rf, MinMax minmax)
274250
{
275251
sta::dbSta* sta = getSta();
276252
auto sta_rf = (rf == Rise) ? sta::RiseFall::rise() : sta::RiseFall::fall();
277-
return sta->pinSlack(sta_pin, sta_rf, getMinMax(minmax));
253+
return sta->slack(
254+
sta_pin, sta_rf->asRiseFallBoth(), sta->scenes(), getMinMax(minmax));
278255
}
279256

280257
// I'd like to return a std::set but swig gave me way too much grief
@@ -319,7 +296,7 @@ const sta::MinMax* Timing::getMinMax(MinMax type)
319296
return type == Max ? sta::MinMax::max() : sta::MinMax::min();
320297
}
321298

322-
float Timing::getNetCap(odb::dbNet* net, sta::Corner* corner, MinMax minmax)
299+
float Timing::getNetCap(odb::dbNet* net, sta::Scene* corner, MinMax minmax)
323300
{
324301
sta::dbSta* sta = getSta();
325302
sta::Net* sta_net = sta->getDbNetwork()->dbToSta(net);
@@ -330,7 +307,7 @@ float Timing::getNetCap(odb::dbNet* net, sta::Corner* corner, MinMax minmax)
330307
return pin_cap + wire_cap;
331308
}
332309

333-
float Timing::getPortCap(odb::dbITerm* pin, sta::Corner* corner, MinMax minmax)
310+
float Timing::getPortCap(odb::dbITerm* pin, sta::Scene* corner, MinMax minmax)
334311
{
335312
sta::dbSta* sta = getSta();
336313
sta::dbNetwork* network = sta->getDbNetwork();
@@ -375,7 +352,7 @@ float Timing::getMaxSlewLimit(odb::dbMTerm* pin)
375352
return max_slew;
376353
}
377354

378-
float Timing::staticPower(odb::dbInst* inst, sta::Corner* corner)
355+
float Timing::staticPower(odb::dbInst* inst, sta::Scene* corner)
379356
{
380357
sta::dbSta* sta = getSta();
381358
sta::dbNetwork* network = sta->getDbNetwork();
@@ -388,7 +365,7 @@ float Timing::staticPower(odb::dbInst* inst, sta::Corner* corner)
388365
return power.leakage();
389366
}
390367

391-
float Timing::dynamicPower(odb::dbInst* inst, sta::Corner* corner)
368+
float Timing::dynamicPower(odb::dbInst* inst, sta::Scene* corner)
392369
{
393370
sta::dbSta* sta = getSta();
394371
sta::dbNetwork* network = sta->getDbNetwork();

0 commit comments

Comments
 (0)