Skip to content

Commit 2026ff0

Browse files
committed
odb: add dbChipNet
Signed-off-by: Osama <[email protected]>
1 parent bbc6a93 commit 2026ff0

File tree

17 files changed

+565
-0
lines changed

17 files changed

+565
-0
lines changed

src/odb/include/odb/db.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class dbChipBump;
110110
class dbChipBumpInst;
111111
class dbChipConn;
112112
class dbChipInst;
113+
class dbChipNet;
113114
class dbChipRegion;
114115
class dbChipRegionInst;
115116
class dbDatabase;
@@ -7014,6 +7015,8 @@ class dbChip : public dbObject
70147015

70157016
dbSet<dbChipConn> getChipConns() const;
70167017

7018+
dbSet<dbChipNet> getChipNets() const;
7019+
70177020
///
70187021
/// Create a new chip.
70197022
/// Returns nullptr if there is no database technology.
@@ -7131,6 +7134,25 @@ class dbChipInst : public dbObject
71317134
// User Code End dbChipInst
71327135
};
71337136

7137+
class dbChipNet : public dbObject
7138+
{
7139+
public:
7140+
std::string getName() const;
7141+
// User Code Begin dbChipNet
7142+
dbChip* getChip() const;
7143+
7144+
uint getNumBumpInsts() const;
7145+
7146+
dbChipBumpInst* getBumpInst(uint index, std::vector<dbChipInst*>& path) const;
7147+
7148+
void addBumpInst(dbChipBumpInst* bump_inst, std::vector<dbChipInst*> path);
7149+
7150+
static dbChipNet* create(dbChip* chip, const std::string& name);
7151+
7152+
static void destroy(dbChipNet* net);
7153+
// User Code End dbChipNet
7154+
};
7155+
71347156
class dbChipRegion : public dbObject
71357157
{
71367158
public:
@@ -7196,6 +7218,8 @@ class dbDatabase : public dbObject
71967218

71977219
dbSet<dbChipBumpInst> getChipBumpInsts() const;
71987220

7221+
dbSet<dbChipNet> getChipNets() const;
7222+
71997223
// User Code Begin dbDatabase
72007224

72017225
void setTopChip(dbChip* chip);

src/odb/include/odb/dbCompare.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,15 @@ struct less<odb::dbChipInst*>
516516
}
517517
};
518518

519+
template <>
520+
struct less<odb::dbChipNet*>
521+
{
522+
bool operator()(const odb::dbChipNet* lhs, const odb::dbChipNet* rhs) const
523+
{
524+
return odb::compare_by_id(lhs, rhs);
525+
}
526+
};
527+
519528
template <>
520529
struct less<odb::dbChipRegion*>
521530
{

src/odb/include/odb/dbObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ enum dbObjectType
6565
dbChipBumpInstObj,
6666
dbChipConnObj,
6767
dbChipInstObj,
68+
dbChipNetObj,
6869
dbChipRegionObj,
6970
dbChipRegionInstObj,
7071
dbDatabaseObj,

src/odb/src/codeGenerator/schema.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@
198198
"orderReversed": "true",
199199
"sequential": 0,
200200
"includes": ["dbChipBumpInst.h", "dbChipRegionInst.h"]
201+
},
202+
{
203+
"name": "dbChipNetItr",
204+
"parentObject": "dbChipNet",
205+
"tableName": "chip_net_tbl",
206+
"reversible": "true",
207+
"orderReversed": "true",
208+
"sequential": 0,
209+
"includes": ["dbChipNet.h", "dbChip.h"]
201210
}
202211
],
203212
"relations":[
@@ -471,6 +480,14 @@
471480
"tbl_name":"chip_bump_inst_tbl_",
472481
"schema":"db_schema_chip_bump",
473482
"flags": ["no-serial"]
483+
},
484+
{
485+
"parent":"dbDatabase",
486+
"child":"dbChipNet",
487+
"type":"1_n",
488+
"tbl_name":"chip_net_tbl_",
489+
"schema":"db_schema_chip_region",
490+
"flags": ["no-serial"]
474491
}
475492
]
476493
}

src/odb/src/codeGenerator/schema/chip/dbChip.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@
154154
"type": "dbId<_dbChipConn>",
155155
"flags": ["private"],
156156
"schema": "db_schema_chip_region"
157+
},
158+
{
159+
"name": "nets_",
160+
"type": "dbId<_dbChipNet>",
161+
"flags": ["private"],
162+
"schema": "db_schema_chip_bump"
157163
}
158164
],
159165
"declared_classes": ["dbPropertyItr", "_dbNameCache","dbBlockItr"],
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "dbChipNet",
3+
"type": "dbObject",
4+
"fields": [
5+
{
6+
"name": "name_",
7+
"type": "std::string",
8+
"flags": [
9+
"no-set"
10+
]
11+
},
12+
{
13+
"name": "chip_",
14+
"type": "dbId<_dbChip>",
15+
"flags": [
16+
"private"
17+
]
18+
},
19+
{
20+
"name": "chip_net_next_",
21+
"type": "dbId<_dbChipNet>",
22+
"flags": [
23+
"private"
24+
]
25+
},
26+
{
27+
"name": "bump_insts_paths_",
28+
"type": "std::vector<std::pair<std::vector<dbId<_dbChipInst>>, dbId<_dbChipBumpInst>>>",
29+
"flags": [
30+
"private"
31+
]
32+
}
33+
],
34+
"h_includes": [
35+
"odb/dbId.h"
36+
],
37+
"cpp_includes": [
38+
"dbChipRegionInst.h",
39+
"dbChipInst.h",
40+
"dbChipBumpInst.h",
41+
"dbChip.h"
42+
]
43+
}

src/odb/src/db/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ add_library(db
9292
dbChipBumpInst.cpp
9393
dbChipConn.cpp
9494
dbChipInst.cpp
95+
dbChipNet.cpp
9596
dbChipRegion.cpp
9697
dbChipRegionInst.cpp
9798
dbDatabase.cpp
@@ -153,6 +154,7 @@ add_library(db
153154
dbChipBumpInstItr.cpp
154155
dbChipConnItr.cpp
155156
dbChipInstItr.cpp
157+
dbChipNetItr.cpp
156158
dbChipRegionInstItr.cpp
157159
dbGroupInstItr.cpp
158160
dbGroupItr.cpp

src/odb/src/db/dbChip.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "dbChipConnItr.h"
2222
#include "dbChipInst.h"
2323
#include "dbChipInstItr.h"
24+
#include "dbChipNet.h"
25+
#include "dbChipNetItr.h"
2426
// User Code End Includes
2527
namespace odb {
2628
template class dbTable<_dbChip>;
@@ -84,6 +86,9 @@ bool _dbChip::operator==(const _dbChip& rhs) const
8486
if (conns_ != rhs.conns_) {
8587
return false;
8688
}
89+
if (nets_ != rhs.nets_) {
90+
return false;
91+
}
8792
if (*_prop_tbl != *rhs._prop_tbl) {
8893
return false;
8994
}
@@ -205,6 +210,9 @@ dbIStream& operator>>(dbIStream& stream, _dbChip& obj)
205210
if (obj.getDatabase()->isSchema(db_schema_chip_region)) {
206211
stream >> obj.conns_;
207212
}
213+
if (obj.getDatabase()->isSchema(db_schema_chip_region)) {
214+
stream >> obj.nets_;
215+
}
208216
if (obj.getDatabase()->isSchema(db_schema_chip_region)) {
209217
stream >> *obj.chip_region_tbl_;
210218
}
@@ -241,6 +249,7 @@ dbOStream& operator<<(dbOStream& stream, const _dbChip& obj)
241249
stream << obj._top;
242250
stream << obj.chipinsts_;
243251
stream << obj.conns_;
252+
stream << obj.nets_;
244253
stream << *obj.chip_region_tbl_;
245254
// User Code Begin <<
246255
stream << *obj._block_tbl;
@@ -530,6 +539,13 @@ dbSet<dbChipConn> dbChip::getChipConns() const
530539
return dbSet<dbChipConn>(chip, db->chip_conn_itr_);
531540
}
532541

542+
dbSet<dbChipNet> dbChip::getChipNets() const
543+
{
544+
_dbChip* chip = (_dbChip*) this;
545+
_dbDatabase* db = (_dbDatabase*) chip->getOwner();
546+
return dbSet<dbChipNet>(chip, db->chip_net_itr_);
547+
}
548+
533549
dbChip* dbChip::create(dbDatabase* db_, const std::string& name, ChipType type)
534550
{
535551
_dbDatabase* db = (_dbDatabase*) db_;

src/odb/src/db/dbChip.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class _dbChipRegion;
2020
class _dbBlock;
2121
class _dbChipInst;
2222
class _dbChipConn;
23+
class _dbChipNet;
2324

2425
class _dbChip : public _dbObject
2526
{
@@ -58,6 +59,7 @@ class _dbChip : public _dbObject
5859
dbPropertyItr* _prop_itr;
5960
dbId<_dbChipInst> chipinsts_;
6061
dbId<_dbChipConn> conns_;
62+
dbId<_dbChipNet> nets_;
6163
dbTable<_dbProperty>* _prop_tbl;
6264
dbTable<_dbChipRegion>* chip_region_tbl_;
6365
dbId<_dbChip> _next_entry;

0 commit comments

Comments
 (0)