-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or request
Description
例如在 ifu/rvc_expander/toffee_version 中,功能覆盖率定义如下:
def init_rvc_expander_funcov(dut:DUTRVCExpander, g: fc.CovGroup):
"""Add watch points to the RVCExpander module to collect function coverage information"""
# 1. Add point RVC_EXPAND_RET to check expander return value:
# - bin ERROR. The instruction is not illegal
# - bin SUCCE. The instruction is not expanded
g.add_watch_point(dut, {
"ERROR": lambda d: getattr(dut, "io_ill").value == False,
"SUCCE": lambda d: getattr(dut, "io_ill").value == True ,
}, name = "RVC_EXPAND_RET")
# 2. Add point RVC_EXPAND_16B_RANGE to check expander input range
# - bin RANGE[start-end]. The instruction is in the range of the compressed instruction set
# This check point is added in case 'test_rv_decode.test_rvc_expand_16bit_full' dynamically, see the test case for details
# 3. Add point RVC_EXPAND_32B_RANGE to check expander input range
# - bin RANGE[start-end]. The instruction is in the range of the 32bit instruction set
# This check point is added in case 'test_rv_decode.test_rvc_expand_32bit_full' dynamically, see the test case for details
# 4. Add point RVC_EXPAND_32B_BITS to check expander function coverage
# - bin BITS[0-31]. The instruction is expanded to the corresponding 32-bit instruction
def _check_pos(i):
def check(dut):
return getattr(dut, "io_in").value & (1<<i) != 0
return check
g.add_watch_point(dut, {
"POS_%d"%i: _check_pos(i)
for i in range(32)
},
name="RVC_EXPAND_32B_BITS")
# 5. Reverse mark function coverage to the check point
def _M(name):
# get the module name
return module_name_with(name, "../test_rvc")
# - mark RVC_EXPAND_RET
g.mark_function("RVC_EXPAND_RET", _M(["test_rvc_expand_16bit_full",
"test_rvc_expand_32bit_full",
"test_rvc_expand_32bit_randomN"]), bin_name=["ERROR", "SUCCE"])
# - mark RVC_EXPAND_16B_RANGE
g.mark_function("RVC_EXPAND_32B_BITS", _M("test_rvc_expand_32bit_randomN"), bin_name=["POS_*"], raise_error=False)无论我是否将最后两行函数注释掉,最后生成的 html 报告结果都没有区别
# - mark RVC_EXPAND_RET
g.mark_function("RVC_EXPAND_RET", _M(["test_rvc_expand_16bit_full",
"test_rvc_expand_32bit_full",
"test_rvc_expand_32bit_randomN"]), bin_name=["ERROR", "SUCCE"])
# - mark RVC_EXPAND_16B_RANGE
g.mark_function("RVC_EXPAND_32B_BITS", _M("test_rvc_expand_32bit_randomN"), bin_name=["POS_*"], raise_error=False)我没有跳过任何测试,标记 TAG_LONG_TIME_RUN 我都取消标记了

在我自己的测试也是如此,mark_function 没有对最后的功能覆盖率报告产生任何影响。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request