diff --git a/ut_backend/ctrl_block/decode/test_rv_decode.py b/ut_backend/ctrl_block/decode/test_rv_decode.py index eec6d1e..cbf0793 100644 --- a/ut_backend/ctrl_block/decode/test_rv_decode.py +++ b/ut_backend/ctrl_block/decode/test_rv_decode.py @@ -10,15 +10,18 @@ from comm import TAG_LONG_TIME_RUN, debug from dut.rvcexpander.UT_RVCExpander import * -# rvc test def rvc_expand(full_inst): + """ + Test the RVC expansion function + Parameters: + @full_inst: whether to use a full instruction set + """ if full_inst: ref_insts = generate_rvc_instructions() else: ref_insts = generate_random_32bits(1) rvc_expand = DUTRVCExpander() rvc_expand.io_in.AsImmWrite() - debug("###################### test_rvc_expand ##########################") for insn in ref_insts: c_void_ptr = libdisasm.disasm(ctypes.c_uint64(insn)) insn_disasm = ctypes.cast(c_void_ptr, ctypes.c_char_p).value.decode('utf-8') @@ -35,18 +38,27 @@ def rvc_expand(full_inst): def test_rvc_expand(): + """ + Test the RVC expansion function with a partial instruction set + """ rvc_expand(False) @pytest.mark.toffee_tags(TAG_LONG_TIME_RUN) def test_rvc_expand_full(): + """ + Test the RVC expansion function with a full instruction set + """ rvc_expand(True) -# rvc test, processed by the decoder module -@pytest.mark.toffee_tags(version="openxiangshan-kmh-97e37a2237-24092702 < openxiangshan-kmh-97e37a2237-24092703") +@pytest.mark.toffee_tags(version="openxiangshan-kmh-97e37a2237-24092701 < openxiangshan-kmh-97e37a2237-24092703") def test_rvc_inst(decoder_fixture): - debug("###################### test_rvc_inst ##########################") + """ + Test the RVC instruction set, an example of the tag version in range. + Parameters: + @decoder_fixture: the fixture of the decoder + """ decoder = decoder_fixture need_log_file = True # insn_list_temp = generate_rvc_instructions() @@ -56,9 +68,12 @@ def test_rvc_inst(decoder_fixture): g.add_cover_point(decoder, {"fast_check_RVC_ramdom": lambda _: True}, name="RVC").sample() -# randomly generate instructions for testing def test_rvi_inst(decoder_fixture): - debug("###################### test_rvi_inst ##########################") + """ + Test the RVI instruction set. randomly generate instructions for testing + Parameters: + @decoder_fixture: the fixture of the decoder + """ decoder = decoder_fixture need_log_file = True insn_list_temp = generate_random_32bits(100) @@ -67,9 +82,12 @@ def test_rvi_inst(decoder_fixture): g.add_cover_point(decoder, {"fast_check_random_32bit_int": lambda _: True}, name="RVI").sample() -# testing of V extension instructions, which are not actually used def test_rv_custom_inst(decoder_fixture): - debug("###################### test_rv_custom_inst ##########################") + """ + Test the custom instruction set. Testing of V extension instructions, which are not actually used + Parameters: + @decoder_fixture: the fixture of the decoder + """ decoder = decoder_fixture need_log_file = True custom_v_opcode = 0b1010111