forked from OSchip/UnityChipVerification
Updated DUT tests to support testing multiple use cases at once
This commit is contained in:
parent
cb6ab414b9
commit
14507d6986
|
|
@ -3,6 +3,7 @@ split_verilogs
|
|||
.vscode
|
||||
**/__pycache__/
|
||||
*.fst
|
||||
*.fst.hier
|
||||
*.log
|
||||
*.dat
|
||||
**/UT_*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
TEST_MODULE=FauFTB
|
||||
TEST=.
|
||||
TEST_FOLDER=./$(TEST)
|
||||
COV_FILE_NAME=V$(TEST_MODULE)_coverage.dat
|
||||
|
||||
PYTHON=python3
|
||||
|
||||
|
|
@ -16,4 +14,4 @@ run:
|
|||
@$(PYTHON) -c $(START_CODE)
|
||||
|
||||
clean:
|
||||
rm -rf report/ *.fst *.dat
|
||||
rm -rf report/ *.fst *.dat *.log *.hier
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import mlvp
|
||||
import logging
|
||||
|
||||
import os
|
||||
os.sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
||||
|
|
@ -10,10 +11,10 @@ from env.config import *
|
|||
os.sys.path.append(DUT_PATH)
|
||||
|
||||
from UT_FauFTB import *
|
||||
uFTB = DUTFauFTB()
|
||||
uFTB.init_clock("clock")
|
||||
|
||||
def set_imm_mode():
|
||||
|
||||
|
||||
def set_imm_mode(uFTB):
|
||||
imm_mode = uFTB.io_s0_fire_0.xdata.Imme
|
||||
need_to_write_imm = ["io_s0_fire_0", "io_s0_fire_1", "io_s0_fire_2", "io_s0_fire_3",
|
||||
"io_s1_fire_0", "io_s2_fire_0", "io_in_bits_s0_pc_0", "io_in_bits_s0_pc_1",
|
||||
|
|
@ -21,9 +22,8 @@ def set_imm_mode():
|
|||
for name in need_to_write_imm:
|
||||
getattr(uFTB, name).xdata.SetWriteMode(imm_mode)
|
||||
|
||||
set_imm_mode()
|
||||
|
||||
async def uftb_test():
|
||||
async def uftb_test(uFTB):
|
||||
uFTB_update = UpdateBundle.from_prefix(uFTB, "io_update_")
|
||||
uFTB_out = BranchPredictionResp.from_prefix(uFTB, "io_out_")
|
||||
pipeline_ctrl = PipelineCtrlBundle.from_prefix(uFTB, "io_")
|
||||
|
|
@ -40,32 +40,37 @@ import mlvp.funcov as fc
|
|||
from mlvp.reporter import *
|
||||
|
||||
def test_uftb(request):
|
||||
g = fc.CovGroup("uftb_with_ftq")
|
||||
# Create DUT
|
||||
uFTB = DUTFauFTB(waveform_filename="uftb_with_ftq.fst", coverage_filename="uftb_with_ftq_coverage.dat")
|
||||
uFTB.init_clock("clock")
|
||||
set_imm_mode(uFTB)
|
||||
|
||||
g.add_watch_point(uFTB.reset, { "reset": fc.Eq(1), }, name="reset")
|
||||
g.add_watch_point(uFTB.io_ctrl_ubtb_enable, { "ubtb_enable": fc.Eq(1), }, name="ubtb_enable")
|
||||
g.add_watch_point(uFTB.io_s0_fire_0, { "s0_fire": fc.Eq(1), }, name="s0_fire_0")
|
||||
g.add_watch_point(uFTB.io_s1_fire_0, { "s1_fire": fc.Eq(1), }, name="s1_fire_0")
|
||||
g.add_watch_point(uFTB.io_s2_fire_0, { "s2_fire": fc.Eq(1), }, name="s2_fire_0")
|
||||
g.add_watch_point(uFTB.io_update_valid, { "update_valid": fc.Eq(1), }, name="update_valid")
|
||||
# Set Coverage
|
||||
g1 = fc.CovGroup("interaction")
|
||||
g1.add_watch_point(uFTB.reset, { "reset": fc.Eq(1), }, name="reset")
|
||||
g1.add_watch_point(uFTB.io_ctrl_ubtb_enable, { "ubtb_enable": fc.Eq(1), }, name="ubtb_enable")
|
||||
g1.add_watch_point(uFTB.io_s0_fire_0, { "s0_fire": fc.Eq(1), }, name="s0_fire_0")
|
||||
g1.add_watch_point(uFTB.io_s1_fire_0, { "s1_fire": fc.Eq(1), }, name="s1_fire_0")
|
||||
g1.add_watch_point(uFTB.io_s2_fire_0, { "s2_fire": fc.Eq(1), }, name="s2_fire_0")
|
||||
g1.add_watch_point(uFTB.io_update_valid, { "update_valid": fc.Eq(1), }, name="update_valid")
|
||||
|
||||
g.add_watch_point(uFTB.io_out_s1_full_pred_0_hit, { "hit": fc.Eq(1), "not_hit": fc.Eq(0) }, name="s1_full_pred_0_hit")
|
||||
g.add_watch_point(uFTB.io_out_s1_full_pred_3_fallThroughErr, { "fallThroughErr": fc.Eq(1), "not_fallThroughErr": fc.Eq(0) }, name="s1_full_pred_3_fallThroughErr")
|
||||
g.add_watch_point(uFTB.io_out_s1_full_pred_0_slot_valids_0, { "slot_valids_0": fc.Eq(1), "slot_valids_0_invalid": fc.Eq(0) }, name="s1_full_pred_0_slot_valids_0")
|
||||
g.add_watch_point(uFTB.io_out_s1_full_pred_0_slot_valids_1, { "slot_valids_1": fc.Eq(1), "slot_valids_1_invalid": fc.Eq(0) }, name="s1_full_pred_0_slot_valids_1")
|
||||
g.add_watch_point(uFTB.io_out_s1_full_pred_0_br_taken_mask_0, { "br_taken_mask_0": fc.Eq(1), "br_taken_mask_0_invalid": fc.Eq(0) }, name="s1_full_pred_0_br_taken_mask_0")
|
||||
g.add_watch_point(uFTB.io_out_s1_full_pred_0_br_taken_mask_1, { "br_taken_mask_1": fc.Eq(1), "br_taken_mask_1_invalid": fc.Eq(0) }, name="s1_full_pred_0_br_taken_mask_1")
|
||||
g.add_watch_point(uFTB.io_out_s1_full_pred_0_is_br_sharing, { "is_br_sharing": fc.Eq(1), "is_br_sharing_invalid": fc.Eq(0) }, name="s1_full_pred_0_is_br_sharing")
|
||||
g2 = fc.CovGroup("ftb_entry")
|
||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_hit, { "hit": fc.Eq(1), "not_hit": fc.Eq(0) }, name="s1_full_pred_0_hit")
|
||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_3_fallThroughErr, { "fallThroughErr": fc.Eq(1), "not_fallThroughErr": fc.Eq(0) }, name="s1_full_pred_3_fallThroughErr")
|
||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_slot_valids_0, { "slot_valids_0": fc.Eq(1), "slot_valids_0_invalid": fc.Eq(0) }, name="s1_full_pred_0_slot_valids_0")
|
||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_slot_valids_1, { "slot_valids_1": fc.Eq(1), "slot_valids_1_invalid": fc.Eq(0) }, name="s1_full_pred_0_slot_valids_1")
|
||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_br_taken_mask_0, { "br_taken_mask_0": fc.Eq(1), "br_taken_mask_0_invalid": fc.Eq(0) }, name="s1_full_pred_0_br_taken_mask_0")
|
||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_br_taken_mask_1, { "br_taken_mask_1": fc.Eq(1), "br_taken_mask_1_invalid": fc.Eq(0) }, name="s1_full_pred_0_br_taken_mask_1")
|
||||
g2.add_watch_point(uFTB.io_out_s1_full_pred_0_is_br_sharing, { "is_br_sharing": fc.Eq(1), "is_br_sharing_invalid": fc.Eq(0) }, name="s1_full_pred_0_is_br_sharing")
|
||||
|
||||
uFTB.xclock.StepRis(lambda _: g1.sample())
|
||||
uFTB.xclock.StepRis(lambda _: g2.sample())
|
||||
|
||||
uFTB.xclock.StepRis(lambda _: g.sample())
|
||||
set_func_coverage(request, g)
|
||||
set_line_coverage(request, "VFauFTB_coverage.dat")
|
||||
|
||||
import logging
|
||||
# Run the test
|
||||
mlvp.setup_logging(log_level=logging.INFO, log_file="uftb_with_ftq.log")
|
||||
|
||||
mlvp.run(uftb_test())
|
||||
|
||||
mlvp.run(uftb_test(uFTB))
|
||||
uFTB.finalize()
|
||||
|
||||
pred_stat.summary()
|
||||
set_func_coverage(request, [g1, g2])
|
||||
set_line_coverage(request, "uftb_with_ftq_coverage.dat")
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ class FauFTB(DUTFauFTB):
|
|||
]
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.io_in_bits_s0_pc = self.Io_in_bits_s0_pc(self)
|
||||
self.io_out_s1_pc = self.Io_out_s1_pc(self)
|
||||
self.io_s0_fire = self.Io_s0_fire(self)
|
||||
|
|
|
|||
|
|
@ -37,9 +37,7 @@ from mlvp.reporter import *
|
|||
|
||||
def test_raw(request):
|
||||
|
||||
set_line_coverage(request, "VFauFTB_coverage.dat")
|
||||
|
||||
uFTB: FauFTB = FauFTB()
|
||||
uFTB: FauFTB = FauFTB(waveform_filename="uftb_raw.fst", coverage_filename="uftb_raw_coverage.dat")
|
||||
ftb_entry_list()
|
||||
uFTB.reset.value = 1
|
||||
uFTB.Step(100)
|
||||
|
|
@ -58,6 +56,8 @@ def test_raw(request):
|
|||
|
||||
uFTB.finalize()
|
||||
|
||||
set_line_coverage(request, "uftb_raw_coverage.dat")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_raw()
|
||||
|
|
|
|||
Loading…
Reference in New Issue