From: Luke Kenneth Casson Leighton Date: Mon, 1 Oct 2018 11:00:31 +0000 (+0100) Subject: add sv scalar src test which highlighted flaw in spike-sv X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ecf9aeea425a1978b7ac9aa9e41e68af66693d52;p=riscv-tests.git add sv scalar src test which highlighted flaw in spike-sv --- diff --git a/isa/rv64ui/Makefrag.sv b/isa/rv64ui/Makefrag.sv index 8c9b0a6..eac21e2 100644 --- a/isa/rv64ui/Makefrag.sv +++ b/isa/rv64ui/Makefrag.sv @@ -5,6 +5,7 @@ rv64ui_sv_tests = \ sv_addi \ sv_addi_redirect \ + sv_addi_scalar_src \ rv64ui_p_tests = $(addprefix rv64ui-p-, $(rv64ui_sv_tests)) rv64ui_v_tests = $(addprefix rv64ui-v-, $(rv64ui_sv_tests)) diff --git a/isa/rv64ui/sv_addi_scalar_src.S b/isa/rv64ui/sv_addi_scalar_src.S new file mode 100644 index 0000000..2d1e974 --- /dev/null +++ b/isa/rv64ui/sv_addi_scalar_src.S @@ -0,0 +1,59 @@ +#include "riscv_test.h" +#include "sv_test_macros.h" + +RVTEST_RV64U # Define TVM used by program. + + +# SV test: sets up x6 data as a scalar, sets VL to 2, and carries out +# an "add 1 to x6 and store in x3". +# which actually means: +# "add add 1 to x6 and store in x3" *AND* +# "add add 1 to x6 and store in x4" + +# Test code region. +RVTEST_CODE_BEGIN # Start of test code. + + SV_LD_DATA( x2, testdata , 0) + SV_LD_DATA( x5, testdata+24, 0) + + li x6, 41 + + SET_SV_MVL(2) + SET_SV_CSR(1, 3, 0, 3, 1, 0) + SET_SV_VL(2) + + addi x3, x6, 1 + + CLR_SV_CSRS() + SET_SV_VL(0) + SET_SV_MVL(0) + + TEST_SV_IMM(x2, 1001) # should not be modified + TEST_SV_IMM(x3, 42) + TEST_SV_IMM(x4, 42) + TEST_SV_IMM(x5, 1002) # should not be modified + + RVTEST_PASS # Signal success. +fail: + RVTEST_FAIL +RVTEST_CODE_END # End of test code. + +# Input data section. +# This section is optional, and this data is NOT saved in the output. +.data + .align 3 +testdata: + .dword 1001 + .dword 49 + .dword 49 + .dword 1002 + +# Output data section. +RVTEST_DATA_BEGIN # Start of test output data region. + .align 3 +result: + .dword -1 + .dword -1 + .dword -1 +RVTEST_DATA_END # End of test output data region. +