// ----------- // Copyright (c) 2020. RISC-V International. All rights reserved. // SPDX-License-Identifier: BSD-3-Clause // ----------- // // // Test to check if mcause gets update in trap handler and appear in coverage report or not #define rvtest_strap_routine #include "model_test.h" #include "arch_test.h" RVTEST_ISA("RV32I") # Test code region .section .text.init .globl rvtest_entry_point rvtest_entry_point: RVMODEL_BOOT RVTEST_CODE_BEGIN #ifdef TEST_CASE_1 RVTEST_CASE(1,"//check ISA:=regex(.*32.*); check ISA:=regex(.*I.*Zicsr.*); def rvtest_mtrap_routine=True; def TEST_CASE_1=True",mcause) RVTEST_SIGBASE( x13,signature_x13_1) .option nopic .attribute unaligned_access, 0 .attribute stack_align, 16 .align 2 main: // ILLEGAL INSTRUCTION csrw mhartid, a5 // Write all 1 to mcause nop // nop in case of trap #endif # --------------------------------------------------------------------------------------------- # HALT RVTEST_CODE_END RVMODEL_HALT RVTEST_DATA_BEGIN .align 4 rvtest_data: .word 0xdeadcafe RVTEST_DATA_END RVMODEL_DATA_BEGIN signature_x13_0: .fill 0*(XLEN/32),4,0x12345678 signature_x13_1: .fill 4*(XLEN/32),4,0xcafebeef #ifdef rvtest_mtrap_routine mtrap_sigptr: .fill 12*(XLEN/32),4,0xdeadbeef #endif #ifdef rvtest_gpr_save gpr_save: .fill 24*(XLEN/32),4,0xc9a8b7f1 #endif RVMODEL_DATA_END