diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-04-30 20:45:27 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2016-04-30 20:45:27 -0700 |
commit | 22742246287feda0be2666ba14ca6f4a6bc73bb2 (patch) | |
tree | a15d7df63f796e13e6c28a2ec82a36f68af5c3a5 | |
parent | 8dda7b2034197109a2387ac3dd03c7ad1e8c0b65 (diff) | |
download | riscv-tests-22742246287feda0be2666ba14ca6f4a6bc73bb2.zip riscv-tests-22742246287feda0be2666ba14ca6f4a6bc73bb2.tar.gz riscv-tests-22742246287feda0be2666ba14ca6f4a6bc73bb2.tar.bz2 |
ERET -> xRET; new memory map
For now, we no longer build hex files, because the programs don't
start at address 0. This decision will likely be revisited.
-rw-r--r-- | benchmarks/Makefile | 10 | ||||
-rw-r--r-- | benchmarks/common/crt.S | 12 | ||||
-rw-r--r-- | benchmarks/common/syscalls.c | 92 | ||||
-rw-r--r-- | benchmarks/common/test.ld | 2 | ||||
m--------- | env | 10 | ||||
-rw-r--r-- | isa/Makefile | 16 | ||||
-rw-r--r-- | isa/macros/vector/test_macros.h | 24 | ||||
-rw-r--r-- | isa/rv32mi/Makefrag | 4 | ||||
-rw-r--r-- | isa/rv32mi/timer.S | 7 | ||||
-rw-r--r-- | isa/rv32ui/Makefrag | 4 | ||||
-rw-r--r-- | isa/rv64mi/Makefrag | 4 | ||||
-rw-r--r-- | isa/rv64mi/dirty.S | 16 | ||||
-rw-r--r-- | isa/rv64mi/illegal.S | 2 | ||||
-rw-r--r-- | isa/rv64mi/ma_addr.S | 2 | ||||
-rw-r--r-- | isa/rv64mi/mcsr.S | 8 | ||||
-rw-r--r-- | isa/rv64mi/timer.S | 1103 | ||||
-rw-r--r-- | isa/rv64si/csr.S | 24 | ||||
-rw-r--r-- | isa/rv64si/ma_fetch.S | 1 | ||||
-rw-r--r-- | isa/rv64si/sbreak.S | 1 | ||||
-rw-r--r-- | isa/rv64si/scall.S | 4 | ||||
-rw-r--r-- | isa/rv64uf/Makefrag | 3 | ||||
-rw-r--r-- | isa/rv64ui/Makefrag | 4 |
22 files changed, 152 insertions, 1201 deletions
diff --git a/benchmarks/Makefile b/benchmarks/Makefile index 1145fed..8cc1e35 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -48,10 +48,10 @@ HOST_COMP = gcc $(HOST_OPTS) RISCV_PREFIX ?= riscv64-unknown-elf- RISCV_GCC ?= $(RISCV_PREFIX)gcc -RISCV_GCC_OPTS ?= -static -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf +RISCV_GCC_OPTS ?= -fpie -static -std=gnu99 -O2 -ffast-math -fno-common -fno-builtin-printf RISCV_LINK ?= $(RISCV_GCC) -T $(src_dir)/common/test.ld $(incs) RISCV_LINK_MT ?= $(RISCV_GCC) -T $(src_dir)/common/test-mt.ld -RISCV_LINK_OPTS ?= -nostdlib -nostartfiles -ffast-math -lc -lgcc +RISCV_LINK_OPTS ?= -nostdlib -nostartfiles -ffast-math -lgcc RISCV_OBJDUMP ?= $(RISCV_PREFIX)objdump --disassemble-all --disassemble-zeroes --section=.text --section=.text.startup --section=.data RISCV_SIM ?= spike @@ -68,15 +68,11 @@ include $(patsubst %, $(src_dir)/%/bmark.mk, $(bmarks)) bmarks_riscv_bin = $(addsuffix .riscv, $(bmarks)) bmarks_riscv_dump = $(addsuffix .riscv.dump, $(bmarks)) -bmarks_riscv_hex = $(addsuffix .riscv.hex, $(bmarks)) bmarks_riscv_out = $(addsuffix .riscv.out, $(bmarks)) bmarks_defs = -DPREALLOCATE=1 -DHOST_DEBUG=0 bmarks_cycles = 80000 -%.hex: % - elf2hex 16 32768 $< > $@ - $(bmarks_riscv_dump): %.riscv.dump: %.riscv $(RISCV_OBJDUMP) $< > $@ @@ -91,7 +87,7 @@ $(bmarks_riscv_out): %.riscv.out: %.riscv $(RISCV_GCC) $(RISCV_GCC_OPTS) $(bmarks_defs) -D__ASSEMBLY__=1 \ -c $(incs) $< -o $@ -riscv: $(bmarks_riscv_dump) $(bmarks_riscv_hex) +riscv: $(bmarks_riscv_dump) run-riscv: $(bmarks_riscv_out) echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \ $(bmarks_riscv_out); echo; diff --git a/benchmarks/common/crt.S b/benchmarks/common/crt.S index 919461b..634b864 100644 --- a/benchmarks/common/crt.S +++ b/benchmarks/common/crt.S @@ -15,15 +15,9 @@ .text .globl _start _start: - j handle_reset + la t0, trap_entry + csrw mtvec, t0 -nmi_vector: - j nmi_vector - -trap_vector: - j trap_entry - -handle_reset: li x1, 0 li x2, 0 li x3, 0 @@ -216,7 +210,7 @@ trap_entry: LREG x31, 31*REGBYTES(sp) addi sp, sp, 272 - eret + mret .section ".tdata.begin" .globl _tdata_begin diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c index 87fd358..4620631 100644 --- a/benchmarks/common/syscalls.c +++ b/benchmarks/common/syscalls.c @@ -406,3 +406,95 @@ int sprintf(char* str, const char* fmt, ...) va_end(ap); return str - str0; } + +void* memcpy(void* dest, const void* src, size_t len) +{ + if ((((uintptr_t)dest | (uintptr_t)src | len) & (sizeof(uintptr_t)-1)) == 0) { + const uintptr_t* s = src; + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = *s++; + } else { + const char* s = src; + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = *s++; + } + return dest; +} + +void* memset(void* dest, int byte, size_t len) +{ + if ((((uintptr_t)dest | len) & (sizeof(uintptr_t)-1)) == 0) { + uintptr_t word = byte & 0xFF; + word |= word << 8; + word |= word << 16; + word |= word << 16 << 16; + + uintptr_t *d = dest; + while (d < (uintptr_t*)(dest + len)) + *d++ = word; + } else { + char *d = dest; + while (d < (char*)(dest + len)) + *d++ = byte; + } + return dest; +} + +size_t strlen(const char *s) +{ + const char *p = s; + while (*p) + p++; + return p - s; +} + +size_t strnlen(const char *s, size_t n) +{ + const char *p = s; + while (n-- && *p) + p++; + return p - s; +} + +int strcmp(const char* s1, const char* s2) +{ + unsigned char c1, c2; + + do { + c1 = *s1++; + c2 = *s2++; + } while (c1 != 0 && c1 == c2); + + return c1 - c2; +} + +char* strcpy(char* dest, const char* src) +{ + char* d = dest; + while ((*d++ = *src++)) + ; + return dest; +} + +long atol(const char* str) +{ + long res = 0; + int sign = 0; + + while (*str == ' ') + str++; + + if (*str == '-' || *str == '+') { + sign = *str == '-'; + str++; + } + + while (*str) { + res *= 10; + res += *str++ - '0'; + } + + return sign ? -res : res; +} diff --git a/benchmarks/common/test.ld b/benchmarks/common/test.ld index 00eb4a2..7ee56b6 100644 --- a/benchmarks/common/test.ld +++ b/benchmarks/common/test.ld @@ -21,7 +21,7 @@ SECTIONS { /* text: test code section */ - . = 0x0; + . = 0x80000000; .text : { crt.o(.text) diff --git a/env b/env -Subproject 0fc840489c21530a8bfdaecac1131fcd20bdaea +Subproject 3d45ca302dbf5ac22cfac8fb025c05c735c35e2 diff --git a/isa/Makefile b/isa/Makefile index 4ff1bd3..636cbbe 100644 --- a/isa/Makefile +++ b/isa/Makefile @@ -31,9 +31,6 @@ vpath %.S $(src_dir) #------------------------------------------------------------ # Build assembly tests -%.hex: % - (elf2hex 16 8192 $< 2> /dev/null || elf2hex 16 16384 $<) > $@ - %.dump: % $(RISCV_OBJDUMP) $< > $@ @@ -49,22 +46,13 @@ $$($(1)_p_tests): $(1)-p-%: $(1)/%.S $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir)/../env/p -I$(src_dir)/macros/scalar -T$(src_dir)/../env/p/link.ld $$< -o $$@ $(1)_tests += $$($(1)_p_tests) -$$($(1)_pt_tests): $(1)-pt-%: $(1)/%.S - $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir)/../env/pt -I$(src_dir)/macros/scalar -T$(src_dir)/../env/pt/link.ld $$< -o $$@ -$(1)_tests += $$($(1)_pt_tests) - -$$($(1)_pm_tests): $(1)-pm-%: $(1)/%.S - $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -I$(src_dir)/../env/pm -I$(src_dir)/macros/scalar -T$(src_dir)/../env/pm/link.ld $$< -o $$@ -$(1)_tests += $$($(1)_pm_tests) - $$($(1)_v_tests): $(1)-v-%: $(1)/%.S $$(RISCV_GCC) $(2) $$(RISCV_GCC_OPTS) -std=gnu99 -O2 -I$(src_dir)/../env/v -I$(src_dir)/macros/scalar -T$(src_dir)/../env/v/link.ld $(src_dir)/../env/v/entry.S $(src_dir)/../env/v/*.c $$< -lc -o $$@ $(1)_tests += $$($(1)_v_tests) $(1)_tests_dump = $$(addsuffix .dump, $$($(1)_tests)) -$(1)_tests_hex = $$(addsuffix .hex, $$($(1)_tests)) -$(1): $$($(1)_tests_dump) $$($(1)_tests_hex) +$(1): $$($(1)_tests_dump) .PHONY: $(1) @@ -96,7 +84,7 @@ junk += $(tests) $(tests_dump) $(tests_hex) $(tests_out) $(tests32_out) #------------------------------------------------------------ # Default -all: $(tests_dump) $(tests_hex) +all: $(tests_dump) #------------------------------------------------------------ # Clean up diff --git a/isa/macros/vector/test_macros.h b/isa/macros/vector/test_macros.h index a97ffe7..7ee9262 100644 --- a/isa/macros/vector/test_macros.h +++ b/isa/macros/vector/test_macros.h @@ -20,8 +20,8 @@ test_ ## testnum: \ vsetcfg nxreg,nfreg; \ li a3,2048; \ vsetvl a3,a3; \ - lui a0,%hi(vtcode ## testnum ); \ - vf %lo(vtcode ## testnum )(a0); \ +1:auipc a0,%pcrel_hi(vtcode ## testnum); \ + vf %pcrel_lo(1b)(a0); \ la a4,dst; \ vsd v ## testreg, a4; \ fence; \ @@ -233,8 +233,8 @@ test_ ## testnum: \ addi a5,a5,4; \ vflstw vf2, a5, x0; \ addi a5,a5,4; \ - lui a0,%hi(vtcode ## testnum ); \ - vf %lo(vtcode ## testnum )(a0); \ +1:auipc a0,%pcrel_hi(vtcode ## testnum); \ + vf %pcrel_lo(1b)(a0); \ la a4,dst; \ vsw vx1, a4; \ fence; \ @@ -273,8 +273,8 @@ test_ ## testnum: \ addi a5,a5,8; \ vflstd vf2, a5, x0; \ addi a5,a5,8; \ - lui a0,%hi(vtcode ## testnum ); \ - vf %lo(vtcode ## testnum )(a0); \ +1:auipc a0,%pcrel_hi(vtcode ## testnum); \ + vf %pcrel_lo(1b)(a0); \ la a4,dst; \ vsd vx1, a4; \ fence; \ @@ -346,8 +346,8 @@ test_ ## testnum: \ vsetcfg 2,1; \ li a3,2048; \ vsetvl a3,a3; \ - lui a0,%hi(vtcode ## testnum ); \ - vf %lo(vtcode ## testnum )(a0); \ +1:auipc a0,%pcrel_hi(vtcode ## testnum); \ + vf %pcrel_lo(1b)(a0); \ la a4,dst; \ vsw vx1, a4; \ fence; \ @@ -379,8 +379,8 @@ test_ ## testnum: \ vsetcfg 2,1; \ li a3,2048; \ vsetvl a3,a3; \ - lui a0,%hi(vtcode ## testnum ); \ - vf %lo(vtcode ## testnum )(a0); \ +1:auipc a0,%pcrel_hi(vtcode ## testnum); \ + vf %pcrel_lo(1b)(a0); \ la a4,dst; \ vsd vx1, a4; \ fence; \ @@ -529,8 +529,8 @@ test_ ## testnum: \ vsetcfg nxreg,nfreg; \ li a3,2048; \ vsetvl a3,a3; \ - lui a0,%hi(vtcode ## testnum ); \ - vf %lo(vtcode ## testnum )(a0); \ +1:auipc a0,%pcrel_hi(vtcode ## testnum); \ + vf %pcrel_lo(1b)(a0); \ la a4,dst; \ fence; \ li a1,correctval; \ diff --git a/isa/rv32mi/Makefrag b/isa/rv32mi/Makefrag index 66a0e39..9aeb12d 100644 --- a/isa/rv32mi/Makefrag +++ b/isa/rv32mi/Makefrag @@ -12,13 +12,11 @@ rv32mi_sc_tests = \ scall \ sbreak \ shamt \ - timer \ wfi \ rv32mi_mc_tests = \ ipi \ rv32mi_p_tests = $(addprefix rv32mi-p-, $(rv32mi_sc_tests)) -rv32mi_pm_tests = $(addprefix rv32mi-pm-, $(rv32mi_mc_tests)) -spike32_tests += $(rv32mi_p_tests) $(rv32mi_pm_tests) +spike32_tests += $(rv32mi_p_tests) diff --git a/isa/rv32mi/timer.S b/isa/rv32mi/timer.S deleted file mode 100644 index 307876c..0000000 --- a/isa/rv32mi/timer.S +++ /dev/null @@ -1,7 +0,0 @@ -# See LICENSE for license details. - -#include "riscv_test.h" -#undef RVTEST_RV64M -#define RVTEST_RV64M RVTEST_RV32M - -#include "../rv64mi/timer.S" diff --git a/isa/rv32ui/Makefrag b/isa/rv32ui/Makefrag index 95943b7..8124c02 100644 --- a/isa/rv32ui/Makefrag +++ b/isa/rv32ui/Makefrag @@ -29,8 +29,6 @@ rv32ui_mc_tests = \ lrsc rv32ui_p_tests = $(addprefix rv32ui-p-, $(rv32ui_sc_tests)) -rv32ui_pt_tests = $(addprefix rv32ui-pt-, $(rv32ui_sc_tests)) -rv32ui_pm_tests = $(addprefix rv32ui-pm-, $(rv32ui_mc_tests)) rv32ui_v_tests = $(addprefix rv32ui-v-, $(rv32ui_sc_tests)) -spike32_tests += $(rv32ui_p_tests) $(rv32ui_pt_tests) $(rv32ui_pm_tests) $(rv32ui_v_tests) +spike32_tests += $(rv32ui_p_tests) $(rv32ui_v_tests) diff --git a/isa/rv64mi/Makefrag b/isa/rv64mi/Makefrag index b8b1da0..ed973db 100644 --- a/isa/rv64mi/Makefrag +++ b/isa/rv64mi/Makefrag @@ -12,12 +12,10 @@ rv64mi_sc_tests = \ scall \ wfi \ sbreak \ - timer \ rv64mi_mc_tests = \ ipi \ rv64mi_p_tests = $(addprefix rv64mi-p-, $(rv64mi_sc_tests)) -rv64mi_pm_tests = $(addprefix rv64mi-pm-, $(rv64mi_mc_tests)) -spike_tests += $(rv64mi_p_tests) $(rv64mi_pm_tests) +spike_tests += $(rv64mi_p_tests) diff --git a/isa/rv64mi/dirty.S b/isa/rv64mi/dirty.S index 73d6c6c..5228129 100644 --- a/isa/rv64mi/dirty.S +++ b/isa/rv64mi/dirty.S @@ -16,13 +16,17 @@ RVTEST_CODE_BEGIN # Turn on VM with superpage identity mapping la a1, page_table_1 srl a1, a1, RISCV_PGSHIFT + la a2, page_table_2 + srl a2, a2, RISCV_PGSHIFT csrw sptbr, a1 sfence.vm li a1, ((MSTATUS_VM & ~(MSTATUS_VM<<1)) * VM_SV39) | ((MSTATUS_MPP & ~(MSTATUS_MPP<<1)) * PRV_S) csrs mstatus, a1 - la a1, 1f + la a1, 1f - DRAM_BASE csrw mepc, a1 - eret + la a1, stvec_handler - DRAM_BASE + csrw stvec, a1 + mret 1: # Try a faulting store to make sure dirty bit is not set @@ -32,9 +36,7 @@ RVTEST_CODE_BEGIN # Load new page table li TESTNUM, 3 - la t0, page_table_2 - srl t0, t0, RISCV_PGSHIFT - csrw sptbr, t0 + csrw sptbr, a2 sfence.vm # Try a non-faulting store to make sure dirty bit is set @@ -76,9 +78,9 @@ die: .data .align 12 -page_table_1: .dword PTE_V | PTE_TYPE_URX_SRX +page_table_1: .dword (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_TYPE_URX_SRX dummy: .dword 0 .align 12 -page_table_2: .dword PTE_V | PTE_TYPE_URWX_SRWX +page_table_2: .dword (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_TYPE_URWX_SRWX RVTEST_CODE_END diff --git a/isa/rv64mi/illegal.S b/isa/rv64mi/illegal.S index ecb3088..30c22b2 100644 --- a/isa/rv64mi/illegal.S +++ b/isa/rv64mi/illegal.S @@ -28,7 +28,7 @@ mtvec_handler: csrr t0, mepc addi t0, t0, 8 csrw mepc, t0 - sret + mret RVTEST_CODE_END diff --git a/isa/rv64mi/ma_addr.S b/isa/rv64mi/ma_addr.S index aa5dd85..ed177f5 100644 --- a/isa/rv64mi/ma_addr.S +++ b/isa/rv64mi/ma_addr.S @@ -72,7 +72,7 @@ mtvec_handler: csrr t0, mepc addi t0, t0, 8 csrw mepc, t0 - sret + mret RVTEST_CODE_END diff --git a/isa/rv64mi/mcsr.S b/isa/rv64mi/mcsr.S index 4bb0445..f704827 100644 --- a/isa/rv64mi/mcsr.S +++ b/isa/rv64mi/mcsr.S @@ -23,13 +23,15 @@ RVTEST_CODE_BEGIN # Check that mhartid reports 0 TEST_CASE(3, a0, 0x0, csrr a0, mhartid) - # Check that reading mimpid, marchid, and mvendorid doesn't cause exceptions + # Check that reading the following CSRs doesn't cause an exception csrr a0, mimpid csrr a0, marchid csrr a0, mvendorid - # Check that mtvec reports DEFAULT_MTVEC - TEST_CASE(5, a0, DEFAULT_MTVEC, csrr a0, mtvec) + # Check that writing hte following CSRs doesn't cause an exception + li t0, 0 + csrs mtvec, t0 + csrs mepc, t0 TEST_PASSFAIL diff --git a/isa/rv64mi/timer.S b/isa/rv64mi/timer.S deleted file mode 100644 index 4697793..0000000 --- a/isa/rv64mi/timer.S +++ /dev/null @@ -1,1103 +0,0 @@ -# See LICENSE for license details. - -#***************************************************************************** -# timer.S -#----------------------------------------------------------------------------- -# -# Test timer interrupts. -# - -#include "riscv_test.h" -#include "test_macros.h" - -RVTEST_RV64M -RVTEST_CODE_BEGIN - -#define DELTA_T 5 - - li s8, 0 # number of taken timer interrupts - li s9, 10 # how many interrupts to run for - - .align 4 - csrr a0, mtime - add a0, a0, DELTA_T - csrw mtimecmp, a0 - li a0, MIP_MTIP - csrs mie, a0 - csrs mstatus, MSTATUS_MIE - - # advance an LFSR until the timer has fired enough times - li s0, 1023 - li s4, 0 -1:srl s2,s0,3 - xor s2,s2,s0 - and s2,s2,1 - srl s0,s0,1 - sll s2,s2,9 - or s0,s2,s0 - and s0, s0, 0x3FF - add s4, s4, 1 - bltu s8, s9, 1b - - # compute iteration count % 1023 without using REMU - li s1, 1023 - bltu s4, s1, 2f -1:sub s4, s4, s1 - bgeu s4, s1, 1b -2: - - # make sure the LFSR was computed correctly - la s1, lfsr - sll s4, s4, 2 - add s1, s1, s4 - lw s1, (s1) - li TESTNUM, 2 - bne s0, s1, fail - - RVTEST_PASS - - TEST_PASSFAIL - -mtvec_handler: - li TESTNUM, 3 - csrr t0, mcause - bgez t0, fail - - sll t0, t0, 1 - addi t0, t0, -2*IRQ_M_TIMER - bnez t0, fail - - csrr t0, mtime - addi t0, t0, DELTA_T - csrw mtimecmp, t0 - - add s8, s8, 1 - eret - -.data -lfsr: -.word 1023 -.word 511 -.word 255 -.word 127 -.word 63 -.word 31 -.word 15 -.word 7 -.word 515 -.word 769 -.word 896 -.word 448 -.word 224 -.word 112 -.word 56 -.word 540 -.word 782 -.word 903 -.word 963 -.word 993 -.word 1008 -.word 504 -.word 764 -.word 894 -.word 959 -.word 479 -.word 239 -.word 119 -.word 571 -.word 285 -.word 142 -.word 583 -.word 803 -.word 913 -.word 968 -.word 996 -.word 498 -.word 249 -.word 124 -.word 574 -.word 799 -.word 399 -.word 199 -.word 611 -.word 817 -.word 920 -.word 972 -.word 998 -.word 499 -.word 761 -.word 380 -.word 702 -.word 863 -.word 431 -.word 215 -.word 619 -.word 309 -.word 666 -.word 845 -.word 422 -.word 211 -.word 617 -.word 308 -.word 154 -.word 589 -.word 294 -.word 147 -.word 585 -.word 292 -.word 146 -.word 73 -.word 36 -.word 18 -.word 9 -.word 4 -.word 2 -.word 1 -.word 512 -.word 256 -.word 128 -.word 64 -.word 32 -.word 16 -.word 8 -.word 516 -.word 258 -.word 129 -.word 576 -.word 288 -.word 144 -.word 72 -.word 548 -.word 274 -.word 137 -.word 68 -.word 34 -.word 17 -.word 520 -.word 772 -.word 386 -.word 193 -.word 608 -.word 304 -.word 152 -.word 588 -.word 806 -.word 403 -.word 713 -.word 356 -.word 178 -.word 89 -.word 44 -.word 534 -.word 267 -.word 133 -.word 578 -.word 289 -.word 656 -.word 328 -.word 676 -.word 338 -.word 169 -.word 84 -.word 42 -.word 533 -.word 778 -.word 901 -.word 962 -.word 481 -.word 752 -.word 376 -.word 700 -.word 862 -.word 943 -.word 471 -.word 747 -.word 373 -.word 698 -.word 861 -.word 430 -.word 727 -.word 875 -.word 437 -.word 730 -.word 877 -.word 438 -.word 219 -.word 109 -.word 54 -.word 27 -.word 13 -.word 6 -.word 3 -.word 513 -.word 768 -.word 384 -.word 192 -.word 96 -.word 48 -.word 24 -.word 524 -.word 774 -.word 387 -.word 705 -.word 864 -.word 432 -.word 216 -.word 620 -.word 822 -.word 411 -.word 205 -.word 102 -.word 51 -.word 537 -.word 268 -.word 646 -.word 323 -.word 673 -.word 848 -.word 424 -.word 724 -.word 362 -.word 693 -.word 858 -.word 941 -.word 470 -.word 235 -.word 117 -.word 570 -.word 797 -.word 398 -.word 711 -.word 867 -.word 945 -.word 984 -.word 1004 -.word 1014 -.word 507 -.word 253 -.word 126 -.word 575 -.word 287 -.word 143 -.word 71 -.word 547 -.word 785 -.word 904 -.word 964 -.word 482 -.word 241 -.word 632 -.word 828 -.word 926 -.word 975 -.word 487 -.word 755 -.word 889 -.word 444 -.word 734 -.word 879 -.word 439 -.word 731 -.word 365 -.word 182 -.word 91 -.word 45 -.word 22 -.word 11 -.word 5 -.word 514 -.word 257 -.word 640 -.word 320 -.word 160 -.word 80 -.word 40 -.word 532 -.word 266 -.word 645 -.word 834 -.word 417 -.word 720 -.word 360 -.word 692 -.word 346 -.word 685 -.word 342 -.word 171 -.word 85 -.word 554 -.word 789 -.word 906 -.word 965 -.word 994 -.word 497 -.word 760 -.word 892 -.word 958 -.word 991 -.word 495 -.word 247 -.word 635 -.word 317 -.word 158 -.word 591 -.word 295 -.word 659 -.word 841 -.word 420 -.word 210 -.word 105 -.word 52 -.word 26 -.word 525 -.word 262 -.word 131 -.word 577 -.word 800 -.word 400 -.word 200 -.word 612 -.word 306 -.word 153 -.word 76 -.word 550 -.word 275 -.word 649 -.word 324 -.word 162 -.word 81 -.word 552 -.word 788 -.word 394 -.word 709 -.word 866 -.word 433 -.word 728 -.word 876 -.word 950 -.word 475 -.word 237 -.word 118 -.word 59 -.word 29 -.word 14 -.word 519 -.word 771 -.word 897 -.word 960 -.word 480 -.word 240 -.word 120 -.word 572 -.word 798 -.word 911 -.word 455 -.word 739 -.word 881 -.word 952 -.word 988 -.word 1006 -.word 1015 -.word 1019 -.word 509 -.word 254 -.word 639 -.word 319 -.word 159 -.word 79 -.word 39 -.word 531 -.word 777 -.word 388 -.word 194 -.word 97 -.word 560 -.word 280 -.word 652 -.word 838 -.word 419 -.word 721 -.word 872 -.word 948 -.word 474 -.word 749 -.word 374 -.word 187 -.word 93 -.word 46 -.word 535 -.word 779 -.word 389 -.word 706 -.word 353 -.word 688 -.word 344 -.word 684 -.word 854 -.word 427 -.word 213 -.word 618 -.word 821 -.word 922 -.word 973 -.word 486 -.word 243 -.word 633 -.word 316 -.word 670 -.word 847 -.word 423 -.word 723 -.word 873 -.word 436 -.word 218 -.word 621 -.word 310 -.word 155 -.word 77 -.word 38 -.word 19 -.word 521 -.word 260 -.word 130 -.word 65 -.word 544 -.word 272 -.word 136 -.word 580 -.word 290 -.word 145 -.word 584 -.word 804 -.word 402 -.word 201 -.word 100 -.word 50 -.word 25 -.word 12 -.word 518 -.word 259 -.word 641 -.word 832 -.word 416 -.word 208 -.word 104 -.word 564 -.word 282 -.word 653 -.word 326 -.word 163 -.word 593 -.word 808 -.word 916 -.word 458 -.word 741 -.word 882 -.word 441 -.word 220 -.word 622 -.word 823 -.word 923 -.word 461 -.word 230 -.word 115 -.word 569 -.word 284 -.word 654 -.word 839 -.word 931 -.word 977 -.word 1000 -.word 1012 -.word 506 -.word 765 -.word 382 -.word 703 -.word 351 -.word 175 -.word 87 -.word 555 -.word 277 -.word 650 -.word 837 -.word 930 -.word 465 -.word 744 -.word 884 -.word 442 -.word 733 -.word 366 -.word 695 -.word 859 -.word 429 -.word 214 -.word 107 -.word 53 -.word 538 -.word 781 -.word 390 -.word 195 -.word 609 -.word 816 -.word 408 -.word 716 -.word 870 -.word 435 -.word 729 -.word 364 -.word 694 -.word 347 -.word 173 -.word 86 -.word 43 -.word 21 -.word 522 -.word 773 -.word 898 -.word 449 -.word 736 -.word 368 -.word 184 -.word 604 -.word 814 -.word 919 -.word 971 -.word 485 -.word 754 -.word 377 -.word 188 -.word 606 -.word 815 -.word 407 -.word 715 -.word 357 -.word 690 -.word 345 -.word 172 -.word 598 -.word 299 -.word 149 -.word 586 -.word 805 -.word 914 -.word 457 -.word 228 -.word 114 -.word 57 -.word 28 -.word 526 -.word 775 -.word 899 -.word 961 -.word 992 -.word 496 -.word 248 -.word 636 -.word 830 -.word 927 -.word 463 -.word 231 -.word 627 -.word 825 -.word 412 -.word 718 -.word 871 -.word 947 -.word 985 -.word 492 -.word 758 -.word 379 -.word 189 -.word 94 -.word 559 -.word 279 -.word 651 -.word 325 -.word 674 -.word 337 -.word 680 -.word 852 -.word 426 -.word 725 -.word 874 -.word 949 -.word 986 -.word 1005 -.word 502 -.word 251 -.word 125 -.word 62 -.word 543 -.word 271 -.word 135 -.word 579 -.word 801 -.word 912 -.word 456 -.word 740 -.word 370 -.word 185 -.word 92 -.word 558 -.word 791 -.word 907 -.word 453 -.word 738 -.word 369 -.word 696 -.word 860 -.word 942 -.word 983 -.word 1003 -.word 501 -.word 762 -.word 893 -.word 446 -.word 735 -.word 367 -.word 183 -.word 603 -.word 301 -.word 150 -.word 75 -.word 37 -.word 530 -.word 265 -.word 132 -.word 66 -.word 33 -.word 528 -.word 264 -.word 644 -.word 322 -.word 161 -.word 592 -.word 296 -.word 660 -.word 330 -.word 677 -.word 850 -.word 425 -.word 212 -.word 106 -.word 565 -.word 794 -.word 909 -.word 454 -.word 227 -.word 625 -.word 824 -.word 924 -.word 974 -.word 999 -.word 1011 -.word 1017 -.word 508 -.word 766 -.word 895 -.word 447 -.word 223 -.word 111 -.word 55 -.word 539 -.word 269 -.word 134 -.word 67 -.word 545 -.word 784 -.word 392 -.word 708 -.word 354 -.word 177 -.word 600 -.word 812 -.word 918 -.word 459 -.word 229 -.word 626 -.word 313 -.word 156 -.word 590 -.word 807 -.word 915 -.word 969 -.word 484 -.word 242 -.word 121 -.word 60 -.word 542 -.word 783 -.word 391 -.word 707 -.word 865 -.word 944 -.word 472 -.word 748 -.word 886 -.word 443 -.word 221 -.word 110 -.word 567 -.word 795 -.word 397 -.word 198 -.word 99 -.word 561 -.word 792 -.word 908 -.word 966 -.word 483 -.word 753 -.word 888 -.word 956 -.word 990 -.word 1007 -.word 503 -.word 763 -.word 381 -.word 190 -.word 607 -.word 303 -.word 151 -.word 587 -.word 293 -.word 658 -.word 329 -.word 164 -.word 82 -.word 41 -.word 20 -.word 10 -.word 517 -.word 770 -.word 385 -.word 704 -.word 352 -.word 176 -.word 88 -.word 556 -.word 790 -.word 395 -.word 197 -.word 610 -.word 305 -.word 664 -.word 844 -.word 934 -.word 467 -.word 745 -.word 372 -.word 186 -.word 605 -.word 302 -.word 663 -.word 843 -.word 421 -.word 722 -.word 361 -.word 180 -.word 90 -.word 557 -.word 278 -.word 139 -.word 69 -.word 546 -.word 273 -.word 648 -.word 836 -.word 418 -.word 209 -.word 616 -.word 820 -.word 410 -.word 717 -.word 358 -.word 179 -.word 601 -.word 300 -.word 662 -.word 331 -.word 165 -.word 594 -.word 297 -.word 148 -.word 74 -.word 549 -.word 786 -.word 393 -.word 196 -.word 98 -.word 49 -.word 536 -.word 780 -.word 902 -.word 451 -.word 737 -.word 880 -.word 440 -.word 732 -.word 878 -.word 951 -.word 987 -.word 493 -.word 246 -.word 123 -.word 61 -.word 30 -.word 527 -.word 263 -.word 643 -.word 833 -.word 928 -.word 464 -.word 232 -.word 628 -.word 314 -.word 669 -.word 334 -.word 679 -.word 851 -.word 937 -.word 468 -.word 234 -.word 629 -.word 826 -.word 925 -.word 462 -.word 743 -.word 883 -.word 953 -.word 476 -.word 750 -.word 887 -.word 955 -.word 477 -.word 238 -.word 631 -.word 827 -.word 413 -.word 206 -.word 615 -.word 819 -.word 921 -.word 460 -.word 742 -.word 371 -.word 697 -.word 348 -.word 686 -.word 855 -.word 939 -.word 469 -.word 746 -.word 885 -.word 954 -.word 989 -.word 494 -.word 759 -.word 891 -.word 445 -.word 222 -.word 623 -.word 311 -.word 667 -.word 333 -.word 166 -.word 83 -.word 553 -.word 276 -.word 138 -.word 581 -.word 802 -.word 401 -.word 712 -.word 868 -.word 434 -.word 217 -.word 108 -.word 566 -.word 283 -.word 141 -.word 70 -.word 35 -.word 529 -.word 776 -.word 900 -.word 450 -.word 225 -.word 624 -.word 312 -.word 668 -.word 846 -.word 935 -.word 979 -.word 1001 -.word 500 -.word 250 -.word 637 -.word 318 -.word 671 -.word 335 -.word 167 -.word 595 -.word 809 -.word 404 -.word 202 -.word 613 -.word 818 -.word 409 -.word 204 -.word 614 -.word 307 -.word 665 -.word 332 -.word 678 -.word 339 -.word 681 -.word 340 -.word 170 -.word 597 -.word 810 -.word 917 -.word 970 -.word 997 -.word 1010 -.word 505 -.word 252 -.word 638 -.word 831 -.word 415 -.word 207 -.word 103 -.word 563 -.word 793 -.word 396 -.word 710 -.word 355 -.word 689 -.word 856 -.word 940 -.word 982 -.word 491 -.word 245 -.word 634 -.word 829 -.word 414 -.word 719 -.word 359 -.word 691 -.word 857 -.word 428 -.word 726 -.word 363 -.word 181 -.word 602 -.word 813 -.word 406 -.word 203 -.word 101 -.word 562 -.word 281 -.word 140 -.word 582 -.word 291 -.word 657 -.word 840 -.word 932 -.word 466 -.word 233 -.word 116 -.word 58 -.word 541 -.word 270 -.word 647 -.word 835 -.word 929 -.word 976 -.word 488 -.word 756 -.word 378 -.word 701 -.word 350 -.word 687 -.word 343 -.word 683 -.word 341 -.word 682 -.word 853 -.word 938 -.word 981 -.word 1002 -.word 1013 -.word 1018 -.word 1021 -.word 510 -.word 767 -.word 383 -.word 191 -.word 95 -.word 47 -.word 23 -.word 523 -.word 261 -.word 642 -.word 321 -.word 672 -.word 336 -.word 168 -.word 596 -.word 298 -.word 661 -.word 842 -.word 933 -.word 978 -.word 489 -.word 244 -.word 122 -.word 573 -.word 286 -.word 655 -.word 327 -.word 675 -.word 849 -.word 936 -.word 980 -.word 490 -.word 757 -.word 890 -.word 957 -.word 478 -.word 751 -.word 375 -.word 699 -.word 349 -.word 174 -.word 599 -.word 811 -.word 405 -.word 714 -.word 869 -.word 946 -.word 473 -.word 236 -.word 630 -.word 315 -.word 157 -.word 78 -.word 551 -.word 787 -.word 905 -.word 452 -.word 226 -.word 113 -.word 568 -.word 796 -.word 910 -.word 967 -.word 995 -.word 1009 -.word 1016 -.word 1020 -.word 1022 - -RVTEST_CODE_END diff --git a/isa/rv64si/csr.S b/isa/rv64si/csr.S index d0c6724..35fc99a 100644 --- a/isa/rv64si/csr.S +++ b/isa/rv64si/csr.S @@ -18,6 +18,7 @@ RVTEST_CODE_BEGIN #define sstatus mstatus #define scause mcause #define sepc mepc + #define sret mret #define stvec_handler mtvec_handler #undef SSTATUS_SPP #define SSTATUS_SPP MSTATUS_MPP @@ -55,24 +56,24 @@ RVTEST_CODE_BEGIN TEST_CASE(11, x0, 0, nop) #endif - # Exit by doing a syscall. - TEST_CASE(12, x0, 1, scall) + RVTEST_PASS # We should only fall through to this if scall failed. TEST_PASSFAIL stvec_handler: - # Trapping on tests 11 and 12 is usually good news. + # Trapping on tests 10 and 11 is good news. # Note that since the test didn't complete, TESTNUM is smaller by 1. li t0, 9 beq TESTNUM, t0, privileged li t0, 10 beq TESTNUM, t0, privileged - li t0, 11 - beq TESTNUM, t0, syscall - # Trapping on other tests is bad news. - j fail + # catch RVTEST_PASS and kick it up to M-mode + csrr t0, scause + li t1, CAUSE_USER_ECALL + bne t0, t1, fail + RVTEST_PASS privileged: # Make sure scause indicates a lack of privilege. @@ -85,15 +86,6 @@ privileged: csrw sepc, t0 sret -syscall: - # Make sure scause indicates a syscall. - csrr t0, scause - li t1, CAUSE_USER_ECALL - bne t0, t1, fail - - # We're done. - j pass - RVTEST_CODE_END .data diff --git a/isa/rv64si/ma_fetch.S b/isa/rv64si/ma_fetch.S index db702d9..a97eecb 100644 --- a/isa/rv64si/ma_fetch.S +++ b/isa/rv64si/ma_fetch.S @@ -18,6 +18,7 @@ RVTEST_CODE_BEGIN #define sstatus mstatus #define scause mcause #define sepc mepc + #define sret mret #define stvec_handler mtvec_handler #endif diff --git a/isa/rv64si/sbreak.S b/isa/rv64si/sbreak.S index bf38434..99240be 100644 --- a/isa/rv64si/sbreak.S +++ b/isa/rv64si/sbreak.S @@ -18,6 +18,7 @@ RVTEST_CODE_BEGIN #define sstatus mstatus #define scause mcause #define sepc mepc + #define sret mret #define stvec_handler mtvec_handler #endif diff --git a/isa/rv64si/scall.S b/isa/rv64si/scall.S index 703de0b..f4752d1 100644 --- a/isa/rv64si/scall.S +++ b/isa/rv64si/scall.S @@ -18,6 +18,7 @@ RVTEST_CODE_BEGIN #define sstatus mstatus #define scause mcause #define sepc mepc + #define sret mret #define stvec_handler mtvec_handler #undef SSTATUS_SPP #define SSTATUS_SPP MSTATUS_MPP @@ -29,9 +30,10 @@ RVTEST_CODE_BEGIN csrc sstatus, t0 la t0, 1f csrw sepc, t0 - eret + sret 1: + li TESTNUM, 1 scall j fail diff --git a/isa/rv64uf/Makefrag b/isa/rv64uf/Makefrag index c42b5f7..978084a 100644 --- a/isa/rv64uf/Makefrag +++ b/isa/rv64uf/Makefrag @@ -7,7 +7,6 @@ rv64uf_sc_tests = \ ldst move structural recoding \ rv64uf_p_tests = $(addprefix rv64uf-p-, $(rv64uf_sc_tests)) -rv64uf_pt_tests = $(addprefix rv64uf-pt-, $(rv64uf_sc_tests)) rv64uf_v_tests = $(addprefix rv64uf-v-, $(rv64uf_sc_tests)) -spike_tests += $(rv64uf_p_tests) $(rv64uf_pt_tests) $(rv64uf_v_tests) +spike_tests += $(rv64uf_p_tests) $(rv64uf_v_tests) diff --git a/isa/rv64ui/Makefrag b/isa/rv64ui/Makefrag index d8d21af..e839118 100644 --- a/isa/rv64ui/Makefrag +++ b/isa/rv64ui/Makefrag @@ -30,8 +30,6 @@ rv64ui_mc_tests = \ lrsc rv64ui_p_tests = $(addprefix rv64ui-p-, $(rv64ui_sc_tests)) -rv64ui_pt_tests = $(addprefix rv64ui-pt-, $(rv64ui_sc_tests)) -rv64ui_pm_tests = $(addprefix rv64ui-pm-, $(rv64ui_mc_tests)) rv64ui_v_tests = $(addprefix rv64ui-v-, $(rv64ui_sc_tests)) -spike_tests += $(rv64ui_p_tests) $(rv64ui_pm_tests) $(rv64ui_pt_tests) $(rv64ui_v_tests) +spike_tests += $(rv64ui_p_tests) $(rv64ui_v_tests) |