Skip to content

Conversation

@rafaelmoresco
Copy link
Contributor

Draft PR for 3Dblox writers

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@rafaelmoresco rafaelmoresco marked this pull request as ready for review October 20, 2025 12:06
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 79. Check the log or trigger a new build to see more.

Copy link
Member

@osamahammad21 osamahammad21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at the dbxWriter yet but here is a review of the dbvWriter.

@osamahammad21
Copy link
Member

@rafaelmoresco Also please address:

  • Clang-tidy review requests
  • CI failures
  • format the code

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 40. Check the log or trigger a new build to see more.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

#include "baseWriter.h"

#include <yaml-cpp/yaml.h>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header yaml.h is not used directly [misc-include-cleaner]

Suggested change

{
}

void BaseWriter::writeHeader(YAML::Node& header_node, odb::dbDatabase* db)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "YAML::Node" is directly included [misc-include-cleaner]

src/odb/src/3dblox/baseWriter.cpp:5:

- #include <yaml-cpp/yaml.h>
+ #include <yaml-cpp/node/node.h>
+ #include <yaml-cpp/yaml.h>

lef_writer.writeTechAndLib(lib);
}
YAML::Node list_node;
list_node.SetStyle(YAML::EmitterStyle::Flow);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "YAML::EmitterStyle" is directly included [misc-include-cleaner]

src/odb/src/3dblox/baseWriter.cpp:5:

- #include <yaml-cpp/yaml.h>
+ #include <yaml-cpp/emitterstyle.h>
+ #include <yaml-cpp/yaml.h>

return "~";
}

std::string path = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redundant string initialization [readability-redundant-string-init]

Suggested change
std::string path = "";
std::string path;

void writeConnection(YAML::Node& connection_node,
odb::dbChipConn* conn,
odb::dbDatabase* db);
std::string buildPath(const std::vector<dbChipInst*>& path_insts,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::vector" is directly included [misc-include-cleaner]

src/odb/src/3dblox/dbxWriter.h:8:

+ #include <vector>

Copy link
Member

@osamahammad21 osamahammad21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think hierarchical chiplet instantiation is handled in this PR. for example, let's say that the top design is instantiating a hierarchical chiplet. Where is the part that writes out the dbx of that hierarchical chiplet, not the top design?

default:
break;
}
double u = db->getDbuPerMicron();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
double u = db->getDbuPerMicron();
const double u = db->getDbuPerMicron();

Comment on lines +55 to +56
auto chip_type = chiplet->getChipType();
switch (chip_type) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto chip_type = chiplet->getChipType();
switch (chip_type) {
const auto chip_type = chiplet->getChipType();
switch (chip_type) {

or

Suggested change
auto chip_type = chiplet->getChipType();
switch (chip_type) {
switch (chiplet->getChipType();) {

Comment on lines +137 to +138
auto side = region->getSide();
switch (side) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto side = region->getSide();
switch (side) {
const auto side = region->getSide();
switch (side) {

or

Suggested change
auto side = region->getSide();
switch (side) {
switch (region->getSide();) {

Comment on lines +175 to +186
c0.SetStyle(YAML::EmitterStyle::Flow);
c1.SetStyle(YAML::EmitterStyle::Flow);
c2.SetStyle(YAML::EmitterStyle::Flow);
c3.SetStyle(YAML::EmitterStyle::Flow);
c0.push_back(rect.xMin() / u);
c0.push_back(rect.yMin() / u);
c1.push_back(rect.xMax() / u);
c1.push_back(rect.yMin() / u);
c2.push_back(rect.xMax() / u);
c2.push_back(rect.yMax() / u);
c3.push_back(rect.xMin() / u);
c3.push_back(rect.yMax() / u);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate code. better to have a writeCoordinate method

Comment on lines +74 to +75
// TODO: Identify clone instances
instance_node["is_master"] = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_master is deprecated, we don't care about that field neither when we read nor should we when we write.


private:
utl::Logger* logger_;
std::map<int, std::vector<dbChip*>> levels_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be std::vector<std::vector<dbChip*>> instead. The index is the key/level

Comment on lines +247 to +249
if (level.chiplets.empty()) {
continue;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this happen? Should produce an error or remove if unexpected.

Comment on lines +242 to +262
if (levels.size() == 1) {
writeFile(base_filename, db);
} else {
// Write each level to a separate file
for (const auto& level : levels) {
if (level.chiplets.empty()) {
continue;
}

std::string level_filename
= generateLevelFilename(base_filename, level.level);
writeLevelToFile(level_filename, level.chiplets, db);

logger_->info(utl::ODB,
538,
"Wrote level {} with {} chiplets to {}",
level.level,
level.chiplets.size(),
level_filename);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there should be a different logic between multi-level and single level designs.

Comment on lines +203 to +216
for (auto chiplet : chiplets) {
// Find all chiplets that this chiplet depends on
for (auto inst : chiplet->getChipInsts()) {
auto master_chip = inst->getMasterChip();
for (const auto& level : levels) {
for (auto level_chiplet : level.chiplets) {
if (level_chiplet == master_chip) {
dependency_levels.insert(level.level);
break;
}
}
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary. The whole idea of the dag is that you know that the current level depend on the upper level. So you should include that directly.

Comment on lines +305 to +315
std::string DbvWriter::getBaseName(const std::string& filename)
{
std::filesystem::path path(filename);
return path.stem().string();
}

std::string DbvWriter::getDirectory(const std::string& filename)
{
std::filesystem::path path(filename);
return path.parent_path().string();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants