Skip to content

Commit 207659d

Browse files
committed
set dbChipInst orientation during 3dbx parsing
Signed-off-by: osamahammad21 <[email protected]>
1 parent 1f59b87 commit 207659d

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-6
lines changed

src/odb/src/3dblox/3dblox.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
#include "odb/db.h"
1010
#include "utl/Logger.h"
1111
namespace odb {
12+
13+
static std::map<std::string, std::string> dup_orient_map
14+
= {{"MY_R180", "MX"},
15+
{"MY_R270", "MX_R90"},
16+
{"MX_R180", "MY"},
17+
{"MX_R180", "MY_R90"},
18+
{"MZ_MY_R180", "MZ_MX"},
19+
{"MZ_MY_R270", "MZ_MX_R90"},
20+
{"MZ_MX_R180", "MZ_MY"},
21+
{"MZ_MX_R270", "MZ_MY_R90"}};
22+
1223
ThreeDBlox::ThreeDBlox(utl::Logger* logger, odb::dbDatabase* db)
1324
: logger_(logger), db_(db)
1425
{
@@ -186,7 +197,19 @@ void ThreeDBlox::createChipInst(const ChipletInst& chip_inst)
186197
inst->setLoc(Point3D(chip_inst.loc.x * db_->getDbuPerMicron(),
187198
chip_inst.loc.y * db_->getDbuPerMicron(),
188199
chip_inst.z * db_->getDbuPerMicron()));
189-
// TODO: set orient
200+
auto orient_str = chip_inst.orient;
201+
if (dup_orient_map.find(orient_str) != dup_orient_map.end()) {
202+
orient_str = dup_orient_map[orient_str];
203+
}
204+
auto orient = dbOrientType3D::fromString(orient_str);
205+
if (!orient.has_value()) {
206+
logger_->error(utl::ODB,
207+
525,
208+
"3DBX Parser Error: Invalid orient {} for chip inst {}",
209+
chip_inst.orient,
210+
chip_inst.name);
211+
}
212+
inst->setOrient(orient.value());
190213
}
191214
std::vector<std::string> splitPath(const std::string& path)
192215
{

src/odb/test/cpp/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add_executable(TestNetTrack TestNetTrack.cpp)
3434
add_executable(TestMaster TestMaster.cpp)
3535
add_executable(TestGDSIn TestGDSIn.cpp)
3636
add_executable(TestChips TestChips.cpp)
37-
add_executable(Test3DBVParser Test3DBVParser.cpp)
37+
add_executable(Test3DBloxParser Test3DBloxParser.cpp)
3838
#add_executable(TestXML TestXML.cpp)
3939

4040
target_link_libraries(OdbGTests ${TEST_LIBS})
@@ -51,7 +51,7 @@ target_link_libraries(TestNetTrack ${TEST_LIBS})
5151
target_link_libraries(TestMaster ${TEST_LIBS})
5252
target_link_libraries(TestGDSIn gdsin odb_test_helper)
5353
target_link_libraries(TestChips ${TEST_LIBS})
54-
target_link_libraries(Test3DBVParser ${TEST_LIBS})
54+
target_link_libraries(Test3DBloxParser ${TEST_LIBS})
5555
#target_link_libraries(TestXML gdsin odb_test_helper)
5656

5757
# Skip the tests from being registered here, since they are called via
@@ -63,7 +63,7 @@ target_link_libraries(Test3DBVParser ${TEST_LIBS})
6363
# directory.
6464
gtest_discover_tests(OdbGTests
6565
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
66-
TEST_FILTER "-TestAccessPoint.*,-TestCallBacks.*,-TestGCellGrid.*,-TestGeom.*,-TestGroup.*,-TestGuide.*,-TestJournal.*-TestLef58Properties.*,-TestMaster.*,-TestModule.*,-TestNetTrack.*,-TestChips.*"
66+
TEST_FILTER "-TestAccessPoint.*,-TestCallBacks.*,-TestGCellGrid.*,-TestGeom.*,-TestGroup.*,-TestGuide.*,-TestJournal.*-TestLef58Properties.*,-TestMaster.*,-TestModule.*,-TestNetTrack.*,-TestChips.*,-Test3DBloxParser.*"
6767
)
6868

6969
add_dependencies(build_and_test
@@ -76,7 +76,7 @@ add_dependencies(build_and_test
7676
TestNetTrack
7777
TestMaster
7878
TestChips
79-
Test3DBVParser
79+
Test3DBloxParser
8080
OdbGTests
8181
)
8282
add_subdirectory(helper)
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define BOOST_TEST_MODULE Test3DBVParser
1+
#define BOOST_TEST_MODULE Test3DBloxParser
22
#include <iostream>
33
#include <string>
44

@@ -92,12 +92,14 @@ BOOST_FIXTURE_TEST_CASE(test_3dbx, F_DBV_PARSER)
9292
BOOST_CHECK_EQUAL(soc_inst->getLoc().x(), 100.0 * db->getDbuPerMicron());
9393
BOOST_CHECK_EQUAL(soc_inst->getLoc().y(), 200.0 * db->getDbuPerMicron());
9494
BOOST_CHECK_EQUAL(soc_inst->getLoc().z(), 0.0);
95+
BOOST_CHECK_EQUAL(soc_inst->getOrient().getString(), "R0");
9596
BOOST_CHECK_EQUAL(soc_inst_duplicate->getLoc().x(),
9697
100.0 * db->getDbuPerMicron());
9798
BOOST_CHECK_EQUAL(soc_inst_duplicate->getLoc().y(),
9899
200.0 * db->getDbuPerMicron());
99100
BOOST_CHECK_EQUAL(soc_inst_duplicate->getLoc().z(),
100101
300.0 * db->getDbuPerMicron());
102+
BOOST_CHECK_EQUAL(soc_inst_duplicate->getOrient().getString(), "MZ");
101103
auto connections = db->getChipConns();
102104
BOOST_CHECK_EQUAL(connections.size(), 1);
103105
auto connection = *connections.begin();

0 commit comments

Comments
 (0)