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
0 commit comments