Skip to content

Commit

Permalink
Cleanups :private methods, work in progress Signed-off-by: Andy Fox <…
Browse files Browse the repository at this point in the history
[email protected]>

Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed Mar 20, 2024
1 parent e7e9ab2 commit d1321d6
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 356 deletions.
87 changes: 19 additions & 68 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,6 @@ class dbBlock : public dbObject
///
dbSet<dbBlock> getChildren();

void getChildModules(std::vector<dbModule*>& child_modules);

///
/// Find a specific child-block of this block.
/// Returns nullptr if the object was not found.
Expand Down Expand Up @@ -1722,12 +1720,15 @@ class dbBTerm : public dbObject
///
void setSpecial();

///
/// Get the net of this block-terminal.
///
dbNet* getNet();

// AF
///
/// Get the mod net of this block-terminal.
dbModNet* getModNet();
///

/// Disconnect the block-terminal from it's net.
///
Expand Down Expand Up @@ -3244,15 +3245,7 @@ class dbInst : public dbObject
dbMaster* master,
const char* name,
bool physical_only = false,
dbModule* = nullptr);

///
/// Create a new instance within the specified region.
/// If physicalOnly is true the instance can't bee added to a dbModule.
/// If false, it will be added to the top module.
/// Returns nullptr if an instance with this name already exists.
/// Returns nullptr if the master is not FROZEN.
/// If db module present then the dbinst is added to that module
dbModule* parent_module = nullptr);

static dbInst* create(dbBlock* block,
dbMaster* master,
Expand Down Expand Up @@ -3315,7 +3308,6 @@ class dbITerm : public dbObject
///
dbNet* getNet();

// AF
dbModNet* getModNet();

///
Expand Down Expand Up @@ -3470,7 +3462,7 @@ class dbITerm : public dbObject
void connect(dbNet* net);

// connect this iterm to a dbmodNet
// AF.

void connect(dbModNet* net);

///
Expand Down Expand Up @@ -7491,38 +7483,18 @@ class dbModBTerm : public dbObject

dbModNet* getNet() const;

void setNextNetModbterm(dbModBTerm* next_net_modbterm);

dbModBTerm* getNextNetModbterm() const;

void setPrevNetModbterm(dbModBTerm* prev_net_modbterm);

dbModBTerm* getPrevNetModbterm() const;

void setNextEntry(dbModBTerm* next_entry);

dbModBTerm* getNextEntry() const;

// User Code Begin dbModBTerm

void setSigType(dbSigType& type);
void setSigType(dbSigType type);
dbSigType getSigType();
void setIoType(dbIoType type);
dbIoType getIoType();

static dbModBTerm* create(dbModule* parentModule, const char* name);

void connect(dbModNet*);
void connect(dbModNet* net);
void disconnect();

char* getName();

void staSetPort(void* p);
void* staPort();

private:
void setFlags(uint flags);
uint getFlags() const;
static dbModBTerm* create(dbModule* parentModule, const char* name);

// User Code End dbModBTerm
};
Expand Down Expand Up @@ -7561,37 +7533,18 @@ class dbModInst : public dbObject
class dbModITerm : public dbObject
{
public:
const char* getName() const;

dbModInst* getParent() const;

void setNet(dbModNet* net);

dbModNet* getNet() const;

void setNextNetModiterm(dbModITerm* next_net_moditerm);

dbModITerm* getNextNetModiterm() const;

void setPrevNetModiterm(dbModITerm* prev_net_moditerm);

dbModITerm* getPrevNetModiterm() const;

void setNextEntry(dbModITerm* next_entry);

dbModITerm* getNextEntry() const;

// User Code Begin dbModITerm
void setSigType(dbSigType& type);
dbSigType getSigType();
void setIoType(dbIoType& type);
dbIoType getIoType();
bool connect(dbModNet* modnet);

static dbModITerm* create(dbModInst* parentInstance, const char* name);
bool connect(dbModNet*);
char* getName();

private:
void setFlags(uint flags);
uint getFlags() const;

// User Code End dbModITerm
};
Expand All @@ -7607,9 +7560,8 @@ class dbModNet : public dbObject
dbSet<dbITerm> getITerms();
dbSet<dbBTerm> getBTerms();

static dbModNet* create(dbModule* parentModule, const char* name);
dbModNet* create(dbModule* parentModule, const char* name);
const char* getName() const;
dbModBTerm* connectedToModBTerm();
// User Code End dbModNet
};

Expand All @@ -7623,9 +7575,11 @@ class dbModule : public dbObject
dbModInst* getModInst() const;

// User Code Begin dbModule
std::string getHierarchicalName(std::string& separator);
std::string getHierarchicalName() const;
std::string hierarchicalNameR(std::string& separator);

// Get a mod net by name
dbModNet* getModNet(const char* net_name);

// Adding an inst to a new module will remove it from its previous
// module.
void addInst(dbInst* inst);
Expand All @@ -7635,7 +7589,6 @@ class dbModule : public dbObject
dbSet<dbModInst> getChildren();
dbSet<dbModInst> getModInsts();
dbSet<dbModNet> getModNets();
dbModNet* getModNet(const char* net_name);
dbSet<dbModBTerm> getModBTerms();
dbSet<dbInst> getInsts();

Expand All @@ -7651,10 +7604,8 @@ class dbModule : public dbObject

static dbModule* getModule(dbBlock* block_, uint dbid_);

unsigned getModInstCount();
unsigned getDbInstCount();

bool findPortIx(const char* port_name, unsigned& ix);
int getModInstCount();
int getDbInstCount();

void staSetCell(void* cell);
void* getStaCell();
Expand Down
3 changes: 2 additions & 1 deletion src/odb/src/codeGenerator/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"parentObject": "dbModBTerm",
"tableName": "modbterm_tbl",
"reversible": "true",
"orderReversed": "true",
"orderReversed": "true",
"flags":["private"],
"sequential": 0,
"includes": ["dbModBTerm.h", "dbModule.h"]
},
Expand Down
5 changes: 4 additions & 1 deletion src/odb/src/codeGenerator/schema/chip/dbModBterm.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"name":"_flags",
"type":"uint",
"flags":["no-set","no-get"]
"flags":["private"]
},
{
"name":"_parent",
Expand All @@ -26,16 +26,19 @@
{
"name":"_next_net_modbterm",
"type":"dbId<_dbModBTerm>",
"flags":["private"],
"parent":"dbBlock"
},
{
"name":"_prev_net_modbterm",
"type":"dbId<_dbModBTerm>",
"flags":["private"],
"parent":"dbBlock"
},
{
"name":"_next_entry",
"type":"dbId<_dbModBTerm>",
"flags":["private"],
"parent":"dbBlock"
}
],
Expand Down
10 changes: 4 additions & 6 deletions src/odb/src/codeGenerator/schema/chip/dbModIterm.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@
{
"name":"_name",
"type":"char *",
"flags":["no-set","no-get"]
"flags":["no-set"]
},
{
"name":"_flags",
"type":"uint",
"flags":["no-set","no-get"]
},
{
"name":"_parent",
"type":"dbId<_dbModInst>",
Expand All @@ -26,16 +21,19 @@
{
"name":"_next_net_moditerm",
"type":"dbId<_dbModITerm>",
"flags":["private"],
"parent":"dbBlock"
},
{
"name":"_prev_net_moditerm",
"type":"dbId<_dbModITerm>",
"flags":["private"],
"parent":"dbBlock"
},
{
"name":"_next_entry",
"type":"dbId<_dbModITerm>",
"flags":["private"],
"parent":"dbBlock"
}

Expand Down
27 changes: 9 additions & 18 deletions src/odb/src/db/dbBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ _dbBlock::_dbBlock(_dbDatabase* db, const _dbBlock& block)

_dbBlock::~_dbBlock()
{
if (_name) {
if (_name)
free((void*) _name);
}

delete _bterm_tbl;
delete _iterm_tbl;
delete _net_tbl;
Expand Down Expand Up @@ -693,12 +693,11 @@ _dbBlock::~_dbBlock()
_cbitr = _callbacks.begin();
(*_cbitr)->removeOwner();
}
if (_journal) {
if (_journal)
delete _journal;
}
if (_journal_pending) {

if (_journal_pending)
delete _journal_pending;
}
}

void dbBlock::clear()
Expand Down Expand Up @@ -4060,16 +4059,6 @@ dbTech* dbBlock::getTech()
return (dbTech*) block->getTech();
}

void dbBlock::getChildModules(std::vector<dbModule*>& child_modules)
{
_dbBlock* block = (_dbBlock*) this;
std::vector<odb::_dbModule*> contents;
block->_module_tbl->getObjects(contents);
for (auto dbm : contents) {
child_modules.push_back((dbModule*) dbm);
}
}

void dbBlock::dumpDebug()
{
_dbBlock* block = (_dbBlock*) this;
Expand Down Expand Up @@ -4144,10 +4133,12 @@ void dbBlock::dumpDebug()
dbModBTerm* module_port = *mod_bterm_iter;
printf("\t\tPort %s Net %s (%d)\n",
module_port->getName(),
module_port->getNet()
((_dbModNet*) module_port->getNet())
? ((_dbModNet*) module_port->getNet())->_name
: "No-modnet",
module_port->getNet() ? module_port->getNet()->getId() : -1);
((_dbModNet*) module_port->getNet())
? ((_dbModNet*) module_port->getNet())->getId()
: -1);
printf("\t\tPort parent %s\n\n", module_port->getParent()->getName());
}
printf("\t\tModBTermPorts ---\n");
Expand Down
Loading

0 comments on commit d1321d6

Please sign in to comment.