Skip to content

Commit 3cc9aff

Browse files
committed
odb: read 3dbv header includes and update existing chiplets
Signed-off-by: osamahammad21 <[email protected]>
1 parent b6c92cb commit 3cc9aff

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

src/odb/include/odb/3dblox.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class ThreeDBlox
3737
void createConnection(const Connection& connection);
3838
dbChipRegionInst* resolvePath(const std::string& path,
3939
std::vector<dbChipInst*>& path_insts);
40+
void readHeaderIncludes(const std::vector<std::string>& includes);
4041

4142
utl::Logger* logger_ = nullptr;
4243
odb::dbDatabase* db_ = nullptr;

src/odb/src/3dblox/3dblox.cpp

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void ThreeDBlox::readDbv(const std::string& dbv_file)
5959
dbv_file);
6060
}
6161
}
62+
readHeaderIncludes(data.header.includes);
6263
for (const auto& [_, chiplet] : data.chiplet_defs) {
6364
createChiplet(chiplet);
6465
}
@@ -68,13 +69,7 @@ void ThreeDBlox::readDbx(const std::string& dbx_file)
6869
{
6970
DbxParser parser(logger_);
7071
DbxData data = parser.parseFile(dbx_file);
71-
for (const auto& include : data.header.includes) {
72-
if (include.find(".3dbv") != std::string::npos) {
73-
readDbv(include);
74-
} else if (include.find(".3dbx") != std::string::npos) {
75-
readDbx(include);
76-
}
77-
}
72+
readHeaderIncludes(data.header.includes);
7873
dbChip* chip = createDesignTopChiplet(data.design);
7974
for (const auto& [_, chip_inst] : data.chiplet_instances) {
8075
createChipInst(chip_inst);
@@ -86,6 +81,17 @@ void ThreeDBlox::readDbx(const std::string& dbx_file)
8681
db_->triggerPostRead3Dbx(chip);
8782
}
8883

84+
void ThreeDBlox::readHeaderIncludes(const std::vector<std::string>& includes)
85+
{
86+
for (const auto& include : includes) {
87+
if (include.find(".3dbv") != std::string::npos) {
88+
readDbv(include);
89+
} else if (include.find(".3dbx") != std::string::npos) {
90+
readDbx(include);
91+
}
92+
}
93+
}
94+
8995
dbChip::ChipType getChipType(const std::string& type, utl::Logger* logger)
9096
{
9197
if (type == "die") {
@@ -141,8 +147,21 @@ void ThreeDBlox::createChiplet(const ChipletDef& chiplet)
141147
lef_reader.createLib(tech, lib_name.c_str(), lef_file.c_str());
142148
}
143149
// TODO: Read liberty files
144-
dbChip* chip = dbChip::create(
145-
db_, tech, chiplet.name, getChipType(chiplet.type, logger_));
150+
// Check if chiplet already exists
151+
auto chip = db_->findChip(chiplet.name.c_str());
152+
if (chip != nullptr) {
153+
if (chip->getChipType() != getChipType(chiplet.type, logger_)
154+
|| chip->getChipType() != dbChip::ChipType::HIER) {
155+
logger_->error(utl::ODB,
156+
530,
157+
"3DBV Parser Error: Chiplet {} already exists",
158+
chiplet.name);
159+
}
160+
// chiplet already exists, update it
161+
} else {
162+
chip = dbChip::create(
163+
db_, tech, chiplet.name, getChipType(chiplet.type, logger_));
164+
}
146165
// Read DEF file
147166
if (!chiplet.external.def_file.empty()) {
148167
odb::defin def_reader(db_, logger_, odb::defin::DEFAULT);

0 commit comments

Comments
 (0)