File size: 2,843 Bytes
5cdf637 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | // SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2023-2026, The OpenROAD Authors
#include <string>
#include "Test3DBloxCheckerFixture.h"
#include "gtest/gtest.h"
#include "odb/3dblox.h"
#include "odb/db.h"
#include "odb/dbTypes.h"
#include "odb/dbWireCodec.h"
namespace odb {
namespace {
class BumpsFixture : public CheckerFixture
{
protected:
BumpsFixture()
{
dbTechLayer::create(tech_, "layer1", dbTechLayerType::ROUTING);
// DIE chips need blocks (for bump masters/cells)
dbBlock::create(chip1_, "block1");
dbBlock::create(chip2_, "block2");
// Lib + bump master
lib_ = dbLib::create(db_.get(), "bump_lib", tech_, ',');
bump_master_ = dbMaster::create(lib_, "bump_pad");
bump_master_->setWidth(100);
bump_master_->setHeight(100);
bump_master_->setType(dbMasterType::CORE);
dbMTerm::create(bump_master_, "pin", dbIoType::INOUT, dbSigType::SIGNAL);
bump_master_->setFrozen();
}
// Create a bump on a chip region.
// - Creates dbInst at (x,y) in the chip's block
// - Creates dbChipBump on the region
// Returns the dbChipBump for further use.
dbChipBump* createBump(dbChip* chip,
dbChipRegion* region,
const char* bump_name,
int x,
int y)
{
dbBlock* block = chip->getBlock();
// Physical cell in the block
dbInst* inst = dbInst::create(block, bump_master_, bump_name);
inst->setOrigin(x, y);
inst->setPlacementStatus(dbPlacementStatus::PLACED);
// Chip-level bump association
dbChipBump* chip_bump = dbChipBump::create(region, inst);
return chip_bump;
}
dbLib* lib_;
dbMaster* bump_master_;
};
TEST_F(BumpsFixture, bumpAlignmentSuccess)
{
auto chip1_r1_fr = chip1_->findChipRegion("r1_fr");
createBump(chip1_, chip1_r1_fr, "bump1", 500, 500);
auto inst1 = dbChipInst::create(top_chip_, chip1_, "inst1");
inst1->setLoc(Point3D(0, 0, 0));
inst1->setOrient(dbOrientType3D(dbOrientType::R0, false));
check();
auto markers = getMarkers(CheckerFixture::bump_alignment_category);
EXPECT_EQ(markers.size(), 0);
}
TEST_F(BumpsFixture, bumpAlignmentFailure)
{
auto chip1_r1_fr = chip1_->findChipRegion("r1_fr");
// Region is (0,0) to (2000, 2000)
// Placing bump outside at (-100, -100)
createBump(chip1_, chip1_r1_fr, "bump1", -100, -100);
auto inst1 = dbChipInst::create(top_chip_, chip1_, "inst1");
inst1->setLoc(Point3D(0, 0, 0));
inst1->setOrient(dbOrientType3D(dbOrientType::R0, false));
check();
auto markers = getMarkers(CheckerFixture::bump_alignment_category);
EXPECT_EQ(markers.size(), 1);
if (!markers.empty()) {
EXPECT_STREQ(markers[0]->getComment().c_str(),
"Bump is outside its parent region r1_fr");
}
}
} // namespace
} // namespace odb
|