Skip to content

Commit 68bb1ea

Browse files
committed
Merge remote-tracking branch 'private/master' into gpl-fix-hpwl-print
2 parents 80b71be + e561a14 commit 68bb1ea

File tree

181 files changed

+4399
-2349
lines changed

Some content is hidden

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

181 files changed

+4399
-2349
lines changed

BUILD.bazel

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ load("//bazel:tcl_wrap_cc.bzl", "tcl_wrap_cc")
88
package(
99
features = [
1010
"-parse_headers",
11-
"-layering_check",
11+
"layering_check",
1212
# TODO(b/299593765): Fix strict ordering.
1313
"-libcxx_assertions",
1414
],
@@ -84,6 +84,8 @@ OPENROAD_LIBRARY_DEPS = [
8484
"//src/psm",
8585
"//src/rcx",
8686
"//src/rcx:ui",
87+
"//src/rmp",
88+
"//src/rmp:ui",
8789
"//src/rsz",
8890
"//src/rsz:ui",
8991
"//src/stt",
@@ -129,24 +131,20 @@ cc_binary(
129131
name = "openroad",
130132
srcs = [
131133
"src/Main.cc",
132-
"src/OpenRoad.cc",
133-
":openroad_swig",
134-
":openroad_tcl",
135-
":rmp_swig",
136-
":rmp_tcl",
137134
"//bazel:runfiles",
138135
],
139136
copts = OPENROAD_COPTS,
140137
features = ["-use_header_modules"],
141138
malloc = "@tcmalloc//tcmalloc",
142139
visibility = ["//visibility:public"],
143140
deps = [
144-
":openroad_lib_private",
141+
":openroad_lib",
145142
":openroad_version",
146-
"//src/odb",
147-
"//src/rsz",
143+
"//:ord",
144+
"//src/gui",
148145
"//src/sta:opensta_lib",
149146
"//src/utl",
147+
"@boost.stacktrace",
150148
"@rules_cc//cc/runfiles",
151149
"@tk_tcl//:tcl",
152150
],
@@ -165,21 +163,17 @@ cc_library(
165163
"src/Design.cc",
166164
"src/Tech.cc",
167165
"src/Timing.cc",
168-
] + glob([
169-
"src/rmp/src/*.h",
170-
"src/rmp/src/*.cpp",
171-
]),
172-
hdrs = glob([
173-
"src/rmp/include/rmp/*.h",
174-
]),
166+
],
175167
copts = OPENROAD_COPTS,
176168
defines = OPENROAD_DEFINES + GUI_BUILD_FLAGS,
177169
features = ["-use_header_modules"],
178170
includes = [
179171
"include",
180-
"src/rmp/include",
181172
],
182-
deps = OPENROAD_LIBRARY_DEPS,
173+
deps = OPENROAD_LIBRARY_DEPS + [
174+
"//src/sta:opensta_lib",
175+
"@tk_tcl//:tcl",
176+
]
183177
)
184178

185179
cc_library(
@@ -191,22 +185,19 @@ cc_library(
191185
"src/Timing.cc",
192186
":openroad_swig",
193187
":openroad_tcl",
194-
":rmp_swig",
195-
":rmp_tcl",
196-
] + glob([
197-
"src/rmp/src/*.cpp",
198-
"src/rmp/src/*.h",
199-
]),
200-
hdrs = glob(["src/rmp/include/rmp/*.h"]),
188+
],
201189
copts = OPENROAD_COPTS,
202190
defines = OPENROAD_DEFINES + GUI_BUILD_FLAGS,
203191
features = ["-use_header_modules"],
204192
includes = [
205193
"include",
206-
"src/rmp/include",
207194
],
208195
visibility = ["//visibility:public"],
209-
deps = OPENROAD_LIBRARY_DEPS,
196+
deps = OPENROAD_LIBRARY_DEPS + [
197+
"//src/sta:opensta_lib",
198+
"@boost.stacktrace",
199+
"@tk_tcl//:tcl",
200+
]
210201
)
211202

212203
cc_library(
@@ -254,15 +245,6 @@ tcl_encode(
254245
namespace = "ord",
255246
)
256247

257-
tcl_encode(
258-
name = "rmp_tcl",
259-
srcs = [
260-
"src/rmp/src/rmp.tcl",
261-
],
262-
char_array_name = "rmp_tcl_inits",
263-
namespace = "rmp",
264-
)
265-
266248
tcl_wrap_cc(
267249
name = "openroad_swig",
268250
srcs = [
@@ -277,22 +259,6 @@ tcl_wrap_cc(
277259
],
278260
)
279261

280-
tcl_wrap_cc(
281-
name = "rmp_swig",
282-
srcs = [
283-
"src/rmp/src/rmp.i",
284-
":error_swig",
285-
"//src/sta:sta_swig_files",
286-
],
287-
module = "rmp",
288-
namespace_prefix = "rmp",
289-
root_swig_src = "src/rmp/src/rmp.i",
290-
swig_includes = [
291-
"src/rmp/src",
292-
"src/sta",
293-
],
294-
)
295-
296262
filegroup(
297263
name = "error_swig",
298264
srcs = [

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ workspace(name = "openroad")
88

99
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
1010

11-
rules_hdl_git_hash = "56da46a87e8e5a4dbe84c0bbe5d00e92b936494f"
11+
rules_hdl_git_hash = "cf2bd95334741db74b39b47fa1d4622b0d45ce6c"
1212

13-
rules_hdl_git_sha256 = "dc184ad0fe92f315eb5600fb3293c94ce1fce3fc1d0fd79400107038ed917d70"
13+
rules_hdl_git_sha256 = "137e1fbde970a41f295ca348f9105bc7eedd6640374ec7f4a8abaee9a2cfc2d0"
1414

1515
http_archive(
1616
name = "rules_hdl",

etc/DependencyInstaller.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ _installCommonDev() {
9191
cmakeBin=${cmakePrefix}/bin/cmake
9292
if [[ ! -f ${cmakeBin} || -z $(${cmakeBin} --version | grep ${cmakeVersionBig}) ]]; then
9393
cd "${baseDir}"
94-
eval wget https://cmake.org/files/v${cmakeVersionBig}/cmake-${cmakeVersionSmall}-${osName}-${arch}.sh
94+
eval wget https://github.com/Kitware/CMake/releases/download/v${cmakeVersionSmall}/cmake-${cmakeVersionSmall}-linux-${arch}.sh
9595
md5sum -c <(echo "${cmakeChecksum} cmake-${cmakeVersionSmall}-${osName}-${arch}.sh") || exit 1
9696
chmod +x cmake-${cmakeVersionSmall}-${osName}-${arch}.sh
9797
./cmake-${cmakeVersionSmall}-${osName}-${arch}.sh --skip-license --prefix=${cmakePrefix}
@@ -861,10 +861,10 @@ while [ "$#" -gt 0 ]; do
861861
export GIT_SSL_NO_VERIFY=true
862862
;;
863863
-save-deps-prefixes=*)
864-
saveDepsPrefixes=$(realpath ${1#-save-deps-prefixes=})
864+
saveDepsPrefixes=$(realpath ${1#*=})
865865
;;
866866
-threads=*)
867-
numThreads=${1}
867+
numThreads=${1#*=}
868868
;;
869869
*)
870870
echo "unknown option: ${1}" >&2
@@ -933,11 +933,13 @@ case "${os}" in
933933
_installOrTools "ubuntu" "${ubuntuVersion}" "amd64"
934934
fi
935935
;;
936-
"Red Hat Enterprise Linux" | "Rocky Linux")
936+
"Red Hat Enterprise Linux" | "Rocky Linux" | "AlmaLinux")
937937
if [[ "${os}" == "Red Hat Enterprise Linux" ]]; then
938938
rhelVersion=$(rpm -q --queryformat '%{VERSION}' redhat-release | cut -d. -f1)
939939
elif [[ "${os}" == "Rocky Linux" ]]; then
940940
rhelVersion=$(rpm -q --queryformat '%{VERSION}' rocky-release | cut -d. -f1)
941+
elif [[ "${os}" == "AlmaLinux" ]]; then
942+
rhelVersion=$(rpm -q --queryformat '%{VERSION}' almalinux-release | cut -d. -f1)
941943
fi
942944
if [[ "${rhelVersion}" != "8" ]] && [[ "${rhelVersion}" != "9" ]]; then
943945
echo "ERROR: Unsupported ${rhelVersion} version. Versions '8' and '9' are supported."
@@ -1018,4 +1020,8 @@ esac
10181020
if [[ ! -z ${saveDepsPrefixes} ]]; then
10191021
mkdir -p "$(dirname $saveDepsPrefixes)"
10201022
echo "$CMAKE_PACKAGE_ROOT_ARGS" > $saveDepsPrefixes
1023+
# Fix permissions if running as root to allow user access
1024+
if [[ $(id -u) == 0 && ! -z "${SUDO_USER+x}" ]]; then
1025+
chown "$SUDO_USER:$(id -gn "$SUDO_USER")" "$saveDepsPrefixes" 2>/dev/null || true
1026+
fi
10211027
fi

src/cts/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ clock_tree_synthesis
6161
[-num_static_layers]
6262
[-sink_clustering_buffer]
6363
[-obstruction_aware]
64-
[-apply_ndr]
64+
[-apply_ndr strategy]
6565
[-insertion_delay]
6666
[-dont_use_dummy_load]
6767
[-sink_buffer_max_cap_derate derate_value]
@@ -92,7 +92,7 @@ clock_tree_synthesis
9292
| `-num_static_layers` | Set the number of static layers. The default value is `0`, and the allowed values are integers `[0, MAX_INT]`. |
9393
| `-sink_clustering_buffer` | Set the sink clustering buffer(s) to be used. |
9494
| `-obstruction_aware` | Enables obstruction-aware buffering such that clock buffers are not placed on top of blockages or hard macros. This option may reduce legalizer displacement, leading to better latency, skew or timing QoR. The default value is `False`, and the allowed values are bool. |
95-
| `-apply_ndr` | Applies 2X spacing non-default rule to all clock nets except leaf-level nets. The default value is `False`. |
95+
| `-apply_ndr` | Applies 2X spacing non-default rule to clock nets except leaf-level nets following some strategy. There are four strategy options: `none, root_only, half, full`. If this is not specified, the default value is `none`. |
9696
| `-dont_use_dummy_load` | Don't apply dummy buffer or inverter cells at clock tree leaves to balance loads. The default values is `False`. |
9797
| `-sink_buffer_max_cap_derate` | Use this option to control automatic buffer selection. To favor strong(weak) drive strength buffers use a small(large) value. The default value is `0.01`, meaning that buffers are selected by derating max cap limit by 0.01. The value of 1.0 means no derating of max cap limit. |
9898
| `-delay_buffer_derate` | This option balances latencies between macro cells and registers by inserting delay buffers. The default value is `1.0`, meaning all needed delay buffers are inserted. A value of 0.5 means only half of necessary delay buffers are inserted. A value of 0.0 means no insertion of delay buffers. |

src/cts/include/cts/TritonCTS.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,25 @@ class TritonCTS
9898
void buildClockTrees();
9999
void writeDataToDb();
100100

101+
// NDR functions
102+
std::vector<int> getAllClockTreeLevels(Clock& clockNet);
103+
int applyNDRToClockLevels(Clock& clockNet,
104+
odb::dbTechNonDefaultRule* clockNDR,
105+
const std::vector<int>& targetLevels);
106+
107+
int applyNDRToClockLevelRange(Clock& clockNet,
108+
odb::dbTechNonDefaultRule* clockNDR,
109+
int minLevel,
110+
int maxLevel);
111+
int applyNDRToFirstHalfLevels(Clock& clockNet,
112+
odb::dbTechNonDefaultRule* clockNDR);
113+
101114
// db functions
102115
bool masterExists(const std::string& master) const;
103116
void populateTritonCTS();
104117
void writeClockNetsToDb(TreeBuilder* builder,
105118
std::set<odb::dbNet*>& clkLeafNets);
106-
void writeClockNDRsToDb(const std::set<odb::dbNet*>& clkLeafNets);
119+
void writeClockNDRsToDb(TreeBuilder* builder);
107120
void incrementNumClocks() { ++numberOfClocks_; }
108121
void clearNumClocks() { numberOfClocks_ = 0; }
109122
unsigned getNumClocks() const { return numberOfClocks_; }

src/cts/src/Clock.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,16 @@ class ClockSubNet
9494
std::deque<ClockInst*> instances_;
9595
std::unordered_map<ClockInst*, unsigned> mapInstToIdx_;
9696
bool leafLevel_ = false;
97+
int level_ = -1;
98+
odb::dbNet* netObj_ = nullptr;
9799

98100
public:
99101
explicit ClockSubNet(const std::string& name) : name_(name) {}
100102

103+
void setNetObj(odb::dbNet* net) { netObj_ = net; }
104+
odb::dbNet* getNetObj() { return netObj_; }
105+
void setTreeLevel(int level) { level_ = level; }
106+
int getTreeLevel() { return level_; }
101107
void setLeafLevel(bool isLeaf) { leafLevel_ = isLeaf; }
102108
bool isLeafLevel() const { return leafLevel_; }
103109

src/cts/src/CtsOptions.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ namespace cts {
2727
class CtsOptions : public odb::dbBlockCallBackObj
2828
{
2929
public:
30+
enum class NdrStrategy
31+
{
32+
NONE,
33+
ROOT_ONLY,
34+
HALF,
35+
FULL
36+
};
37+
3038
enum class MasterType
3139
{
3240
DUMMY,
@@ -222,8 +230,6 @@ class CtsOptions : public odb::dbBlockCallBackObj
222230
stt::SteinerTreeBuilder* getSttBuilder() const { return sttBuilder_; }
223231
void setObstructionAware(bool obs) { obsAware_ = obs; }
224232
bool getObstructionAware() const { return obsAware_; }
225-
void setApplyNDR(bool ndr) { applyNDR_ = ndr; }
226-
bool applyNDR() const { return applyNDR_; }
227233
void enableInsertionDelay(bool insDelay) { insertionDelay_ = insDelay; }
228234
bool insertionDelayEnabled() const { return insertionDelay_; }
229235
void setBufferListInferred(bool inferred) { bufferListInferred_ = inferred; }
@@ -264,6 +270,10 @@ class CtsOptions : public odb::dbBlockCallBackObj
264270
void setRepairClockNets(bool value) { repairClockNets_ = value; }
265271
bool getRepairClockNets() { return repairClockNets_; }
266272

273+
// NDR strategies
274+
void setApplyNDR(NdrStrategy strategy) { ndrStrategy_ = strategy; }
275+
NdrStrategy getApplyNdr() const { return ndrStrategy_; }
276+
267277
private:
268278
std::string clockNets_;
269279
std::string rootBuffer_;
@@ -315,7 +325,6 @@ class CtsOptions : public odb::dbBlockCallBackObj
315325
utl::Logger* logger_ = nullptr;
316326
stt::SteinerTreeBuilder* sttBuilder_ = nullptr;
317327
bool obsAware_ = true;
318-
bool applyNDR_ = false;
319328
bool insertionDelay_ = true;
320329
bool bufferListInferred_ = false;
321330
bool sinkBufferInferred_ = false;
@@ -330,6 +339,7 @@ class CtsOptions : public odb::dbBlockCallBackObj
330339
std::string dummyload_prefix_ = "clkload";
331340
MasterCount dummy_count_;
332341
bool repairClockNets_ = false;
342+
NdrStrategy ndrStrategy_ = NdrStrategy::NONE;
333343
};
334344

335345
} // namespace cts

src/cts/src/HTreeBuilder.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,6 +1849,7 @@ void HTreeBuilder::createClockSubNets()
18491849

18501850
addTreeLevelBuffer(&rootBuffer);
18511851
ClockSubNet& rootClockSubNet = clock_.addSubNet("clknet_0");
1852+
rootClockSubNet.setTreeLevel(0);
18521853
rootClockSubNet.addInst(rootBuffer);
18531854
treeBufLevels_++;
18541855

@@ -1950,6 +1951,11 @@ void HTreeBuilder::createClockSubNets()
19501951
wireSegmentUnit_,
19511952
this);
19521953

1954+
// Set clock tree level the first time only.
1955+
if (builder.getDrivingSubNet()->getTreeLevel() < 0) {
1956+
builder.getDrivingSubNet()->setTreeLevel(levelIdx);
1957+
}
1958+
19531959
if (!options_->getTreeBuffer().empty()) {
19541960
builder.build(options_->getTreeBuffer());
19551961
} else {
@@ -2017,6 +2023,7 @@ void HTreeBuilder::createSingleBufferClockNet()
20172023

20182024
addTreeLevelBuffer(&rootBuffer);
20192025
ClockSubNet& clockSubNet = clock_.addSubNet("clknet_0");
2026+
clockSubNet.setTreeLevel(0);
20202027
clockSubNet.addInst(rootBuffer);
20212028

20222029
clock_.forEachSink([&](ClockInst& inst) { clockSubNet.addInst(inst); });

0 commit comments

Comments
 (0)