Skip to content

Commit

Permalink
Generate HTML Cov report in DSim
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Dudek <[email protected]>
  • Loading branch information
mtdudek committed Oct 30, 2024
1 parent 6e9ba43 commit 8e927f0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dsim/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,22 @@ def _dsim_run(ctx):
if ctx.attr.code_coverage_type in ["toggle", "all"]:
command += " +acc+b "
command += " -code-cov " + ctx.attr.code_coverage_type
if ctx.attr.code_coverage_scope != "":
scope_file = ctx.actions.declare_file("{}.scope".format(ctx.label.name))
ctx.actions.write(
output=scope_file,
content="path {} +".format(ctx.attr.code_coverage_scope),
)
command += " -code-cov-scope-specs {}".format(scope_file.path)
inputs.append(scope_file)
outputs.append(dsim_cov)
generated_files.append(dsim_cov)

if ctx.attr.code_coverage_report:
dsim_report = ctx.actions.declare_directory("{}_report".format(ctx.label.name))
command += " && dcreport -out_dir {} {}".format(dsim_report.path, dsim_cov.path)
outputs.append(dsim_report)
generated_files.append(dsim_report)

ctx.actions.run_shell(
outputs = outputs,
Expand Down Expand Up @@ -114,6 +127,14 @@ dsim_run = rule(
doc = "Select coverage type: block, expression, toggle or all",
default = "all",
),
"code_coverage_scope": attr.string(
doc = "Select coverage scope using hierarchical path",
default = "",
),
"code_coverage_report": attr.bool(
doc = "Run dcreport after dsim run",
default = False,
),
"outs": attr.output_list(
doc = "List of simulation products",
),
Expand Down

0 comments on commit 8e927f0

Please sign in to comment.