Skip to content

Commit 4c30601

Browse files
authored
Merge pull request #8602 from The-OpenROAD-Project-staging/pdk-fixtures
Improve the pdk tst fixtures
2 parents 6521277 + 1b2a364 commit 4c30601

File tree

7 files changed

+25
-31
lines changed

7 files changed

+25
-31
lines changed

src/odb/test/cpp/TestAbstractLef.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ namespace odb {
2121

2222
using ::testing::HasSubstr;
2323

24+
using tst::Sky130Fixture;
25+
2426
TEST_F(Sky130Fixture, AbstractLefWriterMapsTieOffToSignal)
2527
{
2628
// Arrange

src/odb/test/cpp/TestPolygonalFloorplan.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
namespace odb {
2222

23+
using tst::Nangate45Fixture;
24+
2325
TEST_F(Nangate45Fixture, PolygonalFloorplanCreatesBlockagesInNegativeSpace)
2426
{
2527
// Act

src/rsz/test/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ cc_test(
248248
"//src/rsz",
249249
"//src/sta:opensta_lib",
250250
"//src/stt",
251-
"//src/tst",
251+
"//src/tst:nangate45_fixture",
252252
"//src/utl",
253253
"@googletest//:gtest",
254254
"@googletest//:gtest_main",

src/rsz/test/cpp/TestBufferRemoval.cc

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "sta/Units.hh"
3333
#include "stt/SteinerTreeBuilder.h"
3434
#include "tcl.h"
35-
#include "tst/fixture.h"
35+
#include "tst/nangate45_fixture.h"
3636
#include "utl/CallBackHandler.h"
3737
#include "utl/Logger.h"
3838
#include "utl/deleter.h"
@@ -41,7 +41,7 @@ namespace rsz {
4141

4242
static const std::string prefix("_main/src/rsz/test/");
4343

44-
class BufRemTest : public tst::Fixture
44+
class BufRemTest : public tst::Nangate45Fixture
4545
{
4646
protected:
4747
BufRemTest()
@@ -59,38 +59,29 @@ class BufRemTest : public tst::Fixture
5959
&dp_),
6060
ep_(&logger_, &callback_handler_, db_.get(), sta_.get(), &stt_, &grt_),
6161
resizer_(&logger_, db_.get(), sta_.get(), &stt_, &grt_, &dp_, &ep_)
62-
{
63-
}
64-
65-
void SetUp() override
6662
{
6763
library_ = readLiberty(prefix + "Nangate45/Nangate45_typ.lib");
68-
loadTechAndLib("tech", "Nangate45", prefix + "Nangate45/Nangate45.lef");
69-
7064
db_network_ = sta_->getDbNetwork();
71-
72-
// create a chain consisting of 4 buffers
73-
odb::dbChip* chip = odb::dbChip::create(db_.get(), db_->getTech());
74-
odb::dbBlock* block = odb::dbBlock::create(chip, "top");
75-
db_network_->setBlock(block);
76-
block->setDieArea(odb::Rect(0, 0, 1000, 1000));
65+
db_network_->setBlock(block_);
66+
block_->setDieArea(odb::Rect(0, 0, 1000, 1000));
7767
// register proper callbacks for timer like read_def
78-
sta_->postReadDef(block);
68+
sta_->postReadDef(block_);
7969

70+
// create a chain consisting of 4 buffers
8071
const char* layer = "metal1";
8172

82-
makeBTerm(block,
73+
makeBTerm(block_,
8374
"in1",
8475
{.bpins = {{.layer_name = layer, .rect = {0, 0, 10, 10}}}});
8576

8677
odb::dbBTerm* outPort = makeBTerm(
87-
block,
78+
block_,
8879
"out1",
8980
{.io_type = odb::dbIoType::OUTPUT,
9081
.bpins = {{.layer_name = layer, .rect = {990, 990, 1000, 1000}}}});
9182

9283
makeBTerm(
93-
block,
84+
block_,
9485
"out2",
9586
{.io_type = odb::dbIoType::OUTPUT,
9687
.bpins = {{.layer_name = layer, .rect = {980, 980, 1000, 990}}}});
@@ -102,7 +93,7 @@ class BufRemTest : public tst::Fixture
10293
const char* out_net) {
10394
odb::dbMaster* master = db_->findMaster(master_name);
10495
return tst::Fixture::makeInst(
105-
block,
96+
block_,
10697
master,
10798
inst_name,
10899
{.location = location,
@@ -148,9 +139,6 @@ TEST_F(BufRemTest, SlackImproves)
148139
= sta_->vertexArrival(outVertex_, sta::RiseFall::rise(), pathAnalysisPt_);
149140

150141
// Remove buffers 'b2' and 'b3' from the buffer chain
151-
odb::dbChip* chip = db_->getChip();
152-
odb::dbBlock* block = chip->getBlock();
153-
154142
resizer_.initBlock();
155143
db_->setLogger(&logger_);
156144

@@ -161,11 +149,11 @@ TEST_F(BufRemTest, SlackImproves)
161149
resizer_.logger()->setDebugLevel(utl::RSZ, "journal", 1);
162150

163151
auto insts = std::make_unique<sta::InstanceSeq>();
164-
odb::dbInst* inst1 = block->findInst("b2");
152+
odb::dbInst* inst1 = block_->findInst("b2");
165153
sta::Instance* sta_inst1 = db_network_->dbToSta(inst1);
166154
insts->emplace_back(sta_inst1);
167155

168-
odb::dbInst* inst2 = block->findInst("b3");
156+
odb::dbInst* inst2 = block_->findInst("b3");
169157
sta::Instance* sta_inst2 = db_network_->dbToSta(inst2);
170158
insts->emplace_back(sta_inst2);
171159

src/tst/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cc_library(
1616
],
1717
includes = ["."],
1818
visibility = ["//visibility:public"],
19+
deps = [":tst"],
1920
)
2021

2122
cc_library(
@@ -26,6 +27,7 @@ cc_library(
2627
],
2728
includes = ["."],
2829
visibility = ["//visibility:public"],
30+
deps = [":tst"],
2931
)
3032

3133
cc_library(

src/tst/include/tst/nangate45_fixture.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#include "odb/db.h"
88
#include "tst/fixture.h"
99

10-
namespace odb {
10+
namespace tst {
1111

1212
class Nangate45Fixture : public tst::Fixture
1313
{
1414
protected:
15-
void SetUp() override
15+
Nangate45Fixture()
1616
{
1717
lib_ = loadTechAndLib("ng45", "ng45", "_main/test/Nangate45/Nangate45.lef");
1818
chip_ = odb::dbChip::create(db_.get(), db_->getTech());
@@ -26,4 +26,4 @@ class Nangate45Fixture : public tst::Fixture
2626
odb::dbBlock* block_;
2727
};
2828

29-
} // namespace odb
29+
} // namespace tst

src/tst/include/tst/sky130_fixture.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
#include "odb/db.h"
77
#include "tst/fixture.h"
88

9-
namespace odb {
9+
namespace tst {
1010
class Sky130Fixture : public tst::Fixture
1111
{
1212
protected:
13-
void SetUp() override
13+
Sky130Fixture()
1414
{
1515
lib_ = loadTechAndLib(
1616
"sky130", "sky130", "_main/test/sky130hd/sky130_fd_sc_hd_merged.lef");
@@ -25,4 +25,4 @@ class Sky130Fixture : public tst::Fixture
2525
odb::dbChip* chip_;
2626
odb::dbBlock* block_;
2727
};
28-
} // namespace odb
28+
} // namespace tst

0 commit comments

Comments
 (0)