Skip to content

Commit 5ef8daf

Browse files
authored
Merge pull request The-OpenROAD-Project#6610 from LucasYuki/rmp_removing_static_var
rmp: removing static variable Blif::call_id_
2 parents 7e0fce8 + 03d8a77 commit 5ef8daf

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

src/rmp/include/rmp/Restructure.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class Restructure
132132

133133
Mode opt_mode_;
134134
bool is_area_mode_;
135+
int blif_call_id_{0};
135136
};
136137

137138
} // namespace rmp

src/rmp/include/rmp/blif.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ class Blif
6969
const std::string& const0_cell_,
7070
const std::string& const0_cell_port_,
7171
const std::string& const1_cell_,
72-
const std::string& const1_cell_port_);
72+
const std::string& const1_cell_port_,
73+
int call_id_);
7374
void setReplaceableInstances(std::set<odb::dbInst*>& insts);
7475
void addReplaceableInstance(odb::dbInst* inst);
7576
bool writeBlif(const char* file_name, bool write_arrival_requireds = false);
@@ -90,7 +91,7 @@ class Blif
9091
std::string const1_cell_port_;
9192
std::map<std::string, std::pair<float, float>> requireds_;
9293
std::map<std::string, std::pair<float, float>> arrivals_;
93-
static int call_id_;
94+
int call_id_;
9495
};
9596

9697
} // namespace rmp

src/rmp/src/Restructure.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ void Restructure::runABC()
169169
"Constants before remap {}",
170170
countConsts(block_));
171171

172-
Blif blif_(logger_, open_sta_, locell_, loport_, hicell_, hiport_);
172+
Blif blif_(
173+
logger_, open_sta_, locell_, loport_, hicell_, hiport_, ++blif_call_id_);
173174
blif_.setReplaceableInstances(path_insts_);
174175
blif_.writeBlif(input_blif_file_name_.c_str(), !is_area_mode_);
175176
debugPrint(

src/rmp/src/blif.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,21 @@ using utl::RMP;
6262

6363
namespace rmp {
6464

65-
int Blif::call_id_ = 0;
66-
6765
Blif::Blif(Logger* logger,
6866
sta::dbSta* sta,
6967
const std::string& const0_cell,
7068
const std::string& const0_cell_port,
7169
const std::string& const1_cell,
72-
const std::string& const1_cell_port)
70+
const std::string& const1_cell_port,
71+
const int call_id_)
7372
: const0_cell_(const0_cell),
7473
const0_cell_port_(const0_cell_port),
7574
const1_cell_(const1_cell),
76-
const1_cell_port_(const1_cell_port)
75+
const1_cell_port_(const1_cell_port),
76+
call_id_(call_id_)
7777
{
7878
logger_ = logger;
7979
open_sta_ = sta;
80-
call_id_++;
8180
}
8281

8382
void Blif::setReplaceableInstances(std::set<odb::dbInst*>& insts)

src/rmp/src/rmp.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ restructure_cmd(char* liberty_file_name, char* target, float slack_threshold,
8282
}
8383

8484
// Locally Exposed for testing only..
85-
Blif* create_blif(const char* hicell, const char* hiport, const char* locell, const char* loport){
86-
return new rmp::Blif(getOpenRoad()->getLogger(), getOpenRoad()->getSta(), locell, loport, hicell, hiport);
85+
Blif* create_blif(const char* hicell, const char* hiport, const char* locell, const char* loport, const int call_id=1){
86+
return new rmp::Blif(getOpenRoad()->getLogger(), getOpenRoad()->getSta(), locell, loport, hicell, hiport, call_id);
8787
}
8888

8989
void blif_add_instance(Blif* blif_, const char* inst_){

src/rmp/test/rmp_aux.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def restructure(
6565
)
6666

6767

68-
def create_blif(design, *, hicell="", hiport="", locell="", loport=""):
68+
def create_blif(design, *, hicell="", hiport="", locell="", loport="", call_id=1):
6969
logger = design.getLogger()
7070
sta = design.getTech().getSta()
71-
return rmp.Blif(logger, sta, locell, loport, hicell, hiport)
71+
return rmp.Blif(logger, sta, locell, loport, hicell, hiport, call_id)
7272

7373

7474
def blif_read(design, blif, filename):

0 commit comments

Comments
 (0)