OpenCores
URL https://opencores.org/ocsvn/potato/potato/trunk

Subversion Repositories potato

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /potato/branches
    from Rev 50 to Rev 51
    Reverse comparison

Rev 50 → Rev 51

/new-privileged-isa/tests/timer.S
0,0 → 1,56
# The Potato Processor - A simple RISC-V based processor for FPGAs
# (c) Kristian Klomsten Skordal 2014 - 2015 <kristian.skordal@wafflemail.net>
# Report bugs and issues on <http://opencores.org/project,potato,bugtracker>
 
# Simplified timer interrupt test.
 
#include "riscv_test.h"
#include "test_macros.h"
 
#define TIMER_DELTA_T 10
#define MIE_STIE MIP_STIP
 
RVTEST_RV32M
RVTEST_CODE_BEGIN
 
li s8, 0 # Number of timer interrupts taken
li s9, 10 # Number of timer interrupts to wait for
 
# Set the time of the next timer interrupt:
csrr a0, mtime
addi a0, a0, TIMER_DELTA_T
csrw mtimecmp, a0
 
# Enable the timer interrupt:
li a0, (1 << 7)
csrs mie, a0
csrs mstatus, MSTATUS_IE
 
wait_for_count:
# TODO: wfi not yet supported
j wait_for_count
 
mtvec_handler:
li t0, (1 << 31) + 1 # Interrupt bit set + timer interrupt exception code
 
csrr t1, mcause
bne t0, t1, fail # Fail if not timer interrupt
addi s8, s8, 1
beq s8, s9, pass # Pass the test if the correct number of interrupts have been taken
 
# Reset the timer:
csrr a0, mtime
addi a0, a0, TIMER_DELTA_T
csrw mtimecmp, a0
 
eret
 
TEST_PASSFAIL
RVTEST_CODE_END
 
.data
RVTEST_DATA_BEGIN
TEST_DATA
RVTEST_DATA_END
 
/new-privileged-isa/riscv-tests/scall.S
0,0 → 1,49
# See LICENSE for license details.
 
#*****************************************************************************
# scall.S
#-----------------------------------------------------------------------------
#
# Test syscall trap.
#
 
#include "riscv_test.h"
#include "test_macros.h"
 
RVTEST_RV32M
RVTEST_CODE_BEGIN
 
#define sscratch mscratch
#define sstatus mstatus
#define scause mcause
#define sepc mepc
#define stvec_handler mtvec_handler
 
#undef CAUSE_SUPERVISOR_ECALL
#define CAUSE_SUPERVISOR_ECALL CAUSE_MACHINE_ECALL
 
li TESTNUM, 2
scall
j fail
 
j pass
 
TEST_PASSFAIL
 
stvec_handler:
li t1, CAUSE_SUPERVISOR_ECALL
csrr t0, scause
bne t0, t1, fail
csrr t0, sepc
addi t0, t0, 8
csrw sepc, t0
sret
 
RVTEST_CODE_END
 
.data
RVTEST_DATA_BEGIN
 
TEST_DATA
 
RVTEST_DATA_END
/new-privileged-isa/riscv-tests/sbreak.S
0,0 → 1,46
# See LICENSE for license details.
 
#*****************************************************************************
# scall.S
#-----------------------------------------------------------------------------
#
# Test syscall trap.
#
 
#include "riscv_test.h"
#include "test_macros.h"
 
RVTEST_RV32M
RVTEST_CODE_BEGIN
 
#define sscratch mscratch
#define sstatus mstatus
#define scause mcause
#define sepc mepc
#define stvec_handler mtvec_handler
 
li TESTNUM, 2
sbreak
j fail
 
j pass
 
TEST_PASSFAIL
 
stvec_handler:
li t1, CAUSE_BREAKPOINT
csrr t0, scause
bne t0, t1, fail
csrr t0, sepc
addi t0, t0, 8
csrw sepc, t0
sret
 
RVTEST_CODE_END
 
.data
RVTEST_DATA_BEGIN
 
TEST_DATA
 
RVTEST_DATA_END
/new-privileged-isa/Makefile
39,7 → 39,6
# ISA tests to use from the riscv-tests repository:
RISCV_TESTS += \
simple \
ma_addr \
add \
addi \
and \
75,10 → 74,14
lbu \
lh \
lhu \
lw
lw \
ma_addr \
sbreak \
scall
 
# Local tests to run:
LOCAL_TESTS ?= \
timer \
sw-jal
 
all: potato.prj run-tests

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.