Skip to content

Commit 97b77fc

Browse files
committed
Merge branch 'master' of https://github.com/The-OpenROAD-Project/OpenROAD into grt_fix
2 parents b11143c + 75d13d7 commit 97b77fc

20 files changed

+604
-11
lines changed

etc/DependencyInstaller.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/rmp/src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ target_link_libraries(rmp_abc_library
6666
OpenSTA
6767
dbSta_lib
6868
utl_lib
69+
rsz_lib
6970
${ABC_LIBRARY}
7071
)
7172

src/rmp/src/Restructure.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ void Restructure::reset()
7474
void Restructure::resynth(sta::Corner* corner)
7575
{
7676
ZeroSlackStrategy zero_slack_strategy(corner);
77-
zero_slack_strategy.OptimizeDesign(open_sta_, name_generator_, logger_);
77+
zero_slack_strategy.OptimizeDesign(
78+
open_sta_, name_generator_, resizer_, logger_);
7879
}
7980

8081
void Restructure::run(char* liberty_file_name,

src/rmp/src/abc_library_factory.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static bool IsCombinational(sta::LibertyCell* cell)
4141
}
4242
return (!cell->isClockGate() && !cell->isPad() && !cell->isMacro()
4343
&& !cell->hasSequentials() && !cell->isLevelShifter()
44-
&& !cell->isIsolationCell() && !cell->isClockGate());
44+
&& !cell->isIsolationCell() && !cell->isMemory());
4545
}
4646

4747
static int CountOutputPins(sta::LibertyCell* cell)
@@ -76,8 +76,12 @@ static bool HasNonInputOutputPorts(sta::LibertyCell* cell)
7676
return false;
7777
}
7878

79-
static bool isCompatibleWithAbc(sta::LibertyCell* cell)
79+
static bool isCompatibleWithAbc(sta::LibertyCell* cell, rsz::Resizer* resizer)
8080
{
81+
if (resizer != nullptr && resizer->dontUse(cell)) {
82+
return false;
83+
}
84+
8185
if (!IsCombinational(cell)) {
8286
return false;
8387
}
@@ -213,6 +217,13 @@ std::vector<abc::SC_Pin*> AbcLibraryFactory::CreateAbcOutputPins(
213217
output_pin->max_out_slew = time_unit->staToUser(max_output_slew);
214218
}
215219

220+
if (cell_port->function() == nullptr) {
221+
logger_->error(utl::RMP,
222+
27,
223+
"cell port function is null for cell {}:{}",
224+
cell->name(),
225+
cell_port->name());
226+
}
216227
output_pin->func_text = strdup(cell_port->function()->to_string().c_str());
217228

218229
// Get list of input ports
@@ -312,6 +323,12 @@ AbcLibraryFactory& AbcLibraryFactory::AddDbSta(sta::dbSta* db_sta)
312323
return *this;
313324
}
314325

326+
AbcLibraryFactory& AbcLibraryFactory::AddResizer(rsz::Resizer* resizer)
327+
{
328+
resizer_ = resizer;
329+
return *this;
330+
}
331+
315332
AbcLibraryFactory& AbcLibraryFactory::SetCorner(sta::Corner* corner)
316333
{
317334
corner_ = corner;
@@ -418,7 +435,7 @@ void AbcLibraryFactory::PopulateAbcSclLibFromSta(
418435
// Loop through all of the cells in STA and create equivalents in
419436
// the ABC structure.
420437
for (sta::LibertyCell* cell : cells) {
421-
if (!isCompatibleWithAbc(cell)) {
438+
if (!isCompatibleWithAbc(cell, resizer_)) {
422439
continue;
423440
}
424441

src/rmp/src/abc_library_factory.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include "db_sta/dbSta.hh"
1414
#include "map/scl/sclLib.h"
15+
#include "rsz/Resizer.hh"
1516
#include "sta/Sta.hh"
1617
#include "utl/Logger.h"
1718
#include "utl/deleter.h"
@@ -54,6 +55,7 @@ class AbcLibraryFactory
5455
public:
5556
explicit AbcLibraryFactory(utl::Logger* logger) : logger_(logger) {}
5657
AbcLibraryFactory& AddDbSta(sta::dbSta* db_sta);
58+
AbcLibraryFactory& AddResizer(rsz::Resizer* resizer);
5759
AbcLibraryFactory& SetCorner(sta::Corner* corner);
5860
AbcLibrary Build();
5961

@@ -78,6 +80,7 @@ class AbcLibraryFactory
7880
utl::Logger* logger_;
7981
sta::dbSta* db_sta_ = nullptr;
8082
sta::Corner* corner_ = nullptr;
83+
rsz::Resizer* resizer_ = nullptr;
8184
};
8285

8386
} // namespace rmp

src/rmp/src/resynthesis_strategy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "db_sta/dbSta.hh"
77
#include "rmp/unique_name.h"
8+
#include "rsz/Resizer.hh"
89
#include "utl/Logger.h"
910

1011
namespace rmp {
@@ -15,6 +16,7 @@ class ResynthesisStrategy
1516
virtual ~ResynthesisStrategy() = default;
1617
virtual void OptimizeDesign(sta::dbSta* sta,
1718
rmp::UniqueName& name_generator,
19+
rsz::Resizer* resizer,
1820
utl::Logger* logger)
1921
= 0;
2022
};

src/rmp/src/zero_slack_strategy.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,26 @@
2424

2525
namespace rmp {
2626

27-
std::vector<sta::Vertex*> GetNegativeEndpoints(sta::dbSta* sta)
27+
std::vector<sta::Vertex*> GetNegativeEndpoints(sta::dbSta* sta,
28+
rsz::Resizer* resizer)
2829
{
2930
std::vector<sta::Vertex*> result;
3031

3132
sta::dbNetwork* network = sta->getDbNetwork();
3233
for (sta::Vertex* vertex : *sta->endpoints()) {
33-
sta::PortDirection* direction = network->direction(vertex->pin());
34+
sta::Pin* pin = vertex->pin();
35+
sta::PortDirection* direction = network->direction(pin);
3436
if (!direction->isInput()) {
3537
continue;
3638
}
3739

40+
if (resizer != nullptr) {
41+
if (resizer->dontTouch(pin) || resizer->dontTouch(network->net(pin))
42+
|| resizer->dontTouch(network->instance(pin))) {
43+
continue;
44+
}
45+
}
46+
3847
const sta::Slack slack = sta->vertexSlack(vertex, sta::MinMax::max());
3948

4049
if (slack > 0.0) {
@@ -48,6 +57,7 @@ std::vector<sta::Vertex*> GetNegativeEndpoints(sta::dbSta* sta)
4857

4958
void ZeroSlackStrategy::OptimizeDesign(sta::dbSta* sta,
5059
UniqueName& name_generator,
60+
rsz::Resizer* resizer,
5161
utl::Logger* logger)
5262
{
5363
sta->ensureGraph();
@@ -57,16 +67,19 @@ void ZeroSlackStrategy::OptimizeDesign(sta::dbSta* sta,
5767

5868
sta::dbNetwork* network = sta->getDbNetwork();
5969

60-
std::vector<sta::Vertex*> candidate_vertices = GetNegativeEndpoints(sta);
70+
std::vector<sta::Vertex*> candidate_vertices
71+
= GetNegativeEndpoints(sta, resizer);
6172

6273
if (candidate_vertices.empty()) {
63-
logger->info(
64-
utl::RMP, 1030, "All endpoints have positive slack, nothing to do.");
74+
logger->info(utl::RMP,
75+
1030,
76+
"All candidate endpoints have positive slack, nothing to do.");
6577
return;
6678
}
6779

6880
AbcLibraryFactory factory(logger);
6981
factory.AddDbSta(sta);
82+
factory.AddResizer(resizer);
7083
factory.SetCorner(corner_);
7184
AbcLibrary abc_library = factory.Build();
7285

@@ -82,6 +95,12 @@ void ZeroSlackStrategy::OptimizeDesign(sta::dbSta* sta,
8295

8396
LogicCut cut = logic_extractor.BuildLogicCut(abc_library);
8497

98+
if (cut.IsEmpty()) {
99+
logger->warn(
100+
utl::RMP, 1032, "Logic cut is empty after extraction, nothing to do.");
101+
return;
102+
}
103+
85104
utl::UniquePtrWithDeleter<abc::Abc_Ntk_t> mapped_abc_network
86105
= cut.BuildMappedAbcNetwork(abc_library, network, logger);
87106

src/rmp/src/zero_slack_strategy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "db_sta/dbSta.hh"
77
#include "resynthesis_strategy.h"
88
#include "rmp/unique_name.h"
9+
#include "rsz/Resizer.hh"
910
#include "sta/Corner.hh"
1011
#include "utl/Logger.h"
1112

@@ -17,6 +18,7 @@ class ZeroSlackStrategy : public ResynthesisStrategy
1718
explicit ZeroSlackStrategy(sta::Corner* corner = nullptr) : corner_(corner) {}
1819
void OptimizeDesign(sta::dbSta* sta,
1920
UniqueName& name_generator,
21+
rsz::Resizer* resizer,
2022
utl::Logger* logger) override;
2123

2224
private:

src/rmp/test/BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ COMPULSORY_TESTS = [
1717
"gcd_restructure",
1818
"aes_asap7",
1919
"gcd_asap7",
20+
"memory_nangate45",
21+
"aes_dontuse_nangate45",
22+
"aes_donttouch_nangate45"
2023
]
2124

2225
# Disabled in CMakeLists.txt

src/rmp/test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ or_integration_tests(
1414
gcd_restructure
1515
aes_asap7
1616
gcd_asap7
17+
memory_nangate45
18+
aes_dontuse_nangate45
19+
aes_donttouch_nangate45
1720
)
1821

1922
# Skipped

0 commit comments

Comments
 (0)