Skip to content

Commit

Permalink
Reformat dbNetwork.cc for google braces (coding style comment
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfox-rushc committed Jan 14, 2024
1 parent dc0a9db commit 5f017e6
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ const char* dbNetwork::name(const Instance* instance) const
dbModInst* mod_inst = nullptr;
const char* ret = nullptr;
staToDb(instance, db_inst, mod_inst);
if (db_inst) {
if (db_inst != nullptr) {
ret = tmpStringCopy(db_inst->getConstName());
} else if (mod_inst) {
} else if (mod_inst != nullptr) {
ret = tmpStringCopy(mod_inst->getName());
}
return ret;
Expand All @@ -507,7 +507,7 @@ class dbModulePortIterator : public CellPortIterator
{
public:
explicit dbModulePortIterator(const dbModule* cell, const dbBlock* block);
~dbModulePortIterator();
~dbModulePortIterator() override;
virtual bool hasNext();
virtual Port* next();

Expand Down Expand Up @@ -692,28 +692,30 @@ Cell* dbNetwork::cell(const Instance* instance) const
#ifdef DEBUG_DBNWK
printf("debug %d Getting cell for instance %s\n", debug, name(instance));
#endif

if (instance == top_instance_) {
return reinterpret_cast<Cell*>(top_cell_);
}

Cell* ret = nullptr;
dbInst* db_inst;
dbModInst* mod_inst;
staToDb(instance, db_inst, mod_inst);
if (db_inst) {
dbMaster* master = db_inst->getMaster();
return dbToSta(master);
ret = dbToSta(master);
} else if (mod_inst) {
dbModule* master = mod_inst->getMaster();
#ifdef DEBUG_DBNWK
printf("Mod inst Master is %s\n", master->getName());
#endif
// look up the cell in the verilog library.
return dbToSta(master);
ret = dbToSta(master);
}
// no traversal of the hierarchy this way; we would have to split
// Cell into dbMaster and dbModule otherwise. When we have full
// odb hierarchy this can be revisited.
return nullptr;
return ret;
}

Instance* dbNetwork::parent(const Instance* instance) const
Expand Down Expand Up @@ -817,8 +819,9 @@ Pin* dbNetwork::findPin(const Instance* instance, const char* port_name) const
unsigned ix = 0;
if (module->findPortIx(port_name, ix)) {
dbModITerm* miterm = nullptr;
if (mod_inst->getPinAtIx(ix, miterm))
if (mod_inst->getPinAtIx(ix, miterm)) {
return dbToSta(miterm);
}
}
}
return nullptr; // no pins on dbModInst in odb currently
Expand Down Expand Up @@ -945,14 +948,8 @@ Net* dbNetwork::hnet(const Pin* pin) const
if (iterm) {
dbNet* dnet = iterm->getNet();
dbModNet* mnet = iterm->getModNet();

// It is possible when writing out a hierarchical network
// that we have both a mod net and a db net.
// In the case of writing out a hierachical network we always
// choose the mnet.
// in regular case (everything else !) we choose the dnet
//--Check with Matt if this seems to make sense.

// that we have both a mod net and a db net choose the modnet
if (dnet && mnet) {
return dbToSta(mnet);
}
Expand All @@ -961,7 +958,6 @@ Net* dbNetwork::hnet(const Pin* pin) const
if (dnet)
return dbToSta(dnet);
}

if (moditerm) {
dbModNet* dnet = moditerm->getNet();
return dbToSta(dnet);
Expand All @@ -970,7 +966,6 @@ Net* dbNetwork::hnet(const Pin* pin) const
dbModNet* dnet = modbterm->getNet();
return dbToSta(dnet);
}

return nullptr;
}

Expand All @@ -996,10 +991,12 @@ Net* dbNetwork::net(const Pin* pin) const
if (dnet && mnet) {
return dbToSta(mnet);
}
if (mnet)
if (mnet) {
return dbToSta(mnet);
if (dnet)
}
if (dnet) {
return dbToSta(dnet);
}
}

if (moditerm) {
Expand Down Expand Up @@ -1028,12 +1025,12 @@ Term* dbNetwork::term(const Pin* pin) const
if (bterm) {
return dbToStaTerm(bterm);
}
if (moditerm)
if (moditerm) {
return dbToStaTerm(moditerm);

if (modbterm)
}
if (modbterm) {
return dbToStaTerm(modbterm);

}
return nullptr;
}

Expand All @@ -1050,8 +1047,9 @@ void dbNetwork::findInstPinsHierMatching(const Instance* instance,
const char* port_name = name(port(pin));
string pin_name;
stringPrint(pin_name, "%s%c%s", inst_name, divider_, port_name);
if (pattern->match(pin_name.c_str()))
if (pattern->match(pin_name.c_str())) {
matches.push_back(pin);
}
}
delete pin_iter;
}
Expand Down

0 comments on commit 5f017e6

Please sign in to comment.