Skip to content

Commit

Permalink
Daily work in progress on resizer port for hierarchy
Browse files Browse the repository at this point in the history
Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed Oct 10, 2024
1 parent 9c9d8e4 commit 9305d0f
Show file tree
Hide file tree
Showing 16 changed files with 492 additions and 27 deletions.
5 changes: 5 additions & 0 deletions src/dbSta/src/dbNetwork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1967,6 +1967,11 @@ void dbNetwork::disconnectPin(Pin* pin)
} else if (bterm) {
bterm->disconnect();
}
if (moditerm) {
moditerm->disconnect();
} else if (modbterm) {
modbterm->disconnect();
}
}

void dbNetwork::disconnectPinBefore(const Pin* pin)
Expand Down
2 changes: 2 additions & 0 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -8003,6 +8003,7 @@ class dbModITerm : public dbObject
void disconnect();
static dbModITerm* create(dbModInst* parentInstance, const char* name);
static void destroy(dbModITerm*);
static dbModITerm* getModITerm(dbBlock* block_, uint dbid_);
// User Code End dbModITerm
};

Expand All @@ -8020,6 +8021,7 @@ class dbModNet : public dbObject
const char* getName() const;
static dbModNet* create(dbModule* parentModule, const char* name);
static void destroy(dbModNet*);
static dbModNet* getModNet(dbBlock* block_, uint dbid_);
// User Code End dbModNet
};

Expand Down
1 change: 1 addition & 0 deletions src/odb/src/db/dbITerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ void dbITerm::disconnect()
block->_journal->pushParam(dbITermObj);
block->_journal->pushParam(getId());
block->_journal->pushParam(net->getOID());
block->_journal->pushParam(iterm->_mnet);
block->_journal->endAction();
}

Expand Down
3 changes: 2 additions & 1 deletion src/odb/src/db/dbInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,9 +1439,10 @@ dbInst* dbInst::create(dbBlock* block_,
block->_journal->pushParam(lib->getId());
block->_journal->pushParam(master_->getId());
block->_journal->pushParam(name_);
block->_journal->pushParam(inst->getOID());
// need to add dbModNet
// dbModule (scope)
block->_journal->pushParam(inst->getOID());
block->_journal->pushParam(parent_module ? parent_module->getId() : 0);
block->_journal->endAction();
}

Expand Down
65 changes: 64 additions & 1 deletion src/odb/src/db/dbJournal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,20 @@ void dbJournal::redo_createObject()
uint lib_id;
uint master_id;
uint inst_id;
uint module_id; // shouldn't these be dbId<X> ?
std::string name;
_log.pop(lib_id);
_log.pop(master_id);
_log.pop(name);
_log.pop(inst_id);
_log.pop(module_id);

dbLib* lib = dbLib::getLib(_block->getDb(), lib_id);
dbMaster* master = dbMaster::getMaster(lib, master_id);
dbModule* target_module = (module_id == 0U)
? nullptr
: dbModule::getModule(_block, module_id);

debugPrint(_logger,
utl::ODB,
"DB_ECO",
Expand All @@ -341,7 +348,7 @@ void dbJournal::redo_createObject()
name,
master_id,
lib_id);
dbInst::create(_block, master, name.c_str());
dbInst::create(_block, master, name.c_str(), false, target_module);
break;
}

Expand Down Expand Up @@ -626,6 +633,22 @@ void dbJournal::redo_disconnectObject()
break;
}

case dbModITermObj: {
uint moditerm_id;
_log.pop(moditerm_id);
dbModITerm* moditerm = dbModITerm::getModITerm(_block, moditerm_id);
uint net_id;
_log.pop(net_id);
debugPrint(_logger,
utl::ODB,
"DB_ECO",
2,
"REDO ECO: disconnect dbModITermObj, iterm_id {}",
moditerm_id);
moditerm->disconnect();
break;
}

case dbBTermObj: {
uint bterm_id;
_log.pop(bterm_id);
Expand Down Expand Up @@ -1474,6 +1497,7 @@ void dbJournal::undo_createObject()
break;
}
case dbInstObj: {
printf("Undo create dbInst object\n");
uint lib_id;
uint master_id;
uint inst_id;
Expand Down Expand Up @@ -1535,6 +1559,7 @@ void dbJournal::undo_deleteObject()
break;
}
case dbInstObj: {
printf("Undo delete dbInst object\n");
uint lib_id;
uint master_id;
uint inst_id;
Expand Down Expand Up @@ -1602,6 +1627,7 @@ void dbJournal::undo_deleteObject()
void dbJournal::undo_connectObject()
{
auto obj_type = popObjectType();
printf("1 Undoing connected object\n");

switch (obj_type) {
case dbITermObj: {
Expand All @@ -1624,6 +1650,16 @@ void dbJournal::undo_connectObject()
break;
}

case dbModITermObj: {
uint moditerm_id;
_log.pop(moditerm_id);
dbModITerm* moditerm = dbModITerm::getModITerm(_block, moditerm_id);
uint net_id;
_log.pop(net_id);
moditerm->disconnect();
break;
}

default: {
_logger->critical(utl::ODB,
442,
Expand All @@ -1638,6 +1674,8 @@ void dbJournal::undo_disconnectObject()
{
auto obj_type = popObjectType();

printf("undo disconnect\n");

switch (obj_type) {
case dbITermObj: {
uint iterm_id;
Expand All @@ -1647,6 +1685,12 @@ void dbJournal::undo_disconnectObject()
_log.pop(net_id);
dbNet* net = dbNet::getNet(_block, net_id);
iterm->connect(net);
uint mnet_id;
_log.pop(mnet_id);
dbModNet* modnet = dbModNet::getModNet(_block, mnet_id);
if (modnet) {
iterm->connect(modnet);
}
break;
}

Expand All @@ -1660,6 +1704,25 @@ void dbJournal::undo_disconnectObject()
bterm->connect(net);
break;
}

case dbModITermObj: {
printf("mod term\n");
uint moditerm_id;
_log.pop(moditerm_id);
dbModITerm* moditerm = dbModITerm::getModITerm(_block, moditerm_id);
uint mnet_id;
_log.pop(mnet_id);
dbModNet* modnet = dbModNet::getModNet(_block, mnet_id);
debugPrint(_logger,
utl::ODB,
"DB_ECO",
2,
"REDO ECO: disconnect dbModITermObj, iterm_id {}",
moditerm_id);
moditerm->connect(modnet);
break;
}

default: {
_logger->critical(utl::ODB,
443,
Expand Down
45 changes: 43 additions & 2 deletions src/odb/src/db/dbModITerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

// Generator Code Begin Cpp
#include "dbModITerm.h"
#include "dbJournal.h"

// Generator Code Begin Cpp
#include "dbBlock.h"
#include "dbDatabase.h"
#include "dbDiff.hpp"
#include "dbHashTable.hpp"
#include "dbModBTerm.h"
#include "dbModITerm.h"
#include "dbModInst.h"
#include "dbModNet.h"
#include "dbTable.h"
Expand Down Expand Up @@ -228,6 +229,14 @@ dbModInst* dbModITerm::getParent() const

// User Code Begin dbModITermPublicMethods

dbModITerm* dbModITerm::getModITerm(dbBlock* block, uint db_id)
{
if (db_id == 0) {
return nullptr;
}
return (dbModITerm*) (((_dbBlock*) block)->_moditerm_tbl->getPtr(db_id));
}

void dbModITerm::setModNet(dbModNet* modNet)
{
_dbModITerm* obj = (_dbModITerm*) this;
Expand Down Expand Up @@ -296,6 +305,22 @@ void dbModITerm::connect(dbModNet* net)
return;
}
_moditerm->_mod_net = _modnet->getId();

if (_block->_journal) {
debugPrint(_moditerm->getImpl()->getLogger(),
utl::ODB,
"DB_ECO",
1,
"ECO: connect ModIterm {} to net {}",
getId(),
_modnet->getId());
_block->_journal->beginAction(dbJournal::CONNECT_OBJECT);
_block->_journal->pushParam(dbModITermObj);
_block->_journal->pushParam(getId());
_block->_journal->pushParam(_modnet->getId());
_block->_journal->endAction();
}

// append to net moditerms
if (_modnet->_moditerms != 0) {
_dbModITerm* head = _block->_moditerm_tbl->getPtr(_modnet->_moditerms);
Expand All @@ -318,6 +343,22 @@ void dbModITerm::disconnect()
return;
}
_dbModNet* _modnet = _block->_modnet_tbl->getPtr(_moditerm->_mod_net);

if (_block->_journal) {
debugPrint(_moditerm->getImpl()->getLogger(),
utl::ODB,
"DB_ECO",
1,
"ECO: disconnect ModIterm {} to net {}",
getId(),
_modnet->getId());
_block->_journal->beginAction(dbJournal::DISCONNECT_OBJECT);
_block->_journal->pushParam(dbModITermObj);
_block->_journal->pushParam(getId());
_block->_journal->pushParam(_modnet->getId());
_block->_journal->endAction();
}

_moditerm->_mod_net = 0;
_dbModITerm* next_moditerm
= (_moditerm->_next_net_moditerm != 0)
Expand Down
8 changes: 8 additions & 0 deletions src/odb/src/db/dbModNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ const char* dbModNet::getName() const
return obj->_name;
}

dbModNet* dbModNet::getModNet(dbBlock* block, uint db_id)
{
if (db_id == 0) {
return nullptr;
}
return (dbModNet*) (((_dbBlock*) block)->_modnet_tbl->getPtr(db_id));
}

dbModNet* dbModNet::create(dbModule* parentModule, const char* name)
{
// give illusion of scoping.
Expand Down
19 changes: 19 additions & 0 deletions src/rsz/src/EstimateWireParasitics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ void Resizer::updateParasitics(bool save_guides)
switch (parasitics_src_) {
case ParasiticsSrc::placement:
for (const Net* net : parasitics_invalid_) {
odb::dbNet* db_net;
odb::dbModNet* db_mod_net;
db_network_->staToDb(net, db_net, db_mod_net);
if (db_mod_net) {
printf("How exciting updating parasitics for a modnet..!\n");
}
estimateWireParasitic(net);
}
parasitics_invalid_.clear();
Expand Down Expand Up @@ -743,6 +749,16 @@ bool Resizer::isPad(const Instance* inst) const

void Resizer::parasiticsInvalid(const Net* net)
{
static int debug;
debug++;
printf("D %d Inserting parastics invalid 2\n", debug);
odb::dbNet* db_net;
odb::dbModNet* db_mod_net;
db_network_->staToDb(net, db_net, db_mod_net);
if (db_mod_net) {
printf("How exciting updating parasitics for a modnet..!\n");
}

if (haveEstimatedParasitics()) {
debugPrint(logger_,
RSZ,
Expand All @@ -756,6 +772,9 @@ void Resizer::parasiticsInvalid(const Net* net)

void Resizer::parasiticsInvalid(const dbNet* net)
{
static int debug;
debug++;
printf("D %d Inserting parastics invalid\n", debug);
parasiticsInvalid(db_network_->dbToSta(net));
}

Expand Down
6 changes: 4 additions & 2 deletions src/rsz/src/OdbCallBack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ void OdbCallBack::inDbInstSwapMasterAfter(dbInst* inst)
network_->pinIterator(sta_inst)};
while (pin_iter->hasNext()) {
Pin* pin = pin_iter->next();
Net* net = network_->net(pin);
resizer_->parasiticsInvalid(net);
odb::dbNet* db_net;
odb::dbModNet* db_mod_net;
db_network_->net(pin, db_net, db_mod_net);
resizer_->parasiticsInvalid(db_network_->dbToSta(db_net));
}
}

Expand Down
Loading

0 comments on commit 9305d0f

Please sign in to comment.