add unfinished function coverage watch point

This commit is contained in:
llyyqq 2024-10-23 13:55:19 +08:00
parent 2741f98bae
commit dee727e5a8
4 changed files with 277 additions and 55 deletions

View File

@ -101,8 +101,9 @@ def reset_init(ittage: DUTITTage):
mlvp.info("ITTAGE initialized")
class ITTAGEDriver:
def __init__(self, log_mode: int = 0, max_trace: int = 10000, update_latency: int = 10):
self.dut = DUTITTage(waveform_filename='ittage-func.fst')
def __init__(self, log_mode: int = 0, max_trace: int = 10000, update_latency: int = 10, waveform_filename = "",\
coverage_filename = ""):
self.dut = DUTITTage(waveform_filename = waveform_filename, coverage_filename = coverage_filename)
reset_init(self.dut)
self.top = ITTAGETop(self.dut, log_mode, update_latency)
self.top.s0_fire = 1

View File

@ -10,6 +10,7 @@ import mlvp.logger
from UT_ITTage import *
from UT_ITTage.xspcomm import WriteMode_Imme
from env.ittage_model import *
from env.ittage_utils import *
import queue
import random
@ -19,7 +20,10 @@ class ITTAGETop:
self.dut = dut
self.ref = ITTAGEModel(log_mode)
if dut is not None:
self._init_dut_write_mode()
init_dut_write_mode(self.dut)
# init_dut_ftb_useless_port(self.dut)
# init_dut_s2_useless_port(self.dut)
# init_dut_s3_useless_port(self.dut)
# input in current cycle
self.s0_fire = 0
self.s1_fire = 0
@ -34,42 +38,6 @@ class ITTAGETop:
self.log_mode = log_mode
self.has_dut = isinstance(dut, DUTITTage)
def _init_dut_write_mode(self):
self.dut.io_s0_fire_3.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_s1_fire_3.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_s2_fire_3.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_s0_pc_3.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_12_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_14_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_13_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_4_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_6_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_2_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_10_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_folded_hist_3_hist_3_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_in_bits_resp_in_0_s2_full_pred_3_jalr_target.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_valid.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_pc.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_12_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_14_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_13_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_4_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_6_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_2_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_10_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_spec_info_folded_hist_hist_3_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_ftb_entry_isJalr.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_ftb_entry_isRet.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_ftb_entry_tailSlot_valid.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_ftb_entry_tailSlot_sharing.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_ftb_entry_tailSlot_offset.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_cfi_idx_valid.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_cfi_idx_bits.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_jmp_taken.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_mispred_mask_2.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_meta.xdata.SetWriteMode(WriteMode_Imme)
self.dut.io_update_bits_full_target.xdata.SetWriteMode(WriteMode_Imme)
def _gen_ref_output(self) -> ITTAGEInfo:
# Get ref output
_ref_info = self.ref.get_output()

View File

@ -0,0 +1,180 @@
import sys
from pathlib import Path
sys.path.append("../../out/picker_out_ITTAGE")
sys.path.append("../")
from UT_ITTage import *
from UT_ITTage.xspcomm import WriteMode_Imme
from env.ittage_model import *
def init_dut_write_mode(dut: DUTITTage):
dut.io_s0_fire_3.xdata.SetWriteMode(WriteMode_Imme)
dut.io_s1_fire_3.xdata.SetWriteMode(WriteMode_Imme)
dut.io_s2_fire_3.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_s0_pc_3.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_12_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_14_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_13_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_4_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_6_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_2_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_10_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_folded_hist_3_hist_3_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_in_bits_resp_in_0_s2_full_pred_3_jalr_target.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_valid.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_pc.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_12_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_14_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_13_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_4_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_6_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_2_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_10_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_spec_info_folded_hist_hist_3_folded_hist.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_ftb_entry_isJalr.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_ftb_entry_isRet.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_ftb_entry_tailSlot_valid.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_ftb_entry_tailSlot_sharing.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_ftb_entry_tailSlot_offset.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_cfi_idx_valid.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_cfi_idx_bits.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_jmp_taken.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_mispred_mask_2.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_meta.xdata.SetWriteMode(WriteMode_Imme)
dut.io_update_bits_full_target.xdata.SetWriteMode(WriteMode_Imme)
def init_dut_ftb_useless_port(dut: DUTITTage):
dut.io_out_last_stage_meta.xdata.value = '0b0'
# ftb entry
dut.io_out_last_stage_ftb_entry_valid.xdata.value = 1
dut.io_out_last_stage_ftb_entry_pftAddr.xdata.value = 0xdeadbeef
dut.io_out_last_stage_ftb_entry_carry.xdata.value = 0
dut.io_out_last_stage_ftb_entry_isCall.xdata.value = 0
dut.io_out_last_stage_ftb_entry_isRet.xdata.value = 0
dut.io_out_last_stage_ftb_entry_isJalr.xdata.value = 0
dut.io_out_last_stage_ftb_entry_last_may_be_rvi_call.xdata.value = 0
dut.io_out_last_stage_ftb_entry_always_taken_0.xdata.value = 0
dut.io_out_last_stage_ftb_entry_always_taken_1.xdata.value = 0
# brSlots 0
dut.io_out_last_stage_ftb_entry_brSlots_0_offset.xdata.value = 0
dut.io_out_last_stage_ftb_entry_brSlots_0_sharing.xdata.value = 0
dut.io_out_last_stage_ftb_entry_brSlots_0_tarStat.xdata.value = 0
dut.io_out_last_stage_ftb_entry_brSlots_0_lower.xdata.value = 0
dut.io_out_last_stage_ftb_entry_brSlots_0_valid.xdata.value = 0
# tailSlot
dut.io_update_bits_ftb_entry_tailSlot_offset.xdata.value = 0
dut.io_update_bits_ftb_entry_tailSlot_sharing.xdata.value = 0
dut.io_update_bits_ftb_entry_tailSlot_valid.xdata.value = 0
def init_dut_s3_useless_port(dut: DUTITTage):
# br taken mask 0
dut.io_out_s3_full_pred_0_br_taken_mask_0.xdata.value = 1
dut.io_out_s3_full_pred_1_br_taken_mask_0.xdata.value = 1
dut.io_out_s3_full_pred_2_br_taken_mask_0.xdata.value = 1
dut.io_out_s3_full_pred_3_br_taken_mask_0.xdata.value = 1
# br taken maks 1
dut.io_out_s3_full_pred_0_br_taken_mask_1.xdata.value = 1
dut.io_out_s3_full_pred_1_br_taken_mask_1.xdata.value = 1
dut.io_out_s3_full_pred_2_br_taken_mask_1.xdata.value = 1
dut.io_out_s3_full_pred_3_br_taken_mask_1.xdata.value = 1
# slots valid
dut.io_out_s3_full_pred_0_slot_valids_0.xdata.value = 1
dut.io_out_s3_full_pred_1_slot_valids_0.xdata.value = 1
dut.io_out_s3_full_pred_2_slot_valids_0.xdata.value = 1
dut.io_out_s3_full_pred_3_slot_valids_0.xdata.value = 1
dut.io_out_s3_full_pred_0_slot_valids_1.xdata.value = 1
dut.io_out_s3_full_pred_1_slot_valids_1.xdata.value = 1
dut.io_out_s3_full_pred_2_slot_valids_1.xdata.value = 1
dut.io_out_s3_full_pred_3_slot_valids_1.xdata.value = 1
# targets
dut.io_out_s3_full_pred_0_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s3_full_pred_1_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s3_full_pred_2_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s3_full_pred_3_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s3_full_pred_0_targets_1.xdata.value = 0xdeadbeef
dut.io_out_s3_full_pred_1_targets_1.xdata.value = 0xdeadbeef
dut.io_out_s3_full_pred_2_targets_1.xdata.value = 0xdeadbeef
dut.io_out_s3_full_pred_3_targets_1.xdata.value = 0xdeadbeef
# jalr target
dut.io_out_s3_full_pred_0_jalr_target.xdata.value = 0xbeefdead
dut.io_out_s3_full_pred_1_jalr_target.xdata.value = 0xbeefdead
dut.io_out_s3_full_pred_2_jalr_target.xdata.value = 0xbeefdead
dut.io_out_s3_full_pred_3_jalr_target.xdata.value = 0xbeefdead
# offsets
dut.io_out_s3_full_pred_3_offsets_0.xdata.value = 0
dut.io_out_s3_full_pred_3_offsets_1.xdata.value = 1
# fallThroughAddr
dut.io_out_s3_full_pred_0_fallThroughAddr.xdata.value = 0x1f1f1f1f
dut.io_out_s3_full_pred_1_fallThroughAddr.xdata.value = 0x1f1f1f1f
dut.io_out_s3_full_pred_2_fallThroughAddr.xdata.value = 0x1f1f1f1f
dut.io_out_s3_full_pred_3_fallThroughAddr.xdata.value = 0x1f1f1f1f
# br sharing
dut.io_out_s3_full_pred_0_is_br_sharing.xdata.value = 1
dut.io_out_s3_full_pred_1_is_br_sharing.xdata.value = 1
dut.io_out_s3_full_pred_2_is_br_sharing.xdata.value = 1
dut.io_out_s3_full_pred_3_is_br_sharing.xdata.value = 1
# hit
dut.io_out_s3_full_pred_0_hit.xdata.value = 1
dut.io_out_s3_full_pred_1_hit.xdata.value = 1
dut.io_out_s3_full_pred_2_hit.xdata.value = 1
dut.io_out_s3_full_pred_3_hit.xdata.value = 1
def init_dut_s2_useless_port(dut: DUTITTage):
# br taken mask 0
dut.io_out_s2_full_pred_0_br_taken_mask_0.xdata.value = 1
dut.io_out_s2_full_pred_1_br_taken_mask_0.xdata.value = 1
dut.io_out_s2_full_pred_2_br_taken_mask_0.xdata.value = 1
dut.io_out_s2_full_pred_3_br_taken_mask_0.xdata.value = 1
# br taken maks 1
dut.io_out_s2_full_pred_0_br_taken_mask_1.xdata.value = 1
dut.io_out_s2_full_pred_1_br_taken_mask_1.xdata.value = 1
dut.io_out_s2_full_pred_2_br_taken_mask_1.xdata.value = 1
dut.io_out_s2_full_pred_3_br_taken_mask_1.xdata.value = 1
# slots valid
dut.io_out_s2_full_pred_0_slot_valids_0.xdata.value = 1
dut.io_out_s2_full_pred_1_slot_valids_0.xdata.value = 1
dut.io_out_s2_full_pred_2_slot_valids_0.xdata.value = 1
dut.io_out_s2_full_pred_3_slot_valids_0.xdata.value = 1
dut.io_out_s2_full_pred_0_slot_valids_1.xdata.value = 1
dut.io_out_s2_full_pred_1_slot_valids_1.xdata.value = 1
dut.io_out_s2_full_pred_2_slot_valids_1.xdata.value = 1
dut.io_out_s2_full_pred_3_slot_valids_1.xdata.value = 1
# targets
dut.io_out_s2_full_pred_0_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s2_full_pred_1_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s2_full_pred_2_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s2_full_pred_3_targets_0.xdata.value = 0xdeadbeef
dut.io_out_s2_full_pred_0_targets_1.xdata.value = 0xdeadbeef
dut.io_out_s2_full_pred_1_targets_1.xdata.value = 0xdeadbeef
dut.io_out_s2_full_pred_2_targets_1.xdata.value = 0xdeadbeef
dut.io_out_s2_full_pred_3_targets_1.xdata.value = 0xdeadbeef
# jalr target
dut.io_out_s2_full_pred_0_jalr_target.xdata.value = 0xbeefdead
dut.io_out_s2_full_pred_1_jalr_target.xdata.value = 0xbeefdead
dut.io_out_s2_full_pred_2_jalr_target.xdata.value = 0xbeefdead
dut.io_out_s2_full_pred_3_jalr_target.xdata.value = 0xbeefdead
# offsets
dut.io_out_s2_full_pred_0_offsets_0.xdata.value = 0
dut.io_out_s2_full_pred_1_offsets_0.xdata.value = 0
dut.io_out_s2_full_pred_2_offsets_0.xdata.value = 0
dut.io_out_s2_full_pred_3_offsets_0.xdata.value = 0
dut.io_out_s2_full_pred_0_offsets_1.xdata.value = 1
dut.io_out_s2_full_pred_1_offsets_1.xdata.value = 1
dut.io_out_s2_full_pred_2_offsets_1.xdata.value = 1
dut.io_out_s2_full_pred_3_offsets_1.xdata.value = 1
# fallThroughAddr
dut.io_out_s2_full_pred_0_fallThroughAddr.xdata.value = 0x1f1f1f1f
dut.io_out_s2_full_pred_1_fallThroughAddr.xdata.value = 0x1f1f1f1f
dut.io_out_s2_full_pred_2_fallThroughAddr.xdata.value = 0x1f1f1f1f
dut.io_out_s2_full_pred_3_fallThroughAddr.xdata.value = 0x1f1f1f1f
# br sharing
dut.io_out_s2_full_pred_0_is_br_sharing.xdata.value = 1
dut.io_out_s2_full_pred_1_is_br_sharing.xdata.value = 1
dut.io_out_s2_full_pred_2_is_br_sharing.xdata.value = 1
dut.io_out_s2_full_pred_3_is_br_sharing.xdata.value = 1
# hit
dut.io_out_s2_full_pred_0_hit.xdata.value = 1
dut.io_out_s2_full_pred_1_hit.xdata.value = 1
dut.io_out_s2_full_pred_2_hit.xdata.value = 1
dut.io_out_s2_full_pred_3_hit.xdata.value = 1

View File

@ -5,8 +5,14 @@ import mlvp
from env.driver import *
from utils.BRTParser import *
import mlvp.funcov as fc
from mlvp.reporter import CovGroup
from mlvp.reporter import set_func_coverage, set_line_coverage
import random
# The test cases for ITTAGE basic functions
def gen_random_pc_and_fh(fh: FoldedHists = None):
pc = random.randint(0, 0x1ffffffffff)
if fh is None:
@ -16,15 +22,31 @@ def gen_random_pc_and_fh(fh: FoldedHists = None):
return pc, fh.get_ref_fh()
# Test provider provides targets function
def test_ittage_provider():
def test_ittage_provider(request):
_cov_file_name = "./report/ittage_coverage_func_provider.dat"
_waveform_file_name = "./report/ittage_func_provider"
mlvp.setup_logging(log_level=logging.INFO,
format=default_fmt,
console_display=True,
log_file='log_ittage_provider.log')
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1)
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1,
waveform_filename = _waveform_file_name,
coverage_filename = _cov_file_name)
fh = FoldedHists()
# function converage group
# g_inter = fc.CovGroup("interaction")
# g_inter.add_watch_point(_driver.dut.reset, {'reset': fc.Eq(1)}, name = 'reset')
# g_inter.add_watch_point(_driver.dut.io_s0_fire_3, {'s0_fire': fc.Eq(1)}, name = 's0_fire_3')
# g_inter.add_watch_point(_driver.dut.io_s1_fire_3, {'s1_fire': fc.Eq(1)}, name = 's1_fire_3')
# g_inter.add_watch_point(_driver.dut.io_s2_fire_3, {'s2_fire': fc.Eq(1)}, name = 's2_fire_3')
# g_inter.add_watch_point(_driver.dut.io_update_valid, {'update_valid': fc.Eq(1)}, name = 'update_valid')
# g_provider = fc.CovGroup("provider function")
# TODO: only set watch point for specific bit segment in meta
# masked_meta = get_masked_meta()
# g_provider.add_watch_point(_driver.dut.io_out_last_stage_meta, {'meta': fc.Eq(masked_meta)}, name='s3_last_stage_meta')
_targets = [0x1111111111, 0x2222222222, 0x3333333333, 0x4444444444, 0x5555555555]
for i in range(0, 5):
_pc, _fh = gen_random_pc_and_fh(fh)
@ -37,17 +59,29 @@ def test_ittage_provider():
_driver.manual_run(pc = _pc, folded_hists = _fh, target = _targets[i], manual_alloc = False, has_update = False)
_driver.finish()
# set_func_coverage(request, [g_inter, g_provider])
set_line_coverage(request, _cov_file_name)
# Test alt provider functions
def test_ittage_alt_provider():
def test_ittage_alt_provider(request):
_cov_file_name = "./report/ittage_coverage_func_alt_provider.dat"
_waveform_file_name = "./report/ittage_func_alt_provider.fst"
mlvp.setup_logging(log_level=logging.INFO,
format=default_fmt,
console_display=True,
log_file='log_ittage_alt_provider.log')
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1)
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1,
waveform_filename = _waveform_file_name,
coverage_filename = _cov_file_name)
fh = FoldedHists()
# function converage group
# g_alt = fc.CovGroup("alt provider function")
# TODO: only set watch point for specific bit segment in meta
# masked_meta = get_masked_meta()
# g_alt.add_watch_point(_driver.dut.io_out_last_stage_meta, {'meta': fc.Eq(masked_meta)}, name='s3_last_stage_meta')
_targets = [0x1111111111, 0x2222222222, 0x3333333333, 0x4444444444, 0x5555555555]
# alt provider alloc and ctr functions
for provider in range(1, 5):
@ -69,17 +103,29 @@ def test_ittage_alt_provider():
_driver.manual_run(pc = _pc, folded_hists = _fh, target = _targets[4], manual_alloc = False, has_update = False)
_driver.finish()
# set_func_coverage(request, [g_alt])
set_line_coverage(request, _cov_file_name)
# Test ctr functions
def test_ittage_ctr():
def test_ittage_ctr(request):
_cov_file_name = "./report/ittage_coverage_func_ctr.dat"
_waveform_file_name = "./report/ittage_func_ctr.fst"
mlvp.setup_logging(log_level=logging.INFO,
format=default_fmt,
console_display=True,
log_file='log_ittage_ctr.log')
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1)
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1,
waveform_filename = _waveform_file_name,
coverage_filename = _cov_file_name)
fh = FoldedHists()
# function converage group
# g_ctr = fc.CovGroup("ctr function")
# TODO: only set watch point for specific bit segment in meta
# masked_meta = get_masked_meta()
# g_ctr.add_watch_point(_driver.dut.io_out_last_stage_meta, {'meta': fc.Eq(masked_meta)}, name='s3_last_stage_meta')
_targets = [0x1111111111, 0x2222222222, 0x3333333333, 0x4444444444]
# single provider ctr
for provider in range(0, 5):
@ -118,17 +164,29 @@ def test_ittage_ctr():
_driver.manual_run(pc = _pc, folded_hists = _fh, target = _targets[0], manual_alloc = True, alloc_valid = 0, has_update = False)
_driver.finish()
# set_func_coverage(request, [g_ctr])
set_line_coverage(request, _cov_file_name)
# Test usefulness functions
def test_ittage_useful():
def test_ittage_useful(request):
_cov_file_name = "./report/ittage_coverage_func_useful.dat"
_waveform_file_name = "./report/ittage_func_useful.fst"
mlvp.setup_logging(log_level=logging.INFO,
format=default_fmt,
console_display=True,
log_file='log_ittage_useful.log')
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1)
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1,
waveform_filename = _waveform_file_name,
coverage_filename = _cov_file_name)
fh = FoldedHists()
# function converage group
# g_useful = fc.CovGroup("useful function")
# TODO: only set watch point for specific bit segment in meta
# masked_meta = get_masked_meta()
# g_useful.add_watch_point(_driver.dut.io_out_last_stage_meta, {'meta': fc.Eq(masked_meta)}, name='s3_last_stage_meta')
_targets = [0x1111111111, 0x2222222222, 0x3333333333]
for provider in range(1, 5):
for alt in range(0, provider):
@ -147,17 +205,29 @@ def test_ittage_useful():
_driver.manual_run(pc = _pc, folded_hists = _fh, target = _targets[2], manual_alloc = False, has_update = False)
_driver.finish()
# set_func_coverage(request, [g_useful])
set_line_coverage(request, _cov_file_name)
# Test alloc functions
def test_ittage_alloc():
def test_ittage_alloc(request):
_cov_file_name = "./report/ittage_coverage_func_alloc.dat"
_waveform_file_name = "./report/ittage_func_alloc.fst"
mlvp.setup_logging(log_level=logging.INFO,
format=default_fmt,
console_display=True,
log_file='log_ittage_alloc.log')
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1)
_driver = ITTAGEDriver(log_mode = 0, max_trace = 1000, update_latency = 1,
waveform_filename = _waveform_file_name,
coverage_filename = _cov_file_name)
fh = FoldedHists()
# function converage group
# g_alloc = fc.CovGroup("alloc function")
# TODO: only set watch point for specific bit segment in meta
# masked_meta = get_masked_meta()
# g_alloc.add_watch_point(_driver.dut.io_out_last_stage_meta, {'meta': fc.Eq(masked_meta)}, name='s3_last_stage_meta')
_targets = [0x1111111111, 0x2222222222]
# tickCtr function test
_input_vec = []
@ -186,4 +256,7 @@ def test_ittage_alloc():
for (temp_pc, temp_fh) in _input_vec:
_target_random = random.randint(0, 0x1ffffffffff)
_driver.manual_run(pc = temp_pc, folded_hists = temp_fh, target = _target_random, manual_alloc = True, alloc_valid = 0)
_driver.finish()
_driver.finish()
# set_func_coverage(request, [g_alloc])
set_line_coverage(request, _cov_file_name)