Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odb undo #5491

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,14 @@ class dbDatabase : public dbObject
///
static void commitEco(dbBlock* block);

///
/// Undo any pending netlist changes. Only supports:
/// create and destroy of dbInst and dbNet
/// dbInst::swapMaster
/// connect and disconnect of dbBTerm and dbITerm
///
static void undoEco(dbBlock* block);

///
/// links to utl::Logger
///
Expand Down
8 changes: 5 additions & 3 deletions src/odb/src/db/dbBTerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ void dbBTerm::connect(dbNet* net_)
net->_name);
}

if (bterm->_net) {
disconnect();
}

if (block->_journal) {
debugPrint(block->getImpl()->getLogger(),
utl::ODB,
Expand All @@ -510,9 +514,6 @@ void dbBTerm::connect(dbNet* net_)
block->_journal->endAction();
}

if (bterm->_net) {
bterm->disconnectNet(bterm, block);
}
bterm->connectNet(net, block);
}

Expand Down Expand Up @@ -541,6 +542,7 @@ void dbBTerm::disconnect()
block->_journal->beginAction(dbJournal::DISCONNECT_OBJECT);
block->_journal->pushParam(dbBTermObj);
block->_journal->pushParam(bterm->getId());
block->_journal->pushParam(net->getOID());
block->_journal->endAction();
}

Expand Down
14 changes: 12 additions & 2 deletions src/odb/src/db/dbDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,15 +610,25 @@ void dbDatabase::commitEco(dbBlock* block_)
_dbBlock* block = (_dbBlock*) block_;

// TODO: Need a check to ensure the commit is not applied to the block of
// which
// this eco was generated from.
// which this eco was generated from.
if (block->_journal_pending) {
block->_journal_pending->redo();
delete block->_journal_pending;
block->_journal_pending = nullptr;
}
}

void dbDatabase::undoEco(dbBlock* block_)
{
_dbBlock* block = (_dbBlock*) block_;

if (block->_journal_pending) {
block->_journal_pending->undo();
delete block->_journal_pending;
block->_journal_pending = nullptr;
}
}

void dbDatabase::setLogger(utl::Logger* logger)
{
_dbDatabase* _db = (_dbDatabase*) this;
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 @@ -547,6 +547,7 @@ void dbITerm::disconnect()
block->_journal->beginAction(dbJournal::DISCONNECT_OBJECT);
block->_journal->pushParam(dbITermObj);
block->_journal->pushParam(getId());
block->_journal->pushParam(net->getOID());
block->_journal->endAction();
}

Expand Down
22 changes: 14 additions & 8 deletions src/odb/src/db/dbInst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,8 @@ dbInst* dbInst::create(dbBlock* block_,
name_);
}

_dbInst* inst = block->_inst_tbl->create();

if (block->_journal) {
debugPrint(block->getImpl()->getLogger(),
utl::ODB,
Expand All @@ -1419,10 +1421,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());
block->_journal->endAction();
}

_dbInst* inst = block->_inst_tbl->create();
inst->_name = strdup(name_);
ZALLOCATED(inst->_name);
inst->_inst_hdr = inst_hdr->getOID();
Expand Down Expand Up @@ -1563,19 +1565,19 @@ void dbInst::destroy(dbInst* inst_)
uint i;
uint n = inst->_iterms.size();

// Delete these in reverse order so undo creates the in
// the correct order.
for (i = 0; i < n; ++i) {
dbId<_dbITerm> id = inst->_iterms[i];
dbId<_dbITerm> id = inst->_iterms[n - 1 - i];
_dbITerm* it = block->_iterm_tbl->getPtr(id);
((dbITerm*) it)->disconnect();

// Bugzilla #7: notify when pins are deleted (assumption: pins
// are destroyed only when the related instance is destroyed)
// payam 01/10/2006
// Notify when pins are deleted (assumption: pins are destroyed only when
// the related instance is destroyed)
std::list<dbBlockCallBackObj*>::iterator cbitr;
for (cbitr = block->_callbacks.begin(); cbitr != block->_callbacks.end();
++cbitr) {
(**cbitr)().inDbITermDestroy(
(dbITerm*) it); // client ECO optimization - payam
(**cbitr)().inDbITermDestroy((dbITerm*) it);
}

dbProperty::destroyProperties(it);
Expand All @@ -1597,9 +1599,13 @@ void dbInst::destroy(dbInst* inst_)
"DB_ECO",
1,
"ECO: dbInst:destroy");
auto master = inst_->getMaster();
block->_journal->beginAction(dbJournal::DELETE_OBJECT);
block->_journal->pushParam(dbInstObj);
block->_journal->pushParam(inst->getId());
block->_journal->pushParam(master->getLib()->getId());
block->_journal->pushParam(master->getId());
block->_journal->pushParam(inst_->getName().c_str());
block->_journal->pushParam(inst_->getId());
block->_journal->endAction();
}

Expand Down
Loading
Loading