Skip to content
Open
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
1 change: 1 addition & 0 deletions src/odb/src/db/dbBTerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ dbBTerm* dbBTerm::create(dbNet* net_, const char* name)
master_impl->flags_.frozen = 1;
mterm->order_id_ = inst_hdr->mterms_.size();
inst_hdr->mterms_.push_back(mterm->getOID());
inst_hdr->mterm_ptrs_.push_back(mterm);

_dbInst* inst_impl = (_dbInst*) inst;
_dbHier* hier = parent_block->hier_tbl_->getPtr(inst_impl->hierarchy_);
Expand Down
15 changes: 15 additions & 0 deletions src/odb/src/db/dbBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@
#include "dbIsolation.h"
#include "dbJournal.h"
#include "dbLevelShifter.h"
#include "dbLib.h"
#include "dbLogicPort.h"
#include "dbMTerm.h"
#include "dbMarkerCategory.h"
#include "dbMaster.h"
#include "dbModBTerm.h"
#include "dbModITerm.h"
#include "dbModInst.h"
Expand Down Expand Up @@ -981,6 +984,18 @@ dbIStream& operator>>(dbIStream& stream, _dbBlock& block)
stream >> *block.iterm_tbl_;
stream >> *block.net_tbl_;
stream >> *block.inst_hdr_tbl_;

for (dbInstHdr* hdr_public :
dbSet<dbInstHdr>((dbBlock*) &block, block.inst_hdr_tbl_)) {
_dbInstHdr* inst_hdr = (_dbInstHdr*) hdr_public;
_dbLib* lib = db->lib_tbl_->getPtr(inst_hdr->lib_);
_dbMaster* master = lib->master_tbl_->getPtr(inst_hdr->master_);
inst_hdr->mterm_ptrs_.resize(master->mterm_cnt_);
for (int i = 0; i < master->mterm_cnt_; ++i) {
dbId<_dbMTerm> mterm = inst_hdr->mterms_[i];
inst_hdr->mterm_ptrs_[i] = master->mterm_tbl_->getPtr(mterm);
}
}
if (db->isSchema(kSchemaDbRemoveHash)) {
stream >> *block.module_tbl_;
stream >> *block.inst_tbl_;
Expand Down
12 changes: 2 additions & 10 deletions src/odb/src/db/dbITerm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ _dbMTerm* _dbITerm::getMTerm() const
_dbBlock* block = (_dbBlock*) getOwner();
_dbInst* inst = block->inst_tbl_->getPtr(inst_);
_dbInstHdr* inst_hdr = block->inst_hdr_tbl_->getPtr(inst->inst_hdr_);
_dbDatabase* db = getDatabase();
_dbLib* lib = db->lib_tbl_->getPtr(inst_hdr->lib_);
_dbMaster* master = lib->master_tbl_->getPtr(inst_hdr->master_);
dbId<_dbMTerm> mterm = inst_hdr->mterms_[flags_.mterm_idx];
return master->mterm_tbl_->getPtr(mterm);
return inst_hdr->mterm_ptrs_[flags_.mterm_idx];
}

_dbInst* _dbITerm::getInst() const
Expand Down Expand Up @@ -161,11 +157,7 @@ dbMTerm* dbITerm::getMTerm() const
_dbBlock* block = (_dbBlock*) iterm->getOwner();
_dbInst* inst = block->inst_tbl_->getPtr(iterm->inst_);
_dbInstHdr* inst_hdr = block->inst_hdr_tbl_->getPtr(inst->inst_hdr_);
_dbDatabase* db = iterm->getDatabase();
_dbLib* lib = db->lib_tbl_->getPtr(inst_hdr->lib_);
_dbMaster* master = lib->master_tbl_->getPtr(inst_hdr->master_);
dbId<_dbMTerm> mterm = inst_hdr->mterms_[iterm->flags_.mterm_idx];
return (dbMTerm*) master->mterm_tbl_->getPtr(mterm);
return (dbMTerm*) inst_hdr->mterm_ptrs_[iterm->flags_.mterm_idx];
}

dbBTerm* dbITerm::getBTerm()
Expand Down
6 changes: 5 additions & 1 deletion src/odb/src/db/dbInstHdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ _dbInstHdr::_dbInstHdr(_dbDatabase*, const _dbInstHdr& i)
lib_(i.lib_),
master_(i.master_),
mterms_(i.mterms_),
mterm_ptrs_(i.mterm_ptrs_),
inst_cnt_(i.inst_cnt_)
{
}
Expand Down Expand Up @@ -164,11 +165,14 @@ dbInstHdr* dbInstHdr::create(dbBlock* block_, dbMaster* master_)
// MACRO until the complete MACRO is parsed...
//
inst_hdr->mterms_.resize(master->mterm_cnt_);
inst_hdr->mterm_ptrs_.resize(master->mterm_cnt_);

// mterms, this set is ordered: {output, inout, input}
int i = 0;
for (dbMTerm* mterm : master_->getMTerms()) {
inst_hdr->mterms_[i++] = mterm->getImpl()->getOID();
inst_hdr->mterms_[i] = mterm->getImpl()->getOID();
inst_hdr->mterm_ptrs_[i] = (_dbMTerm*) mterm;
i++;
}

return (dbInstHdr*) inst_hdr;
Expand Down
4 changes: 3 additions & 1 deletion src/odb/src/db/dbInstHdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <cstdint>
#include <vector>

#include "dbCore.h"
#include "dbVector.h"
Expand Down Expand Up @@ -48,7 +49,8 @@ class _dbInstHdr : public _dbObject
dbId<_dbLib> lib_;
dbId<_dbMaster> master_;
dbVector<dbId<_dbMTerm>> mterms_;
int inst_cnt_; // number of instances of this InstHdr
std::vector<_dbMTerm*> mterm_ptrs_; // non-persistent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::vector" is directly included [misc-include-cleaner]

src/odb/src/db/dbInstHdr.h:6:

+ #include <vector>

int inst_cnt_; // number of instances of this InstHdr
};

dbOStream& operator<<(dbOStream& stream, const _dbInstHdr& inst_hdr);
Expand Down