[dv/common] VCS UNR flow
Set up VCS UNR flow. For detail refer to [slides](https://docs.google.com/presentation/d/13FwwSeBaxtHZkLMmW3TI0YGO93_BTPZZFnIpX2kQhHI/edit#slide=id.ga3bb534d6e_0_57)
Remaining TODO
1. Some module doesn’t use tb.dut as dut hierarchy, may need separate
cfg file
2. Make sure all IPs pass with UNR flow (need solution for issue 3)
3. Document the flow
Signed-off-by: Weicai Yang <weicai@google.com>
diff --git a/util/dvsim/Deploy.py b/util/dvsim/Deploy.py
index 6cd7eec..91e3ec0 100644
--- a/util/dvsim/Deploy.py
+++ b/util/dvsim/Deploy.py
@@ -843,6 +843,55 @@
return RunTest.seeds.pop(0)
+class CovUnr(Deploy):
+ """
+ Abstraction for coverage UNR flow.
+ """
+
+ # Register all builds with the class
+ items = []
+
+ def __init__(self, sim_cfg):
+ # Initialize common vars.
+ super().__init__(sim_cfg)
+
+ self.target = "cov_unr"
+ self.mandatory_cmd_attrs.update({
+ # tool srcs
+ "tool_srcs": False,
+ "tool_srcs_dir": False,
+
+ # Need to generate filelist based on build mode
+ "sv_flist_gen_cmd": False,
+ "sv_flist_gen_dir": False,
+ "sv_flist_gen_opts": False,
+ "build_dir": False,
+ "cov_unr_build_cmd": False,
+ "cov_unr_build_opts": False,
+ "cov_unr_run_cmd": False,
+ "cov_unr_run_opts": False
+ })
+
+ self.mandatory_misc_attrs.update({
+ "cov_unr_dir": False,
+ "build_fail_patterns": False
+ })
+
+ super().parse_dict(sim_cfg.__dict__)
+ self.__post_init__()
+
+ self.pass_patterns = []
+ # Reuse fail_patterns from sim build
+ self.fail_patterns = self.build_fail_patterns
+
+ # Start fail message construction
+ self.fail_msg = "\n**COV_UNR:** {}<br>\n".format(self.name)
+ log_sub_path = self.log.replace(self.sim_cfg.scratch_path + '/', '')
+ self.fail_msg += "**LOG:** $scratch_path/{}<br>\n".format(log_sub_path)
+
+ CovUnr.items.append(self)
+
+
class CovMerge(Deploy):
"""
Abstraction for merging coverage databases. An item of this class is created AFTER
diff --git a/util/dvsim/SimCfg.py b/util/dvsim/SimCfg.py
index 05b571e..238359d 100644
--- a/util/dvsim/SimCfg.py
+++ b/util/dvsim/SimCfg.py
@@ -12,13 +12,15 @@
import sys
from collections import OrderedDict
-from Deploy import CompileSim, CovAnalyze, CovMerge, CovReport, Deploy, RunTest
+from Deploy import (CompileSim, CovAnalyze, CovMerge, CovReport, CovUnr,
+ Deploy, RunTest)
from FlowCfg import FlowCfg
from Modes import BuildModes, Modes, Regressions, RunModes, Tests
from tabulate import tabulate
-from testplanner import class_defs, testplan_utils
from utils import VERBOSE, find_and_substitute_wildcards
+from testplanner import class_defs, testplan_utils
+
def pick_wave_format(fmts):
'''Pick a supported wave format from a list.
@@ -508,8 +510,6 @@
if self.cov:
self.cov_merge_deploy = CovMerge(self)
self.cov_report_deploy = CovReport(self)
- # Generate reports only if merge was successful; add it as a dependency
- # of merge.
self.cov_merge_deploy.sub.append(self.cov_report_deploy)
# Create initial set of directories before kicking off the regression.
@@ -542,6 +542,9 @@
'''Use the last regression coverage data to open up the GUI tool to
analyze the coverage.
'''
+ # Create initial set of directories, such as dispatched, passed etc.
+ self._create_dirs()
+
cov_analyze_deploy = CovAnalyze(self)
self.deploy = [cov_analyze_deploy]
@@ -551,6 +554,26 @@
for item in self.cfgs:
item._cov_analyze()
+ def _cov_unr(self):
+ '''Use the last regression coverage data to generate unreachable
+ coverage exclusions.
+ '''
+ # TODO, Only support VCS
+ if self.tool != 'vcs':
+ log.error("Currently only support VCS for coverage UNR")
+ sys.exit(1)
+ # Create initial set of directories, such as dispatched, passed etc.
+ self._create_dirs()
+
+ cov_unr_deploy = CovUnr(self)
+ self.deploy = [cov_unr_deploy]
+
+ def cov_unr(self):
+ '''Public facing API for analyzing coverage.
+ '''
+ for item in self.cfgs:
+ item._cov_unr()
+
def _gen_results(self):
'''
The function is called after the regression has completed. It collates the
diff --git a/util/dvsim/dvsim.py b/util/dvsim/dvsim.py
index 53ccc62..f4bef41 100755
--- a/util/dvsim/dvsim.py
+++ b/util/dvsim/dvsim.py
@@ -441,6 +441,11 @@
'coverage database directory with the new '
'coverage database.'))
+ covg.add_argument("--cov-unr",
+ action='store_true',
+ help=('Run coverage UNR analysis and generate report. '
+ 'This only supports VCS now.'))
+
covg.add_argument("--cov-analyze",
action='store_true',
help=('Rather than building or running any tests, '
@@ -572,6 +577,17 @@
cfg.print_list()
sys.exit(0)
+ # Purge the scratch path if --purge option is set.
+ if args.purge:
+ cfg.purge()
+
+ # If --cov-unr is passed, run UNR to generate report for unreachable
+ # exclusion file.
+ if args.cov_unr:
+ cfg.cov_unr()
+ cfg.deploy_objects()
+ sys.exit(0)
+
# In simulation mode: if --cov-analyze switch is passed, then run the GUI
# tool.
if args.cov_analyze:
@@ -579,10 +595,6 @@
cfg.deploy_objects()
sys.exit(0)
- # Purge the scratch path if --purge option is set.
- if args.purge:
- cfg.purge()
-
# Deploy the builds and runs
if args.items != []:
# Create deploy objects.