Skip to content

Commit 2d533a6

Browse files
committed
Merge remote-tracking branch 'origin/master' into hermetic-llvm-toolchain
Signed-off-by: Matt Liberty <mliberty@precisioninno.com> # Conflicts: # MODULE.bazel # MODULE.bazel.lock
2 parents 74eca7d + 17f494d commit 2d533a6

46 files changed

Lines changed: 31616 additions & 91 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILD.bazel

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,14 @@ sh_test(
584584
sh_binary(
585585
name = "tidy_tcl",
586586
srcs = ["//bazel:tcl_tidy.sh"],
587-
args = ["$(rootpath //bazel:tclfmt)"],
587+
args = [
588+
"$(rootpath //bazel:tclfmt)",
589+
"$(rootpath @git)",
590+
],
588591
data = [
589592
"tclint.toml",
590593
"//bazel:tclfmt",
594+
"@git",
591595
],
592596
)
593597

@@ -633,9 +637,13 @@ sh_test(
633637
sh_binary(
634638
name = "tidy_bzl",
635639
srcs = ["//bazel:bzl_tidy.sh"],
636-
args = ["$(rootpath @buildifier_prebuilt//:buildifier)"],
640+
args = [
641+
"$(rootpath @buildifier_prebuilt//:buildifier)",
642+
"$(rootpath @git)",
643+
],
637644
data = [
638645
"@buildifier_prebuilt//:buildifier",
646+
"@git",
639647
],
640648
)
641649

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ alias(
363363
visibility = ["//visibility:public"],
364364
)
365365
""",
366-
path = "bazel",
366+
path = "bazel/slang-compat",
367367
)
368368

369369
# --- Overrides ---

bazel/bzl_tidy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
# Auto-format all Bazel files in-place using buildifier.
66
set -euo pipefail
77
TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
8+
GIT="$(realpath "$2")"
89
cd "${BUILD_WORKSPACE_DIRECTORY:-$PWD}"
910
# `-c submodule.recurse=false` keeps git ls-files from descending into
1011
# submodules (src/sta, third-party/abc, third-party/slang-elab and the
1112
# fmt sub-submodule nested in it) — we never want to rewrite files
1213
# owned by another repo. The override is needed because CI sets
1314
# submodule.recurse=true globally.
14-
git -c submodule.recurse=false ls-files \
15+
"${GIT}" -c submodule.recurse=false ls-files \
1516
'*.bazel' '*.bzl' '**/BUILD' 'BUILD' '**/WORKSPACE' 'WORKSPACE' -z \
1617
| xargs -0 "$TOOL" -mode=fix -lint=fix

bazel/fix_lint.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ BZL_LINT_BUILDIFIER="$8"
1717
GIT="$9"
1818

1919
export BUILD_WORKSPACE_DIRECTORY="${BUILD_WORKSPACE_DIRECTORY:-$PWD}"
20-
2120
# TCL: auto-format then lint
22-
"${TCL_TIDY_SH}" "${TCLFMT}"
21+
"${TCL_TIDY_SH}" "${TCLFMT}" "${GIT}"
2322
"${TCL_LINT_SH}" "${TCLINT}" "${GIT}" || rc=$?
2423

2524
# Bazel: auto-format then lint
26-
"${BZL_TIDY_SH}" "${BZL_FMT_BUILDIFIER}"
25+
"${BZL_TIDY_SH}" "${BZL_FMT_BUILDIFIER}" "${GIT}"
2726
"${BZL_LINT_SH}" "${BZL_LINT_BUILDIFIER}" "${GIT}" || rc=$?
2827

2928
"${GIT}" -C "$BUILD_WORKSPACE_DIRECTORY" status

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"))

bazel/tcl_lint_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
set -euo pipefail
88

9-
TOOL="$(realpath "$1")"
9+
TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
1010
GIT="$(realpath "$2")"
1111

1212
# With rules_python's script bootstrap (bootstrap_impl=script), a py_binary

bazel/tcl_tidy.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
# Auto-format all TCL files in-place.
66
set -euo pipefail
77
TOOL="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
8+
GIT="$(realpath "$2")"
89
cd "${BUILD_WORKSPACE_DIRECTORY:-$PWD}"
9-
git ls-files '*.tcl' -z | xargs -0 "$TOOL" --in-place
10+
"${GIT}" ls-files '*.tcl' -z | xargs -0 "$TOOL" --in-place

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

0 commit comments

Comments
 (0)