Skip to content

Commit 9646043

Browse files
Merge pull request #8489 from osamahammad21/3dblox-lib
ODB: read liberty from 3dblox files
2 parents 40063b9 + b958a83 commit 9646043

10 files changed

Lines changed: 21 additions & 13 deletions

File tree

src/OpenRoad.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,13 @@ void OpenRoad::writeCdl(const char* out_filename,
485485

486486
void OpenRoad::read3Dbv(const std::string& filename)
487487
{
488-
odb::ThreeDBlox parser(logger_, db_);
488+
odb::ThreeDBlox parser(logger_, db_, sta_);
489489
parser.readDbv(filename);
490490
}
491491

492492
void OpenRoad::read3Dbx(const std::string& filename)
493493
{
494-
odb::ThreeDBlox parser(logger_, db_);
494+
odb::ThreeDBlox parser(logger_, db_, sta_);
495495
parser.readDbx(filename);
496496
}
497497

src/odb/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ cc_library(
7070
"//src/odb/src/def:defzlib",
7171
"//src/odb/src/lef",
7272
"//src/odb/src/lef:lefzlib",
73+
"//src/sta:opensta_lib",
7374
"//src/utl",
7475
"@boost.algorithm",
7576
"@boost.bind",

src/odb/include/odb/3dblox.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
namespace utl {
1010
class Logger;
1111
}
12-
12+
namespace sta {
13+
class Sta;
14+
}
1315
namespace odb {
1416
class dbDatabase;
1517
class ChipletDef;
@@ -24,7 +26,7 @@ class dbChipInst;
2426
class ThreeDBlox
2527
{
2628
public:
27-
ThreeDBlox(utl::Logger* logger, odb::dbDatabase* db);
29+
ThreeDBlox(utl::Logger* logger, odb::dbDatabase* db, sta::Sta* sta = nullptr);
2830
~ThreeDBlox() = default;
2931
void readDbv(const std::string& dbv_file);
3032
void readDbx(const std::string& dbx_file);
@@ -42,5 +44,6 @@ class ThreeDBlox
4244

4345
utl::Logger* logger_ = nullptr;
4446
odb::dbDatabase* db_ = nullptr;
47+
sta::Sta* sta_ = nullptr;
4548
};
4649
} // namespace odb

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "odb/defin.h"
1919
#include "odb/geom.h"
2020
#include "odb/lefin.h"
21+
#include "sta/Sta.hh"
2122
#include "utl/Logger.h"
2223

2324
namespace odb {
@@ -32,8 +33,8 @@ static std::map<std::string, std::string> dup_orient_map
3233
{"MZ_MX_R180", "MZ_MY"},
3334
{"MZ_MX_R270", "MZ_MY_R90"}};
3435

35-
ThreeDBlox::ThreeDBlox(utl::Logger* logger, odb::dbDatabase* db)
36-
: logger_(logger), db_(db)
36+
ThreeDBlox::ThreeDBlox(utl::Logger* logger, odb::dbDatabase* db, sta::Sta* sta)
37+
: logger_(logger), db_(db), sta_(sta)
3738
{
3839
}
3940

@@ -157,7 +158,12 @@ void ThreeDBlox::createChiplet(const ChipletDef& chiplet)
157158
odb::lefin lef_reader(db_, logger_, false);
158159
lef_reader.createLib(tech, lib_name.c_str(), lef_file.c_str());
159160
}
160-
// TODO: Read liberty files
161+
if (sta_ != nullptr) {
162+
for (const auto& liberty_file : chiplet.external.lib_files) {
163+
sta_->readLiberty(
164+
liberty_file.c_str(), sta_->cmdCorner(), sta::MinMaxAll::all(), true);
165+
}
166+
}
161167
// Check if chiplet already exists
162168
auto chip = db_->findChip(chiplet.name.c_str());
163169
if (chip != nullptr) {

src/odb/src/3dblox/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target_link_libraries(3dblox
1515
db
1616
utl_lib
1717
yaml-cpp
18+
OpenSTA
1819
)
1920

2021
target_include_directories(3dblox

src/odb/test/data/example.3dbv

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ ChipletDef:
2929
- [955, 1082]
3030
- [0, 1082]
3131
external:
32-
thermal_name: [N5_1P15M]
3332
APR_tech_file: [NG45_PATH/*_tech.lef]
34-
RC_tech_file: [Collateral/SoC/tech/a.ircx]
35-
liberty_file: [Collateral/SoC/lib/a.lib]
36-
3dbf_file: [Feasibility/SoC.3dbf]
33+
liberty_file: [NG45_PATH/fake_macros.lib]
3734
LEF_file: [NG45_PATH/fake_macros.lef]
3835
DEF_file: ../fake_macros.def

src/odb/test/read_3dbv.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[INFO ODB-0227] LEF file: data/../Nangate45/Nangate45_tech.lef, created 22 layers, 27 vias
22
[INFO ODB-0227] LEF file: data/../Nangate45/fake_macros.lef, created 10 library cells
3+
[WARNING STA-1171] data/../Nangate45/fake_macros.lib line 32, default_max_transition is 0.0.
34
[INFO ODB-0128] Design: fake_macros
45
[INFO ODB-0131] Created 10 components and 32 component-terminals.
56
[INFO ODB-0133] Created 12 nets and 24 connections.

src/odb/test/read_3dbv.tcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
source "helpers.tcl"
22

33
set db [ord::get_db]
4-
set tech [odb::dbTech_create $db "tech"]
54

65
read_3dbv "data/example.3dbv"
76
if { [$db getChip] == "NULL" } {

src/odb/test/read_3dbx.ok

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[INFO ODB-0227] LEF file: data/../Nangate45/Nangate45_tech.lef, created 22 layers, 27 vias
22
[INFO ODB-0227] LEF file: data/../Nangate45/fake_macros.lef, created 10 library cells
3+
[WARNING STA-1171] data/../Nangate45/fake_macros.lib line 32, default_max_transition is 0.0.
34
[INFO ODB-0128] Design: fake_macros
45
[INFO ODB-0131] Created 10 components and 32 component-terminals.
56
[INFO ODB-0133] Created 12 nets and 24 connections.

src/odb/test/read_3dbx.tcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
source "helpers.tcl"
22

33
set db [ord::get_db]
4-
set tech [odb::dbTech_create $db "tech"]
54

65
read_3dbx "data/example.3dbx"
76
if { [$db getChip] == "NULL" } {

0 commit comments

Comments
 (0)