/*Copyright (c) 2012-2015, The Regents of the University of California (Regents).*/ /* All Rights Reserved. */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions are met: */ /* 1. Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* 2. Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in the */ /* documentation and/or other materials provided with the distribution. */ /* 3. Neither the name of the Regents nor the */ /* names of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written permission. */ /* IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, */ /* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING */ /* OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS */ /* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, */ /* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED */ /* HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE */ /* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #ifndef _ENV_PHYSICAL_SINGLE_CORE_H #define _ENV_PHYSICAL_SINGLE_CORE_H #include "../../riscv-tests/env/encoding.h" //----------------------------------------------------------------------- // Begin Macro //----------------------------------------------------------------------- #define RVTEST_RV64U \ .macro init; \ .endm #define RVTEST_RV64UF \ .macro init; \ RVTEST_FP_ENABLE; \ .endm #define RVTEST_RV64UV \ .macro init; \ RVTEST_VECTOR_ENABLE; \ .endm #define RVTEST_RV32U \ .macro init; \ .endm #define RVTEST_RV32UF \ .macro init; \ RVTEST_FP_ENABLE; \ .endm #define RVTEST_RV32UV \ .macro init; \ RVTEST_VECTOR_ENABLE; \ .endm #define RVTEST_RV64M \ .macro init; \ RVTEST_ENABLE_MACHINE; \ .endm #define RVTEST_RV64S \ .macro init; \ RVTEST_ENABLE_SUPERVISOR; \ .endm #define RVTEST_RV32M \ .macro init; \ RVTEST_ENABLE_MACHINE; \ .endm #define RVTEST_RV32S \ .macro init; \ RVTEST_ENABLE_SUPERVISOR; \ .endm #if __riscv_xlen == 64 # define CHECK_XLEN li a0, 1; slli a0, a0, 31; bgez a0, 1f; RVTEST_PASS; 1: #else # define CHECK_XLEN li a0, 1; slli a0, a0, 31; bltz a0, 1f; RVTEST_PASS; 1: #endif #define INIT_XREG \ li x1, 0; \ li x2, 0; \ li x3, 0; \ li x4, 0; \ li x5, 0; \ li x6, 0; \ li x7, 0; \ li x8, 0; \ li x9, 0; \ li x10, 0; \ li x11, 0; \ li x12, 0; \ li x13, 0; \ li x14, 0; \ li x15, 0; \ li x16, 0; \ li x17, 0; \ li x18, 0; \ li x19, 0; \ li x20, 0; \ li x21, 0; \ li x22, 0; \ li x23, 0; \ li x24, 0; \ li x25, 0; \ li x26, 0; \ li x27, 0; \ li x28, 0; \ li x29, 0; \ li x30, 0; \ li x31, 0; #define RVTEST_CODE_BEGIN \ .global _start; \ .section .text.init; \ .align 6; \ _start: \ INIT_XREG; \ CHECK_XLEN; \ .align 2; \ //----------------------------------------------------------------------- // End Macro //----------------------------------------------------------------------- #define RVTEST_CODE_END //----------------------------------------------------------------------- // Pass/Fail Macro //----------------------------------------------------------------------- #define RVTEST_PASS \ addi x0, zero, 0; \ addi x1, zero, 0xFF; \ sw x1, 0(x0); \ ebreak; #define TESTNUM gp #define RVTEST_FAIL \ addi x0, zero, 0; \ addi x1, zero, 0; \ sw x1, 0(x0); \ ebreak; //----------------------------------------------------------------------- // Data Section Macro //----------------------------------------------------------------------- #define EXTRA_DATA #define RVTEST_DATA_BEGIN #define RVTEST_DATA_END #endif