Skip to content

Commit

Permalink
Reformatted, support for modnets in dbJournal
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 27, 2024
1 parent f412b55 commit 8ee3bbf
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -8150,6 +8150,7 @@ class dbModNet : public dbObject

const char* getName() const;
void reName(const char* new_name);
static dbModNet* getModNet(dbBlock* block, uint id);
static dbModNet* create(dbModule* parentModule, const char* name);
static void destroy(dbModNet*);

Expand Down
40 changes: 39 additions & 1 deletion src/odb/src/db/dbITerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ void dbITerm::connect(dbNet* net_)
block->_journal->pushParam(dbITermObj);
block->_journal->pushParam(getId());
block->_journal->pushParam(net_->getId());
// put in a fake modnet here
block->_journal->pushParam(0);
block->_journal->endAction();
}

Expand Down Expand Up @@ -500,6 +502,22 @@ void dbITerm::connect(dbModNet* mod_net)
inst->_name);
}

if (block->_journal) {
debugPrint(iterm->getImpl()->getLogger(),
utl::ODB,
"DB_ECO",
1,
"ECO: connect Iterm {} to modnet {}",
getId(),
_mod_net->getId());
block->_journal->beginAction(dbJournal::CONNECT_OBJECT);
block->_journal->pushParam(dbITermObj);
block->_journal->pushParam(getId());
block->_journal->pushParam(0);
block->_journal->pushParam(_mod_net->getId());
block->_journal->endAction();
}

if (_mod_net->_iterms != 0) {
_dbITerm* head = block->_iterm_tbl->getPtr(_mod_net->_iterms);
iterm->_next_modnet_iterm = _mod_net->_iterms;
Expand Down Expand Up @@ -552,7 +570,6 @@ void dbITerm::disconnect()
block->_journal->pushParam(dbITermObj);
block->_journal->pushParam(getId());
block->_journal->pushParam(net->getOID());
block->_journal->endAction();
}

uint id = iterm->getOID();
Expand Down Expand Up @@ -580,9 +597,30 @@ void dbITerm::disconnect()

// the modnet part
if (iterm->_mnet == 0) {
if (block->_journal) {
debugPrint(iterm->getImpl()->getLogger(),
utl::ODB,
"DB_ECO",
1,
"ECO: disconnect modnet from Iterm {}",
getId());
block->_journal->pushParam(0);
block->_journal->endAction();
}
return;
}

_dbModNet* mod_net = block->_modnet_tbl->getPtr(iterm->_mnet);
if (block->_journal) {
debugPrint(iterm->getImpl()->getLogger(),
utl::ODB,
"DB_ECO",
1,
"ECO: disconnect Iterm -- modnet part {}",
getId());
block->_journal->pushParam(mod_net->getOID());
block->_journal->endAction();
}

if (mod_net->_iterms == id) {
mod_net->_iterms = iterm->_next_modnet_iterm;
Expand Down
48 changes: 37 additions & 11 deletions src/odb/src/db/dbJournal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,30 @@ void dbJournal::redo_connectObject()
dbITerm* iterm = dbITerm::getITerm(_block, iterm_id);
uint net_id;
_log.pop(net_id);
dbNet* net = dbNet::getNet(_block, net_id);
debugPrint(_logger,
utl::ODB,
"DB_ECO",
2,
"REDO ECO: connect dbITermObj, iterm_id {}, net_id {}",
iterm_id,
net_id);
iterm->connect(net);
if (net_id != 0) {
dbNet* net = dbNet::getNet(_block, net_id);
debugPrint(_logger,
utl::ODB,
"DB_ECO",
2,
"REDO ECO: connect dbITermObj, iterm_id {}, net_id {}",
iterm_id,
net_id);
iterm->connect(net);
}
uint mod_net_id;
_log.pop(mod_net_id);
if (mod_net_id != 0) {
dbModNet* mod_net = dbModNet::getModNet(_block, mod_net_id);
debugPrint(_logger,
utl::ODB,
"DB_ECO",
2,
"REDO ECO: connect dbITermObj, iterm_id {}, mod_net_id {}",
iterm_id,
mod_net_id);
iterm->connect(mod_net);
}
break;
}

Expand Down Expand Up @@ -622,6 +637,7 @@ void dbJournal::redo_disconnectObject()
2,
"REDO ECO: disconnect dbITermObj, iterm_id {}",
iterm_id);
// note: this will disconnect the modnet and the dbNet
iterm->disconnect();
break;
}
Expand Down Expand Up @@ -1618,6 +1634,7 @@ void dbJournal::undo_connectObject()
dbITerm* iterm = dbITerm::getITerm(_block, iterm_id);
uint net_id;
_log.pop(net_id);
// disconnects everything modnet and bnet)
iterm->disconnect();
break;
}
Expand Down Expand Up @@ -1653,8 +1670,17 @@ void dbJournal::undo_disconnectObject()
dbITerm* iterm = dbITerm::getITerm(_block, iterm_id);
uint net_id;
_log.pop(net_id);
dbNet* net = dbNet::getNet(_block, net_id);
iterm->connect(net);
if (net_id != 0) {
dbNet* net = dbNet::getNet(_block, net_id);
iterm->connect(net);
}
uint mnet_id;
_log.pop(mnet_id);
if (mnet_id != 0) {
dbModNet* mod_net = dbModNet::getModNet(_block, mnet_id);
iterm->connect(mod_net);
}

break;
}

Expand Down
7 changes: 7 additions & 0 deletions src/odb/src/db/dbModNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,13 @@ void dbModNet::reName(const char* new_name)
parent->_modnet_hash[new_name] = obj->getOID();
}

dbModNet* dbModNet::getModNet(dbBlock* block, uint id)
{
_dbBlock* block_ = (_dbBlock*) block;
_dbModNet* ret = block_->_modnet_tbl->getPtr(id);
return (dbModNet*) ret;
}

dbModNet* dbModNet::create(dbModule* parentModule, const char* name)
{
// give illusion of scoping.
Expand Down
1 change: 0 additions & 1 deletion src/odb/src/db/dbModuleBusPortModBTermItr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include "dbBusPort.h"
#include "dbModBTerm.h"
#include "dbModBTerm.h"
#include "dbModule.h"
#include "dbTable.h"

Expand Down
1 change: 0 additions & 1 deletion src/odb/src/db/dbModuleModBTermItr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include "dbBusPort.h"
#include "dbModBTerm.h"
#include "dbModBTerm.h"
#include "dbModule.h"
#include "dbTable.h"

Expand Down
1 change: 0 additions & 1 deletion src/odb/src/db/dbModuleModInstItr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
// Generator Code Begin Cpp
#include "dbModuleModInstItr.h"

#include "dbModInst.h"
#include "dbModInst.h"
#include "dbModule.h"
#include "dbTable.h"
Expand Down
1 change: 0 additions & 1 deletion src/odb/src/db/dbModuleModInstModITermItr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
// Generator Code Begin Cpp
#include "dbModuleModInstModITermItr.h"

#include "dbModITerm.h"
#include "dbModITerm.h"
#include "dbModInst.h"
#include "dbModule.h"
Expand Down
1 change: 0 additions & 1 deletion src/odb/src/db/dbModuleModNetItr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
// Generator Code Begin Cpp
#include "dbModuleModNetItr.h"

#include "dbModNet.h"
#include "dbModNet.h"
#include "dbModule.h"
#include "dbTable.h"
Expand Down
1 change: 0 additions & 1 deletion src/odb/src/db/dbModulePortItr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "dbBlock.h"
#include "dbBusPort.h"
#include "dbModBTerm.h"
#include "dbModBTerm.h"
#include "dbModule.h"
#include "dbTable.h"

Expand Down
6 changes: 5 additions & 1 deletion src/rsz/src/OdbCallBack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ void OdbCallBack::inDbInstSwapMasterAfter(dbInst* inst)
while (pin_iter->hasNext()) {
Pin* pin = pin_iter->next();
Net* net = network_->net(pin);
resizer_->parasiticsInvalid(net);
// we can only update parasitics for low level net
odb::dbNet* db_net = nullptr;
odb::dbModNet* db_modnet = nullptr;
db_network_->staToDb(net, db_net, db_modnet);
resizer_->parasiticsInvalid(db_network_->dbToSta(db_net));
}
}

Expand Down
Loading

0 comments on commit 8ee3bbf

Please sign in to comment.