Skip to content

Commit

Permalink
Allow specifying top-level module for Verilator lint rule
Browse files Browse the repository at this point in the history
Internal-tag: [#69104]
Signed-off-by: Maciej Kurc <[email protected]>
  • Loading branch information
mkurc-ant committed Dec 2, 2024
1 parent 8a6d417 commit 1f4a826
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions verilator/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ def _verilator_lint(ctx):
vopts = [
"--lint-only",
]
vopts.extend(["--top-module", ctx.attr.module_top])
args, vlog_srcs, vlog_hdrs, _ = _verilator_args(ctx, srcs, vopts)

# Capture stderr to the log file
Expand Down Expand Up @@ -571,6 +572,10 @@ verilator_lint = rule(
providers = [VerilogInfo],
mandatory = True,
),
"module_top": attr.string(
doc = "The name of the verilog module to verilate.",
mandatory = True,
),
"vopts": attr.string_list(
doc = "Additional command line options to pass to Verilator",
default = ["-Wall"],
Expand Down
1 change: 1 addition & 0 deletions verilator/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ verilator_run(
verilator_lint(
name = "nested_module_2_verilator_lint",
module = ":nested_module_2",
module_top = "nested_module_2",
vopts = [
"-Wall",
"-Wno-fatal",
Expand Down

0 comments on commit 1f4a826

Please sign in to comment.