[dv] Add cov_review in Makefile and coverage exclusion file

1. add coverage review command and common coverage exclusion file
2  add uart coverage exclusion file
diff --git a/hw/dv/tools/Makefile b/hw/dv/tools/Makefile
index 94772e4..312e9c8 100644
--- a/hw/dv/tools/Makefile
+++ b/hw/dv/tools/Makefile
@@ -29,6 +29,7 @@
 BUILD_DIR         := ${SCRATCH_PATH}/${BUILD_LOC}
 RUN_PATH          ?= ${SCRATCH_PATH}/${TEST_NAME}
 RUN_DIR           := ${RUN_PATH}/${RUN_LOC}
+COV_REPORT_DIR    ?= ${SCRATCH_PATH}/cov_report
 SW_BUILD_DIR      ?= ${RUN_DIR}/sw_build
 SW_ROOT_DIR       := ${PRJ_DIR}/sw
 
diff --git a/hw/dv/tools/rules.mk b/hw/dv/tools/rules.mk
index ea6a86d..bed89c2 100644
--- a/hw/dv/tools/rules.mk
+++ b/hw/dv/tools/rules.mk
@@ -8,14 +8,11 @@
 all: build run
 
 ########################
-## standalone targets ##
+## RAL target         ##
 ########################
 ral:
 	${RAL_TOOL} ${RAL_TOOL_OPTS}
 
-cov_merge:
-	# TODO: add script to merge coverage in scratch scope
-
 ###############################
 ## sim build and run targets ##
 ###############################
@@ -70,10 +67,25 @@
 run_result: post_run
 	/bin/bash ${MAKE_ROOT}/pass_fail ${RUN_LOG} ${MAKE_ROOT}/pass_patterns ${MAKE_ROOT}/fail_patterns
 
+############################
+## coverage rated targets ##
+############################
+cov_merge:
+	# TODO: add script to merge coverage in scratch scope
+
+# open coverage tool to review and create report or exclusion file
+cov_analyze:
+	cd ${SCRATCH_PATH} && ${COV_ANALYZE_TOOL} ${COV_ANALYZE_OPTS}
+
+# generate coverage report directly
+cov_report:
+	cd ${SCRATCH_PATH} && ${COV_REPORT_TOOL} ${COV_REPORT_OPTS}
+
 clean:
 	rm -rf ${SCRATCH_PATH}/*
 
-.PHONY: build \
+.PHONY: ral \
+	build \
 	run \
 	reg \
 	pre_compile \
@@ -84,4 +96,8 @@
 	pre_run \
 	simulate \
 	post_run \
-	run_result
+	run_result \
+	cov_merge \
+	cov_analyze \
+	cov_report \
+	clean
diff --git a/hw/dv/tools/vcs/common_cov_excl.el b/hw/dv/tools/vcs/common_cov_excl.el
new file mode 100644
index 0000000..7a086db
--- /dev/null
+++ b/hw/dv/tools/vcs/common_cov_excl.el
@@ -0,0 +1,15 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+
+// Exclude below TL toggle coverage as these pins won't be changed in the comportable IPs
+INSTANCE: tb.dut
+Toggle tl_i.a_user.parity "logic tl_i.a_user.parity[7:0]"
+Toggle tl_i.a_user.parity_en "logic tl_i.a_user.parity_en"
+Toggle tl_i.a_user.rsvd1 "logic tl_i.a_user.rsvd1[6:0]"
+Toggle tl_o.d_opcode [1] "logic tl_o.d_opcode[2:0]"
+Toggle tl_o.d_opcode [2] "logic tl_o.d_opcode[2:0]"
+Toggle tl_o.d_param "logic tl_o.d_param[2:0]"
+Toggle tl_o.d_sink "logic tl_o.d_sink[0:0]"
+Toggle tl_o.d_user "logic tl_o.d_user[15:0]"
+Toggle tl_i.a_param "logic tl_i.a_param[2:0]"
diff --git a/hw/dv/tools/vcs/vcs.mk b/hw/dv/tools/vcs/vcs.mk
index 8f6fe51..aec081c 100644
--- a/hw/dv/tools/vcs/vcs.mk
+++ b/hw/dv/tools/vcs/vcs.mk
@@ -90,6 +90,16 @@
   RUN_OPTS    += -assert nopostproc
 endif
 
+# Coverage analyze/report options
+COV_COMMON_EXCL  ?= ${MAKE_ROOT}/vcs/common_cov_excl.el
+COV_EXCL         += ${COV_COMMON_EXCL} ${COV_DUT_EXCL}
+COV_ANALYZE_TOOL ?= verdi
+COV_REPORT_TOOL  ?= urg
+COV_DIR          ?= ${BUILD_DIR}/cov.vdb
+COV_EXCL_OPTS    ?= -line nocasedef -elfile ${COV_EXCL}
+COV_ANALYZE_OPTS ?= -cov -covdir ${COV_DIR} ${COV_EXCL_OPTS}
+COV_REPORT_OPTS  ?= -dir ${COV_DIR} ${COV_EXCL_OPTS} -report ${COV_REPORT_DIR}
+
 # env variables to be exported for VCS
 export VCS_ARCH_OVERRIDE      := linux
 export VCS_LIC_EXPIRE_WARNING := 1
diff --git a/hw/ip/uart/dv/Makefile b/hw/ip/uart/dv/Makefile
index 51f14e0..f630119 100644
--- a/hw/ip/uart/dv/Makefile
+++ b/hw/ip/uart/dv/Makefile
@@ -19,9 +19,7 @@
 FUSESOC_CORE    := lowrisc:dv:uart_sim:0.1
 COMPILE_KEY     ?= default
 
-UVM_TEST        ?= uart_base_test
-UVM_TEST_SEQ    ?= uart_base_vseq
-
+COV_DUT_EXCL    ?= ${DV_DIR}/cov/uart_cov_excl.el
 ####################################################################################################
 ##                     A D D    I N D I V I D U A L    T E S T S    B E L O W                     ##
 ####################################################################################################
diff --git a/hw/ip/uart/dv/cov/uart_cov_excl.el b/hw/ip/uart/dv/cov/uart_cov_excl.el
new file mode 100644
index 0000000..cc49164
--- /dev/null
+++ b/hw/ip/uart/dv/cov/uart_cov_excl.el
@@ -0,0 +1,18 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+
+// Coverage exclusion file for uart
+CHECKSUM: "1115183444 4229339"
+INSTANCE: tb.dut.uart_core
+// this is unreachable condition
+Condition 16 "7100374" "(break_err && (break_st == BRK_CHK)) 1 -1" (2 "10")
+CHECKSUM: "1115183444 3548154843"
+INSTANCE: tb.dut.uart_core
+// these are scanmode ralated branches
+Branch 1 "2534752149" "scanmode_i" (0) "scanmode_i 1"
+Branch 5 "2534752149" "scanmode_i" (0) "scanmode_i 1"
+Branch 1 "2534752149" "scanmode_i" (1) "scanmode_i 0"
+Branch 5 "2534752149" "scanmode_i" (1) "scanmode_i 0"
+// default branch, it's unreachable
+Branch 9 "221332935" "(!rst_ni)" (5) "(!rst_ni) 0,default,-,-"
diff --git a/util/uvmdvgen/Makefile.tpl b/util/uvmdvgen/Makefile.tpl
index bf1f2f8..01c1380 100644
--- a/util/uvmdvgen/Makefile.tpl
+++ b/util/uvmdvgen/Makefile.tpl
@@ -19,8 +19,8 @@
 FUSESOC_CORE    := lowrisc:dv:${name}_sim:0.1
 COMPILE_KEY     ?= default
 
-UVM_TEST        ?= ${name}_base_test
-UVM_TEST_SEQ    ?= ${name}_base_vseq
+# Add coverage exclusion file below
+COV_IP_EXCL     ?=
 
 ${'####################################################################################################'}
 ${'##                     A D D    I N D I V I D U A L    T E S T S    B E L O W                     ##'}
diff --git a/util/uvmdvgen/cov_excl.el.tpl b/util/uvmdvgen/cov_excl.el.tpl
new file mode 100644
index 0000000..18be5a7
--- /dev/null
+++ b/util/uvmdvgen/cov_excl.el.tpl
@@ -0,0 +1,6 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+
+// coverage exclusion file for ${name}
+// TODO add coverage exclusion below
diff --git a/util/uvmdvgen/gen_env.py b/util/uvmdvgen/gen_env.py
index ebd6a07..703fbe0 100644
--- a/util/uvmdvgen/gen_env.py
+++ b/util/uvmdvgen/gen_env.py
@@ -30,6 +30,7 @@
                 ('dv/tests',        name + '_', 'base_test',          '.sv'),
                 ('dv/tests',        name + '_', 'test_pkg',           '.sv'),
                 ('dv/tests',        name + '_', 'test',               '.core'),
+                ('dv/cov',          '',         '',                   ''),
                 ('dv',              '',         'Makefile',           ''),
                 ('doc',             name + '_', 'dv_plan',            '.md'),
                 ('data',            name + '_', 'testplan',           '.hjson'),
@@ -45,10 +46,13 @@
         ftpl = src + src_suffix + '.tpl'
         fname = src_prefix + src + src_suffix
 
+        if not os.path.exists(path_dir): os.system("mkdir -p " + path_dir)
+        if fname == "": continue
+
         # read template
         tpl = Template(filename=resource_filename('uvmdvgen', ftpl))
 
-        if not os.path.exists(path_dir): os.system("mkdir -p " + path_dir)
+        # create rendered file
         with open(path_dir + "/" + fname, 'w') as fout:
             try:
                 fout.write(