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

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/or1ksim/testsuite/test-code-or1k/inst-set-test
    from Rev 118 to Rev 121
    Reverse comparison

Rev 118 → Rev 121

/Makefile.in
59,8 → 59,9
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = is-add-test$(EXEEXT) is-div-test$(EXEEXT) \
is-find-test$(EXEEXT) is-lws-test$(EXEEXT) \
is-mac-test$(EXEEXT) is-mul-test$(EXEEXT) $(am__EXEEXT_1)
is-find-test$(EXEEXT) is-jump-test$(EXEEXT) \
is-lws-test$(EXEEXT) is-mac-test$(EXEEXT) is-mul-test$(EXEEXT) \
$(am__EXEEXT_1)
subdir = inst-set-test
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
103,6 → 104,12
is_find_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(is_find_test_LDFLAGS) $(LDFLAGS) -o $@
am_is_jump_test_OBJECTS = is-jump-test.$(OBJEXT)
is_jump_test_OBJECTS = $(am_is_jump_test_OBJECTS)
is_jump_test_DEPENDENCIES = inst-set-test.lo
is_jump_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(is_jump_test_LDFLAGS) $(LDFLAGS) -o $@
am_is_lws_test_OBJECTS = is-lws-test.$(OBJEXT)
is_lws_test_OBJECTS = $(am_is_lws_test_OBJECTS)
is_lws_test_DEPENDENCIES = inst-set-test.lo
141,13 → 148,14
$(LDFLAGS) -o $@
SOURCES = $(libinst_set_test_la_SOURCES) $(inst_set_test_old_SOURCES) \
$(is_add_test_SOURCES) $(is_div_test_SOURCES) \
$(is_find_test_SOURCES) $(is_lws_test_SOURCES) \
$(is_mac_test_SOURCES) $(is_mul_test_SOURCES)
$(is_find_test_SOURCES) $(is_jump_test_SOURCES) \
$(is_lws_test_SOURCES) $(is_mac_test_SOURCES) \
$(is_mul_test_SOURCES)
DIST_SOURCES = $(libinst_set_test_la_SOURCES) \
$(inst_set_test_old_SOURCES) $(is_add_test_SOURCES) \
$(is_div_test_SOURCES) $(is_find_test_SOURCES) \
$(is_lws_test_SOURCES) $(is_mac_test_SOURCES) \
$(is_mul_test_SOURCES)
$(is_jump_test_SOURCES) $(is_lws_test_SOURCES) \
$(is_mac_test_SOURCES) $(is_mul_test_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
204,7 → 212,6
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
294,6 → 301,11
 
is_find_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld
is_find_test_LDADD = inst-set-test.lo
is_jump_test_SOURCES = inst-set-test.h \
is-jump-test.S
 
is_jump_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld
is_jump_test_LDADD = inst-set-test.lo
is_lws_test_SOURCES = inst-set-test.h \
is-lws-test.S
 
382,6 → 394,9
is-find-test$(EXEEXT): $(is_find_test_OBJECTS) $(is_find_test_DEPENDENCIES)
@rm -f is-find-test$(EXEEXT)
$(is_find_test_LINK) $(is_find_test_OBJECTS) $(is_find_test_LDADD) $(LIBS)
is-jump-test$(EXEEXT): $(is_jump_test_OBJECTS) $(is_jump_test_DEPENDENCIES)
@rm -f is-jump-test$(EXEEXT)
$(is_jump_test_LINK) $(is_jump_test_OBJECTS) $(is_jump_test_LDADD) $(LIBS)
is-lws-test$(EXEEXT): $(is_lws_test_OBJECTS) $(is_lws_test_DEPENDENCIES)
@rm -f is-lws-test$(EXEEXT)
$(is_lws_test_LINK) $(is_lws_test_OBJECTS) $(is_lws_test_LDADD) $(LIBS)
403,6 → 418,7
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-add-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-div-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-find-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-jump-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-lws-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-mac-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-mul-test.Po@am__quote@
/is-jump-test.S
0,0 → 1,149
/* is-jump-test.S. l.j, l.jal, l.jalr and l.jr instruction test of Or1ksim
*
* Copyright (C) 1999-2006 OpenCores
* Copyright (C) 2010 Embecosm Limited
*
* Contributors various OpenCores participants
* Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
*
* This file is part of OpenRISC 1000 Architectural Simulator.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http: www.gnu.org/licenses/>.
*/
 
/* ----------------------------------------------------------------------------
* Coding conventions are described in inst-set-test.S
* ------------------------------------------------------------------------- */
 
/* ----------------------------------------------------------------------------
* Test coverage
*
* The l.jalr and l.jr instructions should trigger an alignment exception if
* the register does not holde an aligned address (Bug 1775).
*
* Having fixed the problem, this is (in good software engineering style), a
* regresison test to go with the fix.
*
* This is not a comprehensive test of either instruction (yet).
*
* Of course what is really needed is a comprehensive instruction test...
* ------------------------------------------------------------------------- */
 
 
#include "inst-set-test.h"
 
/* ----------------------------------------------------------------------------
* A macro to carry out a test of a jump using a register destination
*
* We manually construct the opcode, to allow us to force r9 into the
* destination field, to test exception handling. Usually the assembler would
* prevent this.
*
* Arguments
* opc_mask: The opcode mask
* regno: Register number to use
* offset: Offset in bytes forward of target (testing alignment
* ------------------------------------------------------------------------- */
#define TEST_JUMP(opc_mask, dest, offset) \
LOAD_CONST (r31,51f + offset) ;\
.word (0xe01f0004|(dest << 21)) /* l.ori rD,r31,r0 */ ;\
l.mtspr r0,r0,SPR_EPCR_BASE /* Clear record */ ;\
50: .word (opc_mask|(dest << 11)) /* Jump opcode */ ;\
l.nop ;\
;\
/* Jump failed, we drop through to here */ ;\
l.mfspr r2,r0,SPR_EPCR_BASE /* What triggered exception */ ;\
PUSH (r2) /* Save EPCR for later */ ;\
PUTS (" Jump to 0x") ;\
PUTH (51f + offset) ;\
PUTS (" using register 0x") ;\
PUTHQ (dest) ;\
PUTS (" failed\n") ;\
l.j 52f ;\
l.nop ;\
;\
/* Jump succeeded we get here */ ;\
51: l.mfspr r2,r0,SPR_EPCR_BASE /* What triggered exception */ ;\
PUSH (r2) /* Save EPCR for later */ ;\
PUTS (" Jump to 0x") ;\
PUTH (51b + offset) ;\
PUTS (" using register 0x") ;\
PUTHQ (dest) ;\
PUTS (" OK\n") ;\
;\
/* Report if we got exception */ ;\
52: POP (r2) /* Retrieve EPCR */ ;\
LOAD_CONST (r4, 50b) /* The opcode of interest */ ;\
l.and r2,r2,r4 ;\
l.sfeq r2,r4 ;\
l.bnf 53f ;\
;\
PUTS (" - exception triggered: TRUE\n") ;\
l.j 54f ;\
l.nop ;\
;\
53: PUTS (" - exception triggered: FALSE\n") ;\
54:
/* ----------------------------------------------------------------------------
* Start of code
* ------------------------------------------------------------------------- */
.section .text
.global _start
_start:
 
/* ----------------------------------------------------------------------------
* Test of jump and link register, l.jalr
* ------------------------------------------------------------------------- */
_jalr:
LOAD_STR (r3, "l.jalr\n")
l.jal _puts
l.nop
 
/* Test with various alignment offsets */
TEST_JUMP (0x48000000, 5, 0) /* No offset */
TEST_JUMP (0x48000000, 5, 1) /* No offset */
TEST_JUMP (0x48000000, 5, 2) /* No offset */
TEST_JUMP (0x48000000, 5, 3) /* No offset */
 
/* Test with link register as the destination */
TEST_JUMP (0x48000000, 9, 0) /* No offset */
 
/* ----------------------------------------------------------------------------
* Test of jump register, l.jr
* ------------------------------------------------------------------------- */
_jr:
LOAD_STR (r3, "l.jr\n")
l.jal _puts
l.nop
 
/* Test with various alignment offsets */
TEST_JUMP (0x44000000, 5, 0) /* No offset */
TEST_JUMP (0x44000000, 5, 1) /* No offset */
TEST_JUMP (0x44000000, 5, 2) /* No offset */
TEST_JUMP (0x44000000, 5, 3) /* No offset */
 
/* Test with link register as the destination (OK here) */
TEST_JUMP (0x44000000, 9, 0) /* No offset */
 
/* ----------------------------------------------------------------------------
* All done
* ------------------------------------------------------------------------- */
_exit:
LOAD_STR (r3, "Test completed\n")
l.jal _puts
l.nop
 
TEST_EXIT
is-jump-test.S Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inst-set-test.S =================================================================== --- inst-set-test.S (revision 118) +++ inst-set-test.S (revision 121) @@ -79,45 +79,95 @@ l.nop /* ---------------------------------------------------------------------------- - * Range exception + * Alignment exception * * Don't be tempted to use the LOAD_STR macro here, it will dump us back into - * text space. - * - * Print a message about the instruction triggering the exception. Then - * replace it by l.nop and return. + * text section. + * + * The handling is a bit dubious at present. We just patch the instruction and + * restart. This will go wrong in branch delay slots. Really we need to single + * step past and then continue. + * + * Print a message identifying the exception type. * ------------------------------------------------------------------------- */ .section .rodata -50: .string " RANGE exception\n" -51: .string " - caused by: " -52: .string " - SR value: " +50: .string " ALIGNMENT exception\n" .section .boot-text - .org 0xb00 - .global _range -_range: - /* Note exception */ + .org 0x600 + .global _align +_align: + /* Report exception */ LOAD_CONST (r3, 50b) l.jal _puts l.nop - /* Report problem instruction */ + /* Patch with l.nop */ + l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */ + LOAD_CONST (r3, 0x15000000) /* l.nop */ + l.sw 0(r2),r3 + + /* All done */ + l.rfe +_align_end: + +/* ---------------------------------------------------------------------------- + * Illegal instruction exception + * + * Don't be tempted to use the LOAD_STR macro here, it will dump us back into + * text section. + * + * The handling is a bit dubious at present. We just patch the instruction and + * restart. This will go wrong in branch delay slots. Really we need to single + * step past and then continue. + * + * Print a message identifying the exception type. + * ------------------------------------------------------------------------- */ + .section .rodata +51: .string " ILLEGAL INSTRUCTION exception\n" + + .section .boot-text + .org 0x700 + .global _illegal +_illegal: + /* Report exception */ LOAD_CONST (r3, 51b) l.jal _puts l.nop + /* Patch with l.nop */ l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */ - l.lws r3,0(r2) /* The actual instruction */ - l.nop NOP_REPORT + LOAD_CONST (r3, 0x15000000) /* l.nop */ + l.sw 0(r2),r3 - /* Report status register */ + /* All done */ + l.rfe +_illegal_end: + +/* ---------------------------------------------------------------------------- + * Range exception + * + * Don't be tempted to use the LOAD_STR macro here, it will dump us back into + * text section. + * + * The handling is a bit dubious at present. We just patch the instruction and + * restart. This will go wrong in branch delay slots. Really we need to single + * step past and then continue. + * + * Print a message identifying the exception type. + * ------------------------------------------------------------------------- */ + .section .rodata +52: .string " RANGE exception\n" + + .section .boot-text + .org 0xb00 + .global _range +_range: + /* Report exception */ LOAD_CONST (r3, 52b) l.jal _puts l.nop - l.mfspr r3,r0,SPR_ESR_BASE /* Status reg */ - l.nop NOP_REPORT - /* Patch with l.nop */ l.mfspr r2,r0,SPR_EPCR_BASE /* Addr of problem instr */ LOAD_CONST (r3, 0x15000000) /* l.nop */
/Makefile.am
44,6 → 44,7
check_PROGRAMS = is-add-test \
is-div-test \
is-find-test \
is-jump-test \
is-lws-test \
is-mac-test \
is-mul-test \
65,6 → 66,11
is_find_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld
is_find_test_LDADD = inst-set-test.lo
 
is_jump_test_SOURCES = inst-set-test.h \
is-jump-test.S
is_jump_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld
is_jump_test_LDADD = inst-set-test.lo
 
is_lws_test_SOURCES = inst-set-test.h \
is-lws-test.S
is_lws_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld

powered by: WebSVN 2.1.0

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