@@ -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+
8995dbChip::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