Skip to content

odb: impl 3dblox verilog writer#9813

Merged
osamahammad21 merged 3 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-write-top-verilog
Mar 30, 2026
Merged

odb: impl 3dblox verilog writer#9813
osamahammad21 merged 3 commits intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-write-top-verilog

Conversation

@openroad-ci
Copy link
Copy Markdown
Collaborator

Closes: #9709

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new Verilog writer for 3Dblox, enabling the generation of Verilog connectivity files for hierarchical chiplets. This functionality is integrated into the OpenRoad class and exposed via Tcl commands. New unit and integration tests have been added to cover the new features, including specific tests for bump path filtering. The changes are well-structured and leverage modern C++ features like std::ranges::sort. One comment has been updated to reference a rule regarding the use of named constants instead of magic numbers.


#include <memory>
#include <set>
#include <iostream>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The <iostream> header is typically used for std::cin, std::cout, std::cerr, etc. If these are only used in the corresponding .cc implementation file, it's generally better to include <iostream> there instead of in the header file. This helps to minimize compilation dependencies for files that include OpenRoad.hh.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ahmed532 iostream not needed. mistake?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is weird! I do not remember adding it myself. I thought it was in the file from the beginning. I'll remove it.

Comment on lines +305 to +306
// Write the Verilog connectivity file for this HIER chiplet.
writeVerilog(current_dir_path + chip->getName() + ".v", chip);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The writeDbx method now has a side effect of writing a Verilog connectivity file. While this might be intended for hierarchical chiplets, the method name writeDbx (presumably for 'write Dbx') does not clearly indicate this additional output. Consider renaming the method to better reflect its full functionality or making the Verilog writing an explicit, optional step if it's not always required when writing a Dbx file.

Comment on lines +98 to +101
const std::map<
dbChipInst*,
std::vector<std::pair<std::string, std::string>>>::const_iterator it
= inst_connections.find(chip_inst);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The type declaration for it is quite verbose. Using auto would improve readability and conciseness without losing type safety.

    auto it = inst_connections.find(chip_inst);

Comment on lines +105 to +111
for (size_t j = 0; j < conns.size(); j++) {
const bool is_last = (j + 1 == conns.size());
fmt::print(verilog_file,
" .{}({}){}\n",
conns[j].first,
conns[j].second,
is_last ? "" : ",");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The loop structure for printing with commas is common but can be slightly refactored for better readability and conciseness. While functional, a pattern that handles the first element separately or prefixes subsequent elements with a comma can sometimes be cleaner.

name = "Test3DBloxParser",
srcs = [
"Test3DBloxParser.cpp",
"Test3DBloxVerilogWriter.cpp",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Adding Test3DBloxVerilogWriter.cpp to the srcs of Test3DBloxParser might lead to less modular test organization. It would be clearer to create a separate cc_test target for Test3DBloxVerilogWriter.cpp if its tests are distinct from Test3DBloxParser. This improves test discoverability and allows for more granular test execution.

add_executable(TestGDSIn TestGDSIn.cpp)
add_executable(TestChips TestChips.cpp)
add_executable(Test3DBloxParser Test3DBloxParser.cpp)
add_executable(Test3DBloxParser Test3DBloxParser.cpp Test3DBloxVerilogWriter.cpp)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Similar to the BUILD file, including Test3DBloxVerilogWriter.cpp in the Test3DBloxParser executable in CMakeLists.txt could be made more explicit. Consider creating a dedicated executable target for Test3DBloxVerilogWriter.cpp to improve test modularity and clarity.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please address. It needs a separate executable IMO.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sure.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
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 think having 3 test cases just for the verilog writer is an overkill, we should pick only one. I think that write_3dblox_verilog_nets is sufficient, but you think otherwise, choose whichever you prefer.


#include <memory>
#include <set>
#include <iostream>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ahmed532 iostream not needed. mistake?

add_executable(TestGDSIn TestGDSIn.cpp)
add_executable(TestChips TestChips.cpp)
add_executable(Test3DBloxParser Test3DBloxParser.cpp)
add_executable(Test3DBloxParser Test3DBloxParser.cpp Test3DBloxVerilogWriter.cpp)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please address. It needs a separate executable IMO.

src/OpenRoad.tcl Outdated

sta::define_cmd_args "write_3dblox_verilog" {filename}

proc write_3dblox_verilog { args } {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@maliberty @precisionmoon Do you think we need to expose this command?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I do not think the tests are convoluted or anything. I think we should keep them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't that the main entry point for this PR? I'm uncertain what alternative you are proposing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We do write the verilog file associated with each 3dbx when we call write_3dbx.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see, idk if it is useful then or not.

@openroad-ci openroad-ci force-pushed the feat/3dblox-write-top-verilog branch from 515557c to fa054e8 Compare March 23, 2026 18:53
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@ahmed532 ahmed532 requested a review from maliberty March 23, 2026 20:29
@maliberty
Copy link
Copy Markdown
Member

Nothing to add, I'll leave it to @osamahammad21 to approve/merge

Ahmed R. Mohamed added 3 commits March 26, 2026 19:23
Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
Remove standalone tcl command

Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
@openroad-ci openroad-ci force-pushed the feat/3dblox-write-top-verilog branch from fa054e8 to ac2e2ab Compare March 26, 2026 20:06
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@ahmed532 ahmed532 requested a review from osamahammad21 March 26, 2026 20:23
@osamahammad21 osamahammad21 merged commit 918c14c into The-OpenROAD-Project:master Mar 30, 2026
15 checks passed
@openroad-ci openroad-ci deleted the feat/3dblox-write-top-verilog branch March 30, 2026 02:44
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.

ODB: Write 3dblox top verilog

4 participants