odb: impl 3dblox verilog writer#9813
Conversation
There was a problem hiding this comment.
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/ord/OpenRoad.hh
Outdated
|
|
||
| #include <memory> | ||
| #include <set> | ||
| #include <iostream> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
This is weird! I do not remember adding it myself. I thought it was in the file from the beginning. I'll remove it.
| // Write the Verilog connectivity file for this HIER chiplet. | ||
| writeVerilog(current_dir_path + chip->getName() + ".v", chip); |
There was a problem hiding this comment.
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.
src/odb/src/3dblox/verilogWriter.cpp
Outdated
| const std::map< | ||
| dbChipInst*, | ||
| std::vector<std::pair<std::string, std::string>>>::const_iterator it | ||
| = inst_connections.find(chip_inst); |
| 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 ? "" : ","); |
There was a problem hiding this comment.
src/odb/test/cpp/BUILD
Outdated
| name = "Test3DBloxParser", | ||
| srcs = [ | ||
| "Test3DBloxParser.cpp", | ||
| "Test3DBloxVerilogWriter.cpp", |
There was a problem hiding this comment.
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.
src/odb/test/cpp/CMakeLists.txt
Outdated
| add_executable(TestGDSIn TestGDSIn.cpp) | ||
| add_executable(TestChips TestChips.cpp) | ||
| add_executable(Test3DBloxParser Test3DBloxParser.cpp) | ||
| add_executable(Test3DBloxParser Test3DBloxParser.cpp Test3DBloxVerilogWriter.cpp) |
There was a problem hiding this comment.
There was a problem hiding this comment.
Please address. It needs a separate executable IMO.
|
clang-tidy review says "All clean, LGTM! 👍" |
osamahammad21
left a comment
There was a problem hiding this comment.
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/ord/OpenRoad.hh
Outdated
|
|
||
| #include <memory> | ||
| #include <set> | ||
| #include <iostream> |
src/odb/test/cpp/CMakeLists.txt
Outdated
| add_executable(TestGDSIn TestGDSIn.cpp) | ||
| add_executable(TestChips TestChips.cpp) | ||
| add_executable(Test3DBloxParser Test3DBloxParser.cpp) | ||
| add_executable(Test3DBloxParser Test3DBloxParser.cpp Test3DBloxVerilogWriter.cpp) |
There was a problem hiding this comment.
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 } { |
There was a problem hiding this comment.
@maliberty @precisionmoon Do you think we need to expose this command?
There was a problem hiding this comment.
I do not think the tests are convoluted or anything. I think we should keep them.
There was a problem hiding this comment.
Isn't that the main entry point for this PR? I'm uncertain what alternative you are proposing.
There was a problem hiding this comment.
We do write the verilog file associated with each 3dbx when we call write_3dbx.
There was a problem hiding this comment.
I see, idk if it is useful then or not.
515557c to
fa054e8
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
|
Nothing to add, I'll leave it to @osamahammad21 to approve/merge |
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>
fa054e8 to
ac2e2ab
Compare
|
clang-tidy review says "All clean, LGTM! 👍" |
Closes: #9709