Skip to content

odb: impl 3dblox verilog writer#9813

Open
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-write-top-verilog
Open

odb: impl 3dblox verilog writer#9813
openroad-ci wants to merge 1 commit intoThe-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:feat/3dblox-write-top-verilog

Conversation

@openroad-ci
Copy link
Collaborator

Closes: #9709

Signed-off-by: Ahmed R. Mohamed <ahmed@precisioninno.com>
Copy link
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
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
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?

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
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
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
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
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
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
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.

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
Contributor

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

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 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
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
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.


sta::define_cmd_args "write_3dblox_verilog" {filename}

proc write_3dblox_verilog { args } {
Copy link
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?

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

3 participants