From 1f4a8263597c4a2e158230c161fb6d37c4124f4d Mon Sep 17 00:00:00 2001 From: Maciej Kurc Date: Thu, 21 Nov 2024 13:51:54 +0100 Subject: [PATCH] Allow specifying top-level module for Verilator lint rule Internal-tag: [#69104] Signed-off-by: Maciej Kurc --- verilator/defs.bzl | 5 +++++ verilator/tests/BUILD | 1 + 2 files changed, 6 insertions(+) diff --git a/verilator/defs.bzl b/verilator/defs.bzl index b827b6e3..4cfe58ca 100644 --- a/verilator/defs.bzl +++ b/verilator/defs.bzl @@ -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 @@ -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"], diff --git a/verilator/tests/BUILD b/verilator/tests/BUILD index 3d0f1d51..61da9bbb 100644 --- a/verilator/tests/BUILD +++ b/verilator/tests/BUILD @@ -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",