Skip to content

Commit 895afdf

Browse files
authored
Merge pull request #8275 from The-OpenROAD-Project-staging/cgt-fix
Cgt fix
2 parents 68b01c4 + 7c5aa09 commit 895afdf

File tree

15 files changed

+69
-41
lines changed

15 files changed

+69
-41
lines changed

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ cc_binary(
143143
":openroad_lib",
144144
":openroad_version",
145145
"//:ord",
146+
"//src/cut",
146147
"//src/gui",
147148
"//src/sta:opensta_lib",
148149
"//src/utl",

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_init.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/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ target_link_libraries(cgt
3737
OpenSTA
3838
cut
3939
dbSta_lib
40-
libabc
4140
utl_lib
4241
)
4342

@@ -64,7 +63,6 @@ if (Python3_FOUND AND BUILD_PYTHON)
6463
dbSta
6564
OpenSTA
6665
cut
67-
libabc
6866
)
6967

7068
endif()

src/cgt/src/ClockGating.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
#include "base/abc/abc.h"
1111
#include "base/io/ioAbc.h"
1212
#include "base/main/abcapis.h"
13+
#include "cut/abc_init.h"
1314
#include "cut/abc_library_factory.h"
1415
#include "cut/logic_extractor.h"
1516
#include "db_sta/dbNetwork.hh"
1617
#include "db_sta/dbSta.hh"
1718
#include "odb/db.h"
18-
#include "ord/OpenRoad.hh"
1919
#include "sta/Bfs.hh"
2020
#include "sta/ClkNetwork.hh"
2121
#include "sta/FuncExpr.hh"
@@ -360,7 +360,7 @@ void ClockGating::run()
360360
sta_->searchPreamble();
361361

362362
// Initialize ABC
363-
ord::abcInit();
363+
cut::abcInit();
364364
abc_factory_->AddDbSta(sta_);
365365
abc_library_ = std::make_unique<cut::AbcLibrary>(abc_factory_->Build());
366366

src/cut/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ cc_library(
1919
],
2020
hdrs = [
2121
"include/cut/abc_library_factory.h",
22+
"include/cut/abc_init.h",
2223
"include/cut/blif.h",
2324
"include/cut/blifParser.h",
2425
"include/cut/logic_cut.h",

src/cut/include/cut/abc_init.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
// Copyright (c) 2024-2025, The OpenROAD Authors
3+
4+
#pragma once
5+
6+
namespace cut {
7+
8+
void abcInit();
9+
void abcStop();
10+
11+
} // namespace cut

src/cut/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ target_sources(cut
2727
target_link_libraries(cut
2828
PUBLIC
2929
rsz_lib
30+
libabc
3031
PRIVATE
3132
odb
3233
dbSta
3334
OpenSTA
3435
dbSta_lib
35-
libabc
3636
utl_lib
3737
${ABC_LIBRARY}
3838
)

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/gpl/src/replace.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "nesterovBase.h"
1717
#include "nesterovPlace.h"
1818
#include "odb/db.h"
19-
#include "ord/OpenRoad.hh"
2019
#include "placerBase.h"
2120
#include "routeBase.h"
2221
#include "rsz/Resizer.hh"

0 commit comments

Comments
 (0)