Skip to content

Commit e3d3ade

Browse files
committed
Move abcInit from ord to cut
Having it in ord breaks layering by having tools depend on the ord namespace. It also breaks cpp unit tests when built debug. Signed-off-by: Matt Liberty <[email protected]>
1 parent 8867ccc commit e3d3ade

File tree

6 files changed

+32
-23
lines changed

6 files changed

+32
-23
lines changed

include/ord/OpenRoad.hh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,5 @@ class OpenRoad
284284

285285
int tclAppInit(Tcl_Interp* interp);
286286
int tclInit(Tcl_Interp* interp);
287-
void abcInit();
288287

289288
} // namespace ord

src/Main.cc

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <tclExtend.h>
3434
#endif
3535

36+
#include "cut/abc_library_factory.h"
3637
#include "gui/gui.h"
3738
#include "ord/Design.h"
3839
#include "ord/InitOpenRoad.hh"
@@ -89,7 +90,6 @@ static const char* log_filename = nullptr;
8990
static const char* metrics_filename = nullptr;
9091
static bool no_settings = false;
9192
static bool minimize = false;
92-
static bool abc_initialized = false;
9393

9494
static const char* init_filename = ".openroad";
9595

@@ -169,12 +169,6 @@ static void initPython()
169169
}
170170
#endif
171171

172-
namespace abc {
173-
// Forward declare instead of including to avoid warnings from ABC
174-
void Abc_Start();
175-
void Abc_Stop();
176-
} // namespace abc
177-
178172
static volatile sig_atomic_t fatal_error_in_progress = 0;
179173

180174
// When we enter through main() we have a single tech and design.
@@ -310,9 +304,8 @@ int main(int argc, char* argv[])
310304
// Tcl_Main never returns.
311305
Tcl_Main(1, argv, ord::tclAppInit);
312306

313-
if (abc_initialized) {
314-
abc::Abc_Stop();
315-
}
307+
cut::abcStop();
308+
316309
return 0;
317310
}
318311

@@ -528,14 +521,6 @@ int ord::tclInit(Tcl_Interp* interp)
528521
return tclAppInit(cmd_argc, cmd_argv, init_filename, interp);
529522
}
530523

531-
void ord::abcInit()
532-
{
533-
if (!abc_initialized) {
534-
abc::Abc_Start();
535-
abc_initialized = true;
536-
}
537-
}
538-
539524
static void showUsage(const char* prog, const char* init_filename)
540525
{
541526
printf("Usage: %s [-help] [-version] [-no_init] [-no_splash] [-exit] ", prog);

src/cgt/src/ClockGating.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "db_sta/dbNetwork.hh"
1616
#include "db_sta/dbSta.hh"
1717
#include "odb/db.h"
18-
#include "ord/OpenRoad.hh"
1918
#include "sta/Bfs.hh"
2019
#include "sta/ClkNetwork.hh"
2120
#include "sta/FuncExpr.hh"
@@ -360,7 +359,7 @@ void ClockGating::run()
360359
sta_->searchPreamble();
361360

362361
// Initialize ABC
363-
ord::abcInit();
362+
cut::abcInit();
364363
abc_factory_->AddDbSta(sta_);
365364
abc_library_ = std::make_unique<cut::AbcLibrary>(abc_factory_->Build());
366365

src/cut/include/cut/abc_library_factory.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,7 @@ class AbcLibraryFactory
8686
rsz::Resizer* resizer_ = nullptr;
8787
};
8888

89+
void abcInit();
90+
void abcStop();
91+
8992
} // namespace cut

src/cut/src/abc_library_factory.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
#include "sta/Units.hh"
3535
#include "utl/deleter.h"
3636

37+
namespace abc {
38+
// Forward declare instead of including to avoid warnings from ABC
39+
void Abc_Start();
40+
void Abc_Stop();
41+
} // namespace abc
42+
3743
namespace cut {
3844

3945
AbcLibrary::AbcLibrary(utl::UniquePtrWithDeleter<abc::SC_Lib> abc_library)
@@ -680,4 +686,21 @@ bool AbcLibrary::IsConstCell(const std::string& cell_name)
680686
return IsConst1Cell(cell_name) || IsConst0Cell(cell_name);
681687
}
682688

689+
static bool abc_initialized = false;
690+
691+
void abcInit()
692+
{
693+
if (!abc_initialized) {
694+
abc::Abc_Start();
695+
abc_initialized = true;
696+
}
697+
}
698+
699+
void abcStop()
700+
{
701+
if (abc_initialized) {
702+
abc::Abc_Stop();
703+
}
704+
}
705+
683706
} // namespace cut

src/rmp/src/Restructure.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
#include "base/abc/abc.h"
2525
#include "base/main/abcapis.h"
26+
#include "cut/abc_library_factory.h"
2627
#include "cut/blif.h"
2728
#include "db_sta/dbNetwork.hh"
2829
#include "db_sta/dbSta.hh"
2930
#include "odb/db.h"
30-
#include "ord/OpenRoad.hh"
3131
#include "sta/Graph.hh"
3232
#include "sta/Liberty.hh"
3333
#include "sta/Network.hh"
@@ -59,7 +59,7 @@ void Restructure::init(utl::Logger* logger,
5959
resizer_ = resizer;
6060
estimate_parasitics_ = estimate_parasitics;
6161

62-
ord::abcInit();
62+
cut::abcInit();
6363
}
6464

6565
void Restructure::deleteComponents()

0 commit comments

Comments
 (0)