Skip to content

Commit 4699de9

Browse files
committed
Merge remote-tracking branch 'private/master' into dpl-dpo-load-macro-flipping
2 parents 37c4a41 + e0ec44c commit 4699de9

24 files changed

Lines changed: 31156 additions & 66 deletions

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ alias(
250250
visibility = ["//visibility:public"],
251251
)
252252
""",
253-
path = "bazel",
253+
path = "bazel/slang-compat",
254254
)
255255

256256
# --- Overrides ---

bazel/slang-compat/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Placeholder directory for the @slang alias build
2+
file to internally manifest.
3+
(see MODULE.bazel, new_local_repository(name="slang"))

src/OpenRoad.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ void OpenRoad::read3Dbx(const std::string& filename)
520520
{
521521
odb::ThreeDBlox parser(logger_, db_, sta_);
522522
parser.readDbx(filename);
523+
db_->constructUnfoldedModel();
523524
db_->triggerPostRead3Dbx(db_->getChip());
524525
check3DBlox();
525526
}

src/dbSta/test/cpp/TestReadVerilog.cpp

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,74 @@ TEST_F(TestReadVerilog, DeepDescendantModBTermCollision)
185185
EXPECT_EQ(txclk_modnet->getModBTerms().size(), 1u);
186186
}
187187

188+
TEST_F(TestReadVerilog, EscapedBracketScalarNames)
189+
{
190+
const testing::TestInfo* test_info
191+
= testing::UnitTest::GetInstance()->current_test_info();
192+
const std::string test_name
193+
= std::string(test_info->test_suite_name()) + "_" + test_info->name();
194+
195+
readVerilogAndSetup(test_name + ".v", /*init_default_sdc=*/false);
196+
197+
odb::dbBTerm* raw_bterm = block_->findBTerm("foo[3]");
198+
odb::dbBTerm* leading_escape_bterm = block_->findBTerm("\\foo[3]");
199+
odb::dbBTerm* escaped_bterm = block_->findBTerm("foo\\[3\\]");
200+
EXPECT_EQ(raw_bterm, nullptr);
201+
EXPECT_EQ(leading_escape_bterm, nullptr);
202+
ASSERT_NE(escaped_bterm, nullptr);
203+
EXPECT_STREQ(escaped_bterm->getConstName(), "foo\\[3\\]");
204+
205+
odb::dbModule* child = block_->findModule("child");
206+
ASSERT_NE(child, nullptr);
207+
208+
EXPECT_EQ(child->findModBTerm("foo[3]"), nullptr);
209+
EXPECT_EQ(child->findModBTerm("\\foo[3]"), nullptr);
210+
odb::dbModBTerm* escaped_modbterm = child->findModBTerm("foo\\[3\\]");
211+
ASSERT_NE(escaped_modbterm, nullptr);
212+
213+
EXPECT_EQ(child->getModNet("foo[3]"), nullptr);
214+
EXPECT_EQ(child->getModNet("\\foo[3]"), nullptr);
215+
odb::dbModNet* escaped_modnet = child->getModNet("foo\\[3\\]");
216+
ASSERT_NE(escaped_modnet, nullptr);
217+
EXPECT_EQ(escaped_modbterm->getModNet(), escaped_modnet);
218+
}
219+
220+
TEST_F(TestReadVerilog, BusBitAndEscapedScalarAreDistinct)
221+
{
222+
const testing::TestInfo* test_info
223+
= testing::UnitTest::GetInstance()->current_test_info();
224+
const std::string test_name
225+
= std::string(test_info->test_suite_name()) + "_" + test_info->name();
226+
227+
readVerilogAndSetup(test_name + ".v", /*init_default_sdc=*/false);
228+
229+
odb::dbBTerm* bus_bit_bterm = block_->findBTerm("foo[3]");
230+
odb::dbBTerm* leading_escape_bterm = block_->findBTerm("\\foo[3]");
231+
odb::dbBTerm* escaped_bterm = block_->findBTerm("foo\\[3\\]");
232+
ASSERT_NE(bus_bit_bterm, nullptr);
233+
EXPECT_EQ(leading_escape_bterm, nullptr);
234+
ASSERT_NE(escaped_bterm, nullptr);
235+
EXPECT_NE(bus_bit_bterm, escaped_bterm);
236+
237+
odb::dbModule* child = block_->findModule("child");
238+
ASSERT_NE(child, nullptr);
239+
240+
odb::dbModBTerm* bus_port = child->findModBTerm("foo");
241+
odb::dbModBTerm* bus_bit_port = child->findModBTerm("foo[3]");
242+
odb::dbModBTerm* escaped_port = child->findModBTerm("foo\\[3\\]");
243+
ASSERT_NE(bus_port, nullptr);
244+
ASSERT_NE(bus_bit_port, nullptr);
245+
EXPECT_EQ(child->findModBTerm("\\foo[3]"), nullptr);
246+
ASSERT_NE(escaped_port, nullptr);
247+
EXPECT_NE(bus_bit_port, escaped_port);
248+
249+
odb::dbModNet* bus_bit_modnet = child->getModNet("foo[3]");
250+
odb::dbModNet* escaped_modnet = child->getModNet("foo\\[3\\]");
251+
ASSERT_NE(bus_bit_modnet, nullptr);
252+
EXPECT_EQ(child->getModNet("\\foo[3]"), nullptr);
253+
ASSERT_NE(escaped_modnet, nullptr);
254+
EXPECT_NE(bus_bit_modnet, escaped_modnet);
255+
EXPECT_EQ(escaped_port->getModNet(), escaped_modnet);
256+
}
257+
188258
} // namespace sta
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module top (foo,
2+
\foo[3] ,
3+
out_bus,
4+
out_scalar);
5+
input [7:0] foo;
6+
input \foo[3] ;
7+
output out_bus;
8+
output out_scalar;
9+
10+
child u_child (.foo(foo),
11+
.\foo[3] (\foo[3] ),
12+
.out_bus(out_bus),
13+
.out_scalar(out_scalar));
14+
endmodule
15+
16+
module child (foo,
17+
\foo[3] ,
18+
out_bus,
19+
out_scalar);
20+
input [7:0] foo;
21+
input \foo[3] ;
22+
output out_bus;
23+
output out_scalar;
24+
25+
BUF_X1 bus_load (.A(foo[3]),
26+
.Z(out_bus));
27+
BUF_X1 scalar_load (.A(\foo[3] ),
28+
.Z(out_scalar));
29+
endmodule
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module top (\foo[3] ,
2+
out);
3+
input \foo[3] ;
4+
output out;
5+
6+
child u_child (.\foo[3] (\foo[3] ),
7+
.out(out));
8+
endmodule
9+
10+
module child (\foo[3] ,
11+
out);
12+
input \foo[3] ;
13+
output out;
14+
15+
BUF_X1 load (.A(\foo[3] ),
16+
.Z(out));
17+
endmodule

src/odb/src/db/dbDatabase.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,6 @@ void dbDatabase::triggerPostRead3Dbx(dbChip* chip)
12121212
for (dbDatabaseObserver* observer : db->observers_) {
12131213
observer->postRead3Dbx(chip);
12141214
}
1215-
constructUnfoldedModel();
12161215
}
12171216

12181217
void dbDatabase::triggerPostReadDb()

src/odb/src/db/dbInsertBuffer.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@
2424

2525
namespace odb {
2626

27+
static std::string replaceBracketsWithUnderscores(std::string_view name)
28+
{
29+
std::string sanitized_name;
30+
sanitized_name.reserve(name.size());
31+
32+
for (size_t i = 0; i < name.size(); i++) {
33+
const char ch = name[i];
34+
if (ch == '\\' && i + 1 < name.size()
35+
&& (name[i + 1] == '[' || name[i + 1] == ']')) {
36+
sanitized_name += '_';
37+
i++;
38+
continue;
39+
}
40+
sanitized_name += (ch == '[' || ch == ']') ? '_' : ch;
41+
}
42+
43+
return sanitized_name;
44+
}
45+
2746
dbInsertBuffer::dbInsertBuffer(dbNet* net)
2847
: net_(net),
2948
block_(net ? net->getBlock() : nullptr),
@@ -495,6 +514,12 @@ dbNet* dbInsertBuffer::createNewFlatNet(
495514
new_net_uniquify = dbNameUniquifyType::IF_NEEDED;
496515
}
497516

517+
if (bterm == nullptr) {
518+
// New split nets are scalar wires. Keep their generated names easy to read
519+
// by replacing bracket characters before ODB stores the name.
520+
new_net_name = replaceBracketsWithUnderscores(new_net_name);
521+
}
522+
498523
// Create a new net
499524
dbNet* new_net = dbNet::create(
500525
block_, new_net_name.c_str(), new_net_uniquify, target_module_);
@@ -513,7 +538,10 @@ std::string dbInsertBuffer::makeUniqueHierName(const dbModule* module,
513538
const std::string& base_name,
514539
const char* suffix) const
515540
{
516-
std::string name = (suffix == nullptr) ? base_name : base_name + suffix;
541+
// insertBuffer only punches scalar hierarchy ports, never bus ports.
542+
std::string scalar_base_name = replaceBracketsWithUnderscores(base_name);
543+
std::string name
544+
= (suffix == nullptr) ? scalar_base_name : scalar_base_name + suffix;
517545
std::string full = block_->makeNewNetName(
518546
module, name.c_str(), dbNameUniquifyType::IF_NEEDED_WITH_UNDERSCORE);
519547
return std::string(block_->getBaseName(full.c_str()));

src/pdn/src/straps.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,19 @@ bool PadDirectConnectionStraps::refineShape(
15901590

15911591
bool PadDirectConnectionStraps::isTargetShape(const Shape* shape) const
15921592
{
1593+
// Pad direct connections run from a pad pin toward the core power grid. They
1594+
// must not target shapes that belong to an instance (macro) grid: those
1595+
// stripes sit inside the core over the macro, and snapping a pad connection
1596+
// to them drags the connection deep into the core (issue #10490). Only
1597+
// shapes owned by core/existing grids are valid landing targets.
1598+
const auto* component = shape->getGridComponent();
1599+
if (component != nullptr) {
1600+
const auto* grid = component->getGrid();
1601+
if (grid != nullptr && grid->type() == Grid::kInstance) {
1602+
return false;
1603+
}
1604+
}
1605+
15931606
if (target_shapes_type_) {
15941607
return shape->getType() == target_shapes_type_.value();
15951608
}

src/pdn/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ COMPULSORY_TESTS = [
117117
"pads_black_parrot_flipchip_connect_overpads",
118118
"pads_black_parrot_grid_define",
119119
"pads_black_parrot_limit_connect",
120+
"pads_black_parrot_macro_grid",
120121
"pads_black_parrot_max_width",
121122
"pads_black_parrot_no_connect",
122123
"pads_black_parrot_offset",

0 commit comments

Comments
 (0)