From c43b952a5b1ccd0e4c6f6e9573d93f2e4b15d0d9 Mon Sep 17 00:00:00 2001 From: Blebowski <34539154+Blebowski@users.noreply.github.com> Date: Sat, 13 Jan 2024 14:29:30 -0500 Subject: [PATCH] Cov different top hierarchies (#828) * src: Report multiple top hierarchies in the code coverage report. * test: Add cover22 for multiple different top hierarchies. * src: Warn if skipping a coverage scope due to missing source file. * src: Fix incorrect vararg function. * nvc: Extend manual with some details on merging. --- nvc.1 | 7 +++ src/cov/cov-report.c | 114 +++++++++++++++++++--------------- test/regress/cover22.sh | 14 +++++ test/regress/cover22.vhd | 34 ++++++++++ test/regress/gold/cover22.txt | 16 +++++ test/regress/testlist.txt | 1 + 6 files changed, 135 insertions(+), 51 deletions(-) create mode 100755 test/regress/cover22.sh create mode 100644 test/regress/cover22.vhd create mode 100644 test/regress/gold/cover22.txt diff --git a/nvc.1 b/nvc.1 index 97605634..2177a829 100644 --- a/nvc.1 +++ b/nvc.1 @@ -680,6 +680,13 @@ hierarchy coverage report in HTML format, run: $ nvc -c --merge=merged.covdb --report= \\ first.covdb second.covdb third.covdb ... .Ed +When NVC merges multiple coverage databse files, coverage items/bins with equal +hierarchical paths in the elaborated design are merged together. If a coverage +item/bin is covered in at least one of input coverage databases, it is covered +in the merged coverage database. NVC creates union of all coverage items from +all input coverage databases in the merged coverage database. This allows merging +together coverage from different designs (e.g. where part of the hierarchy +is formed by "if-generate" statement). .Ss Additional code coverage options NVC supports the following additional options to control coverage collection: .Bl -bullet diff --git a/src/cov/cov-report.c b/src/cov/cov-report.c index 9f29dd72..846bc6a6 100644 --- a/src/cov/cov-report.c +++ b/src/cov/cov-report.c @@ -113,6 +113,8 @@ typedef enum { static cover_file_t *files; +#define COV_RPT_TITLE "NVC code coverage report" + static void cover_report_children(cover_report_ctx_t *ctx, cover_scope_t *s, const char *dir, FILE *summf, int *skipped); @@ -184,18 +186,14 @@ static cover_file_t *cover_file(const loc_t *loc) } -static void cover_print_html_header(FILE *f, cover_report_ctx_t *ctx, bool top, - cover_scope_t *s, const char *title, ...) +static void cover_print_html_header(FILE *f) { fprintf(f, "\n" "\n" " \n" " "); - va_list ap; - va_start(ap, title); - vfprintf(f, title, ap); - va_end(ap); + fprintf(f, COV_RPT_TITLE "\n"); fprintf(f, "\n" "