Skip to content

Commit

Permalink
Merge pull request #5891 from bnmfw/drt_initInstAccessPoint
Browse files Browse the repository at this point in the history
drt: init instance access points
  • Loading branch information
osamahammad21 authored Oct 20, 2024
2 parents 76c4043 + c9df50b commit 58b46bb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 33 deletions.
7 changes: 7 additions & 0 deletions src/drt/src/pa/FlexPA.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ class FlexPA

bool isStdCell(frInst* inst);
bool isMacroCell(frInst* inst);
/**
* @brief initializes all access points of a single unique instance
*
* @param inst the unique instance
*/
void initInstAccessPoints(frInst* inst);

/**
* @brief initializes all access points of all unique instances
*/
Expand Down
75 changes: 42 additions & 33 deletions src/drt/src/pa/FlexPA_prep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,52 +1444,61 @@ static inline void serializeInstRows(
paUpdate::serialize(update, file_name);
}

void FlexPA::initInstAccessPoints(frInst* inst)
{
ProfileTask profile("PA:uniqueInstance");
for (auto& inst_term : inst->getInstTerms()) {
// only do for normal and clock terms
if (isSkipInstTerm(inst_term.get())) {
continue;
}
int n_aps = 0;
for (auto& pin : inst_term->getTerm()->getPins()) {
n_aps += initPinAccess(pin.get(), inst_term.get());
}
if (!n_aps) {
logger_->error(DRT,
73,
"No access point for {}/{}.",
inst_term->getInst()->getName(),
inst_term->getTerm()->getName());
}
}
}

void FlexPA::initAllAccessPoints()
{
ProfileTask profile("PA:point");
int cnt = 0;
int pin_count = 0;
int pin_count_inform = 1000;

omp_set_num_threads(MAX_THREADS);
ThreadException exception;
const auto& unique = unique_insts_.getUnique();

const std::vector<frInst*>& unique = unique_insts_.getUnique();
#pragma omp parallel for schedule(dynamic)
for (int i = 0; i < (int) unique.size(); i++) { // NOLINT
try {
auto& inst = unique[i];
frInst* inst = unique[i];

// only do for core and block cells
if (!isStdCell(inst) && !isMacroCell(inst)) {
continue;
}
ProfileTask profile("PA:uniqueInstance");
for (auto& inst_term : inst->getInstTerms()) {
// only do for normal and clock terms
if (isSkipInstTerm(inst_term.get())) {
continue;
}
int n_aps = 0;
for (auto& pin : inst_term->getTerm()->getPins()) {
n_aps += initPinAccess(pin.get(), inst_term.get());
}
if (!n_aps) {
logger_->error(DRT,
73,
"No access point for {}/{}.",
inst_term->getInst()->getName(),
inst_term->getTerm()->getName());
}

initInstAccessPoints(inst);
if (VERBOSE <= 0) {
continue;
}

int inst_terms_cnt = static_cast<int>(inst->getInstTerms().size());
#pragma omp critical
{
cnt++;
if (VERBOSE > 0) {
if (cnt < 10000) {
if (cnt % 1000 == 0) {
logger_->info(DRT, 76, " Complete {} pins.", cnt);
}
} else {
if (cnt % 10000 == 0) {
logger_->info(DRT, 77, " Complete {} pins.", cnt);
}
}
for (int i = 0; i < inst_terms_cnt; i++, pin_count++) {
pin_count++;
if (pin_count % pin_count_inform == 0) {
logger_->info(DRT, 76, " Complete {} pins.", pin_count);
if (pin_count >= 10000) {
pin_count_inform = 10000;
}
}
}
Expand Down Expand Up @@ -1531,7 +1540,7 @@ void FlexPA::initAllAccessPoints()
}

if (VERBOSE > 0) {
logger_->info(DRT, 78, " Complete {} pins.", cnt);
logger_->info(DRT, 78, " Complete {} pins.", pin_count);
}
}

Expand Down

0 comments on commit 58b46bb

Please sign in to comment.