diff --git a/site-setup.csh b/site-setup.csh index 867485a8d..63f1260be 100644 --- a/site-setup.csh +++ b/site-setup.csh @@ -49,7 +49,7 @@ setenv SPIKE_PATH $RISCV/bin # Change this for your path to riscv-isa-s setenv IDV $RISCV/ImperasDV-OpenHW if ($?IDV) then # echo "Imperas exists" - setenv IMPERAS_HOME $IDV/Imperas + setenv IMPERAS_HOME $IDV setenv IMPERAS_PERSONALITY CPUMAN_DV_ASYNC setenv ROOTDIR ~/ source ${IMPERAS_HOME}/bin/setup.sh diff --git a/site-setup.sh b/site-setup.sh index 8c03a2a36..34fe1eb42 100755 --- a/site-setup.sh +++ b/site-setup.sh @@ -66,7 +66,7 @@ export SPIKE_PATH=$RISCV/bin # Copy this as it is export IDV=$RISCV/ImperasDV-OpenHW if [ -e "$IDV" ]; then # echo "Imperas exists" - export IMPERAS_HOME=$IDV/Imperas + export IMPERAS_HOME=$IDV export IMPERAS_PERSONALITY=CPUMAN_DV_ASYNC export ROOTDIR=~/ source "${IMPERAS_HOME}"/bin/setup.sh diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-TEST-LIB-32.h b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-TEST-LIB-32.h index 654c13568..f34ca6363 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-TEST-LIB-32.h +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-TEST-LIB-32.h @@ -133,8 +133,8 @@ cause_m_time_interrupt: add t3, t2, t3 // add desired offset to the current time bgtu t3, t2, nowrap_m // check new time exceeds current time (no wraparound) addi t6, t6, 1 // if wrap, increment most significant word - sw t6,4(t4) // store into most significant word of MTIMECMP nowrap_m: + sw t6,4(t4) // store into most significant word of MTIMECMP sw t3, 0(t4) // store into least significant word of MTIMECMP time_loop_m: addi a3, a3, -1 diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-wfi-01.S b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-wfi-01.S index 61d73a4f7..65f564a1e 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-wfi-01.S +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv32i_m/privilege/src/WALLY-wfi-01.S @@ -36,20 +36,20 @@ WRITE_READ_CSR mie, 0xFFF // Enable interrupts from all sources // Code copied from test library to cause m time interrupt, with time loop replaced with wfi. -/* Note: the following line might cause problems in the future. If more than 0x50 cycles are needed before the wfi +/* Note: the following line might cause problems in the future. If more than 0x100 cycles are needed before the wfi instruction begins, then the program might fall into a loop and run forever*/ -li x28, 0x50 // Desired offset from the present time -mv a3, x28 // copy value in to know to stop waiting for interrupt after this many cycles -la x29, 0x02004000 // MTIMECMP register in CLINT -la x30, 0x0200BFF8 // MTIME register in CLINT -lw x7, 0(x30) // low word of MTIME -lw x31, 4(x30) // high word of MTIME -add x28, x7, x28 // add desired offset to the current time -bgtu x28, x7, nowrap // check new time exceeds current time (no wraparound) -addi x31, x31, 1 // if wrap, increment most significant word -sw x31,4(x29) // store into most significant word of MTIMECMP + li x28, 0x100 // Desired offset from the present time + mv a3, x28 // copy value in to know to stop waiting for interrupt after this many cycles + la x29, 0x02004000 // MTIMECMP register in CLINT + la x30, 0x0200BFF8 // MTIME register in CLINT + lw x7, 0(x30) // low word of MTIME + lw x31, 4(x30) // high word of MTIME + add x28, x7, x28 // add desired offset to the current time + bgtu x28, x7, nowrap // check new time exceeds current time (no wraparound) + addi x31, x31, 1 // if wrap, increment most significant word nowrap: + sw x31,4(x29) // store into most significant word of MTIMECMP sw x28, 0(x29) // store into least significant word of MTIMECMP auipc ra, 0x0 diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-TEST-LIB-64.h b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-TEST-LIB-64.h index d939c130e..5f6d14ecd 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-TEST-LIB-64.h +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-TEST-LIB-64.h @@ -136,8 +136,8 @@ cause_m_time_interrupt: add t3, t2, t3 // add desired offset to the current time bgtu t3, t2, nowrap_m // check new time exceeds current time (no wraparound) addi t6, t6, 1 // if wrap, increment most significant word - sw t6,4(t4) // store into most significant word of MTIMECMP nowrap_m: + sw t6,4(t4) // store into most significant word of MTIMECMP sw t3, 0(t4) // store into least significant word of MTIMECMP time_loop_m: addi a3, a3, -1 diff --git a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-wfi-01.S b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-wfi-01.S index 6430f2078..3611f99ef 100644 --- a/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-wfi-01.S +++ b/tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/privilege/src/WALLY-wfi-01.S @@ -35,30 +35,24 @@ WRITE_READ_CSR mie, 0xFFF // Enable interrupts from all sources // Code copied from test library to cause m time interrupt, with time loop replaced with wfi. -li x28, 0x60 // Desired offset from the present time -mv a3, x28 // copy value in to know to stop waiting for interrupt after this many cycles -la x29, 0x02004000 // MTIMECMP register in CLINT -la x30, 0x0200BFF8 // MTIME register in CLINT -lw x7, 0(x30) // low word of MTIME -lw x31, 4(x30) // high word of MTIME -add x28, x7, x28 // add desired offset to the current time -bgtu x28, x7, nowrap // check new time exceeds current time (no wraparound) -addi x31, x31, 1 // if wrap, increment most significant word -sw x31,4(x29) // store into most significant word of MTIMECMP + li x28, 0x60 // Desired offset from the present time + mv a3, x28 // copy value in to know to stop waiting for interrupt after this many cycles + la x29, 0x02004000 // MTIMECMP register in CLINT + la x30, 0x0200BFF8 // MTIME register in CLINT + ld x7, 0(x30) // read MTIME + add x28, x7, x28 // add offset + sw x28, 0(x29) // MTIMECMP = MTIME + offset -nowrap: - sw x28, 0(x29) // store into least significant word of MTIMECMP + auipc ra, 0x0 + addi ra, ra, 0xC // load address after wfi into ra so we return to the right place after handling the time interrupt -auipc ra, 0x0 -addi ra, ra, 0xC // load address after wfi into ra so we return to the right place after handling the time interrupt + wfi // test wfi until trap goes off -wfi // test wfi until trap goes off - -li x28, 0x600d111 // magic number "good 111" to write to output after interrupt goes off. -// this tests whether wfi is a nop or not since we should get the output for the interrupt before this one -sd x28, 0(x6) -addi x6, x6, 8 -addi x16, x16, 8 + li x28, 0x600d111 // magic number "good 111" to write to output after interrupt goes off. + // this tests whether wfi is a nop or not since we should get the output for the interrupt before this one + sd x28, 0(x6) + addi x6, x6, 8 + addi x16, x16, 8 END_TESTS