Skip to content

Commit bb6b307

Browse files
committed
odb: dbChipConn
Signed-off-by: Osama <[email protected]>
1 parent 98e31ba commit bb6b307

File tree

12 files changed

+340
-0
lines changed

12 files changed

+340
-0
lines changed

src/odb/include/odb/db.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ class dbAccessPoint;
106106
class dbBusPort;
107107
class dbCellEdgeSpacing;
108108
class dbChip;
109+
class dbChipConn;
109110
class dbChipInst;
110111
class dbChipRegion;
111112
class dbChipRegionInst;
@@ -7029,6 +7030,35 @@ class dbChip : public dbObject
70297030
// User Code End dbChip
70307031
};
70317032

7033+
class dbChipConn : public dbObject
7034+
{
7035+
public:
7036+
std::string getName() const;
7037+
7038+
void setThickness(int thickness);
7039+
7040+
int getThickness() const;
7041+
7042+
// User Code Begin dbChipConn
7043+
7044+
dbChipRegionInst* getTopRegion() const;
7045+
7046+
dbChipRegionInst* getBottomRegion() const;
7047+
7048+
std::vector<dbChipInst*> getTopRegionPath() const;
7049+
7050+
std::vector<dbChipInst*> getBottomRegionPath() const;
7051+
7052+
static dbChipConn* create(const std::string& name,
7053+
dbChipRegionInst* top_region,
7054+
dbChipRegionInst* bottom_region,
7055+
std::vector<dbChipInst*> top_region_path,
7056+
std::vector<dbChipInst*> bottom_region_path);
7057+
7058+
static void destroy(dbChipConn* chipConn);
7059+
// User Code End dbChipConn
7060+
};
7061+
70327062
class dbChipInst : public dbObject
70337063
{
70347064
public:
@@ -7115,6 +7145,8 @@ class dbDatabase : public dbObject
71157145

71167146
dbSet<dbChipRegionInst> getChipRegionInsts() const;
71177147

7148+
dbSet<dbChipConn> getChipConns() const;
7149+
71187150
// User Code Begin dbDatabase
71197151

71207152
void setTopChip(dbChip* chip);

src/odb/include/odb/dbCompare.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,15 @@ struct less<odb::dbChip*>
479479
}
480480
};
481481

482+
template <>
483+
struct less<odb::dbChipConn*>
484+
{
485+
bool operator()(const odb::dbChipConn* lhs, const odb::dbChipConn* rhs) const
486+
{
487+
return odb::compare_by_id(lhs, rhs);
488+
}
489+
};
490+
482491
template <>
483492
struct less<odb::dbChipInst*>
484493
{

src/odb/include/odb/dbObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ enum dbObjectType
6161
dbBusPortObj,
6262
dbCellEdgeSpacingObj,
6363
dbChipObj,
64+
dbChipConnObj,
6465
dbChipInstObj,
6566
dbChipRegionObj,
6667
dbChipRegionInstObj,

src/odb/src/codeGenerator/schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,14 @@
429429
"tbl_name":"chip_region_inst_tbl_",
430430
"schema":"db_schema_chip_region",
431431
"flags": ["no-serial"]
432+
},
433+
{
434+
"parent":"dbDatabase",
435+
"child":"dbChipConn",
436+
"type":"1_n",
437+
"tbl_name":"chip_conn_tbl_",
438+
"schema":"db_schema_chip_region",
439+
"flags": ["no-serial"]
432440
}
433441
]
434442
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "dbChipConn",
3+
"type": "dbObject",
4+
"fields": [
5+
{ "name": "name_", "type": "std::string", "flags": ["no-set"] },
6+
{ "name": "thickness_", "type": "int", "flags": [] },
7+
{ "name": "top_region_", "type": "dbId<_dbChipRegionInst>", "flags": ["private"] },
8+
{ "name": "top_region_path_", "type": "std::vector<dbId<_dbChipInst>>", "flags": ["private"] },
9+
{ "name": "bottom_region_", "type": "dbId<_dbChipRegionInst>", "flags": ["private"] },
10+
{ "name": "bottom_region_path_", "type": "std::vector<dbId<_dbChipInst>>", "flags": ["private"] }
11+
],
12+
"h_includes": ["odb/dbId.h"],
13+
"cpp_includes": ["dbChipRegionInst.h", "dbChipInst.h", "dbChipRegion.h", "dbChip.h"]
14+
}

src/odb/src/db/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ add_library(db
8888
dbBusPort.cpp
8989
dbCellEdgeSpacing.cpp
9090
dbChip.cpp
91+
dbChipConn.cpp
9192
dbChipInst.cpp
9293
dbChipRegion.cpp
9394
dbChipRegionInst.cpp

src/odb/src/db/dbChipConn.cpp

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
// Copyright (c) 2019-2025, The OpenROAD Authors
3+
4+
// Generator Code Begin Cpp
5+
#include "dbChipConn.h"
6+
7+
#include <string>
8+
#include <vector>
9+
10+
#include "dbChip.h"
11+
#include "dbChipInst.h"
12+
#include "dbChipRegion.h"
13+
#include "dbChipRegionInst.h"
14+
#include "dbDatabase.h"
15+
#include "dbTable.h"
16+
#include "dbTable.hpp"
17+
#include "odb/db.h"
18+
namespace odb {
19+
template class dbTable<_dbChipConn>;
20+
21+
bool _dbChipConn::operator==(const _dbChipConn& rhs) const
22+
{
23+
if (name_ != rhs.name_) {
24+
return false;
25+
}
26+
if (thickness_ != rhs.thickness_) {
27+
return false;
28+
}
29+
if (top_region_ != rhs.top_region_) {
30+
return false;
31+
}
32+
if (bottom_region_ != rhs.bottom_region_) {
33+
return false;
34+
}
35+
36+
return true;
37+
}
38+
39+
bool _dbChipConn::operator<(const _dbChipConn& rhs) const
40+
{
41+
return true;
42+
}
43+
44+
_dbChipConn::_dbChipConn(_dbDatabase* db)
45+
{
46+
}
47+
48+
dbIStream& operator>>(dbIStream& stream, _dbChipConn& obj)
49+
{
50+
stream >> obj.name_;
51+
stream >> obj.thickness_;
52+
stream >> obj.top_region_;
53+
stream >> obj.top_region_path_;
54+
stream >> obj.bottom_region_;
55+
stream >> obj.bottom_region_path_;
56+
return stream;
57+
}
58+
59+
dbOStream& operator<<(dbOStream& stream, const _dbChipConn& obj)
60+
{
61+
stream << obj.name_;
62+
stream << obj.thickness_;
63+
stream << obj.top_region_;
64+
stream << obj.top_region_path_;
65+
stream << obj.bottom_region_;
66+
stream << obj.bottom_region_path_;
67+
return stream;
68+
}
69+
70+
void _dbChipConn::collectMemInfo(MemInfo& info)
71+
{
72+
info.cnt++;
73+
info.size += sizeof(*this);
74+
}
75+
76+
////////////////////////////////////////////////////////////////////
77+
//
78+
// dbChipConn - Methods
79+
//
80+
////////////////////////////////////////////////////////////////////
81+
82+
std::string dbChipConn::getName() const
83+
{
84+
_dbChipConn* obj = (_dbChipConn*) this;
85+
return obj->name_;
86+
}
87+
88+
void dbChipConn::setThickness(int thickness)
89+
{
90+
_dbChipConn* obj = (_dbChipConn*) this;
91+
92+
obj->thickness_ = thickness;
93+
}
94+
95+
int dbChipConn::getThickness() const
96+
{
97+
_dbChipConn* obj = (_dbChipConn*) this;
98+
return obj->thickness_;
99+
}
100+
101+
// User Code Begin dbChipConnPublicMethods
102+
dbChipRegionInst* dbChipConn::getTopRegion() const
103+
{
104+
_dbChipConn* obj = (_dbChipConn*) this;
105+
_dbDatabase* _db = (_dbDatabase*) obj->getOwner();
106+
return (dbChipRegionInst*) _db->chip_region_inst_tbl_->getPtr(
107+
obj->top_region_);
108+
}
109+
110+
dbChipRegionInst* dbChipConn::getBottomRegion() const
111+
{
112+
_dbChipConn* obj = (_dbChipConn*) this;
113+
_dbDatabase* _db = (_dbDatabase*) obj->getOwner();
114+
return (dbChipRegionInst*) _db->chip_region_inst_tbl_->getPtr(
115+
obj->bottom_region_);
116+
}
117+
118+
std::vector<dbChipInst*> dbChipConn::getTopRegionPath() const
119+
{
120+
_dbChipConn* obj = (_dbChipConn*) this;
121+
_dbDatabase* _db = (_dbDatabase*) obj->getOwner();
122+
std::vector<dbChipInst*> top_region_path;
123+
for (auto chipinst_id : obj->top_region_path_) {
124+
top_region_path.push_back(
125+
(dbChipInst*) _db->chip_inst_tbl_->getPtr(chipinst_id));
126+
}
127+
return top_region_path;
128+
}
129+
130+
std::vector<dbChipInst*> dbChipConn::getBottomRegionPath() const
131+
{
132+
_dbChipConn* obj = (_dbChipConn*) this;
133+
_dbDatabase* _db = (_dbDatabase*) obj->getOwner();
134+
std::vector<dbChipInst*> bottom_region_path;
135+
for (auto chipinst_id : obj->bottom_region_path_) {
136+
bottom_region_path.push_back(
137+
(dbChipInst*) _db->chip_inst_tbl_->getPtr(chipinst_id));
138+
}
139+
return bottom_region_path;
140+
}
141+
142+
dbChipConn* dbChipConn::create(const std::string& name,
143+
dbChipRegionInst* top_region,
144+
dbChipRegionInst* bottom_region,
145+
std::vector<dbChipInst*> top_region_path,
146+
std::vector<dbChipInst*> bottom_region_path)
147+
{
148+
_dbDatabase* _db = (_dbDatabase*) top_region->getImpl()->getOwner();
149+
_dbChipConn* obj = (_dbChipConn*) _db->chip_conn_tbl_->create();
150+
obj->name_ = name;
151+
obj->thickness_ = 0;
152+
obj->top_region_ = top_region->getImpl()->getOID();
153+
obj->bottom_region_ = bottom_region->getImpl()->getOID();
154+
std::vector<dbId<_dbChipInst>> top_region_path_ids;
155+
for (auto chipinst : top_region_path) {
156+
top_region_path_ids.push_back(chipinst->getImpl()->getOID());
157+
}
158+
obj->top_region_path_ = top_region_path_ids;
159+
std::vector<dbId<_dbChipInst>> bottom_region_path_ids;
160+
for (auto chipinst : bottom_region_path) {
161+
bottom_region_path_ids.push_back(chipinst->getImpl()->getOID());
162+
}
163+
obj->bottom_region_path_ = bottom_region_path_ids;
164+
return (dbChipConn*) obj;
165+
}
166+
167+
void dbChipConn::destroy(dbChipConn* chipConn)
168+
{
169+
_dbChipConn* obj = (_dbChipConn*) chipConn;
170+
_dbDatabase* _db = (_dbDatabase*) obj->getOwner();
171+
_db->chip_conn_tbl_->destroy(obj);
172+
}
173+
174+
// User Code End dbChipConnPublicMethods
175+
} // namespace odb
176+
// Generator Code End Cpp

src/odb/src/db/dbChipConn.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
// Copyright (c) 2019-2025, The OpenROAD Authors
3+
4+
// Generator Code Begin Header
5+
#pragma once
6+
7+
#include <string>
8+
#include <vector>
9+
10+
#include "dbCore.h"
11+
#include "odb/dbId.h"
12+
#include "odb/odb.h"
13+
14+
namespace odb {
15+
class dbIStream;
16+
class dbOStream;
17+
class _dbDatabase;
18+
class _dbChipRegionInst;
19+
class _dbChipInst;
20+
21+
class _dbChipConn : public _dbObject
22+
{
23+
public:
24+
_dbChipConn(_dbDatabase*);
25+
26+
bool operator==(const _dbChipConn& rhs) const;
27+
bool operator!=(const _dbChipConn& rhs) const { return !operator==(rhs); }
28+
bool operator<(const _dbChipConn& rhs) const;
29+
void collectMemInfo(MemInfo& info);
30+
31+
std::string name_;
32+
int thickness_;
33+
dbId<_dbChipRegionInst> top_region_;
34+
std::vector<dbId<_dbChipInst>> top_region_path_;
35+
dbId<_dbChipRegionInst> bottom_region_;
36+
std::vector<dbId<_dbChipInst>> bottom_region_path_;
37+
};
38+
dbIStream& operator>>(dbIStream& stream, _dbChipConn& obj);
39+
dbOStream& operator<<(dbOStream& stream, const _dbChipConn& obj);
40+
} // namespace odb
41+
// Generator Code End Header

0 commit comments

Comments
 (0)