Skip to content

Commit

Permalink
Buildifier linting & formatting
Browse files Browse the repository at this point in the history
Internal-tag: [#66277]
Signed-off-by: Maciej Kurc <[email protected]>
  • Loading branch information
mkurc-ant committed Nov 4, 2024
1 parent 9dc5bfc commit a5487d0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 32 deletions.
2 changes: 1 addition & 1 deletion verilator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ toolchain_type(

verilator_toolchain(
name = "verilator_toolchain_impl",
verilator = "@verilator//:verilator_executable",
shared = "@verilator//:verilator_shared",
verilator = "@verilator//:verilator_executable",
deps = [
"@net_zlib//:zlib",
"@verilator//:libverilator",
Expand Down
51 changes: 25 additions & 26 deletions verilator/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def cc_compile_and_link_binary(ctx, srcs, hdrs, deps, runfiles, includes = [], d
Returns:
CCInfo with the compiled binary.
"""
cc_toolchain, feature_configuration, compilation_context, compilation_outputs = cc_compile(
cc_toolchain, feature_configuration, _, compilation_outputs = cc_compile(
ctx,
srcs,
hdrs,
Expand Down Expand Up @@ -270,6 +270,11 @@ verilator_cc_library = rule(
doc = "List of additional compilation flags",
default = [],
),
"coverage": attr.string(
doc = "Enable coverage collection",
default = "none",
values = ["none", "all", "line", "toggle"],
),
"module": attr.label(
doc = "The top level module target to verilate.",
providers = [VerilogInfo],
Expand All @@ -283,11 +288,6 @@ verilator_cc_library = rule(
doc = "Enable tracing for Verilator",
default = False,
),
"coverage": attr.string(
doc = "Enable coverage collection",
default = "none",
values = ["none", "all", "line", "toggle"],
),
"vopts": attr.string_list(
doc = "Additional command line options to pass to Verilator",
default = ["-Wall"],
Expand Down Expand Up @@ -328,7 +328,7 @@ def _verilator_cc_binary(ctx):
defines = ["VM_TRACE"] if ctx.attr.trace else []

if ctx.attr.coverage != "none":
defines += ["VM_COVERAGE"]
defines.append("VM_COVERAGE")

return cc_compile_and_link_binary(
ctx,
Expand All @@ -347,6 +347,11 @@ verilator_cc_binary = rule(
doc = "List of additional compilation flags",
default = [],
),
"coverage": attr.string(
doc = "Enable coverage collection",
default = "none",
values = ["none", "all", "line", "toggle"],
),
"module": attr.label(
doc = "The top level module target to verilate.",
providers = [VerilogInfo],
Expand All @@ -360,11 +365,6 @@ verilator_cc_binary = rule(
doc = "Enable tracing for Verilator",
default = False,
),
"coverage": attr.string(
doc = "Enable coverage collection",
default = "none",
values = ["none", "all", "line", "toggle"],
),
"vopts": attr.string_list(
doc = "Additional command line options to pass to Verilator",
default = ["-Wall"],
Expand Down Expand Up @@ -392,7 +392,6 @@ verilator_cc_binary = rule(
)

def _verilator_run(ctx):

args = []
outputs = list(ctx.outputs.outs)

Expand Down Expand Up @@ -442,34 +441,34 @@ def _verilator_run(ctx):
verilator_run = rule(
implementation = _verilator_run,
attrs = {
"args": attr.string_list(
doc = "Arguments to be passed to the binary (optional)",
),
"binary": attr.label(
doc = "Verilated binary to run",
mandatory = True,
executable = True,
cfg = "exec",
),
"coverage": attr.output(
doc = "Name of the output coverage data file (optional)",
),
"outs": attr.output_list(
doc = "List of simulation products",
),
"args": attr.string_list(
doc = "Arguments to be passed to the binary (optional)",
),
"stdout": attr.output(
doc = "Name of the file to capture stdout to (optional)",
),
"stderr": attr.output(
doc = "Name of the file to capture stderr to (optional)",
),
"coverage": attr.output(
doc = "Name of the output coverage data file (optional)",
"stdout": attr.output(
doc = "Name of the file to capture stdout to (optional)",
),
"_run_wrapper": attr.label(
doc = "A wrapper utility for running the binary",
cfg = "exec",
executable = True,
default = Label("//verilator/private:verilator_run_binary"),
),
}
},
)

def _verilator_toolchain_impl(ctx):
Expand All @@ -494,15 +493,15 @@ verilator_toolchain = rule(
"extra_vopts": attr.string_list(
doc = "Extra flags to pass to Verilator compile actions.",
),
"shared": attr.label(
doc = "Verilator shared files",
mandatory = True,
),
"verilator": attr.label(
doc = "The Verilator binary.",
executable = True,
cfg = "exec",
mandatory = True,
),
"shared": attr.label(
doc = "Verilator shared files",
mandatory = True,
),
},
)
10 changes: 5 additions & 5 deletions verilator/tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,16 @@ verilator_cc_binary(
copts = [
"-std=c++20",
],
coverage = "all",
module = ":tb",
module_top = "tb",
trace = True,
coverage = "all",
vopts = [
"--timing",
],
)

verilator_run (
verilator_run(
name = "tb_run",
binary = ":tb_binary",
stdout = "tb_run-stdout.log",
Expand All @@ -159,18 +159,18 @@ verilator_cc_binary(
copts = [
"-std=c++20",
],
coverage = "all",
module = ":load_and_count_tb",
module_top = "tb",
trace = True,
coverage = "all",
vopts = [
"--timing",
],
)

verilator_run (
verilator_run(
name = "load_and_count_tb_run",
binary = ":load_and_count_tb_binary",
coverage = "load_and_count_tb_run-coverage.dat",
stdout = "load_and_count_tb_run-stdout.log",
coverage = "load_and_count_tb_run-coverage.dat"
)

0 comments on commit a5487d0

Please sign in to comment.