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
    from Rev 115 to Rev 116
    Reverse comparison

Rev 115 → Rev 116

/test-code-or1k/inst-set-test/is-add-test.S
23,22 → 23,7
*/
 
/* ----------------------------------------------------------------------------
* Coding conventions
*
* A simple rising stack is provided starting at _stack and pointed to by
* r1. r1 points to the next free word. Only 32-bit registers may be pushed
* onto the stack.
*
* Local labels up to 49 are reserved for macros. Each is used only once in
* all macros. You can get in a serious mess if you get local label clashing
* in macros.
*
* Arguments to functions are passed in r3 through r8.
* r9 is the link (return address)
* r11 is for returning results
*
* Only r1 and r2 are preserved across function calls. It is up to the callee
* to save any other registers required.
* Coding conventions are described in inst-set-test.S
* ------------------------------------------------------------------------- */
 
/* ----------------------------------------------------------------------------
/test-code-or1k/inst-set-test/Makefile.in
59,7 → 59,8
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = is-add-test$(EXEEXT) is-div-test$(EXEEXT) \
is-find-test$(EXEEXT) is-lws-test$(EXEEXT) $(am__EXEEXT_1)
is-find-test$(EXEEXT) is-mac-test$(EXEEXT) \
is-lws-test$(EXEEXT) $(am__EXEEXT_1)
subdir = inst-set-test
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
108,6 → 109,12
is_lws_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(is_lws_test_LDFLAGS) $(LDFLAGS) -o $@
am_is_mac_test_OBJECTS = is-mac-test.$(OBJEXT)
is_mac_test_OBJECTS = $(am_is_mac_test_OBJECTS)
is_mac_test_DEPENDENCIES = inst-set-test.lo
is_mac_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(is_mac_test_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/../../depcomp
am__depfiles_maybe = depfiles
128,11 → 135,12
$(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_find_test_SOURCES) $(is_lws_test_SOURCES) \
$(is_mac_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_lws_test_SOURCES) $(is_mac_test_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
278,6 → 286,11
 
is_find_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld
is_find_test_LDADD = inst-set-test.lo
is_mac_test_SOURCES = inst-set-test.h \
is-mac-test.S
 
is_mac_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld
is_mac_test_LDADD = inst-set-test.lo
is_lws_test_SOURCES = inst-set-test.h \
is-lws-test.S
 
359,6 → 372,9
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)
is-mac-test$(EXEEXT): $(is_mac_test_OBJECTS) $(is_mac_test_DEPENDENCIES)
@rm -f is-mac-test$(EXEEXT)
$(is_mac_test_LINK) $(is_mac_test_OBJECTS) $(is_mac_test_LDADD) $(LIBS)
 
mostlyclean-compile:
-rm -f *.$(OBJEXT)
372,6 → 388,7
@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-lws-test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is-mac-test.Po@am__quote@
 
.S.o:
@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
/test-code-or1k/inst-set-test/inst-set-test.S
37,8 → 37,7
* r9 is the link (return address)
* r11 is for returning results
*
* Only r1 and r2 are preserved across function calls. It is up to the callee
* to save any other registers required.
* All registers apart from r2, r9 and r11 are preserved across function calls.
* ------------------------------------------------------------------------- */
 
/* ----------------------------------------------------------------------------
151,6 → 150,7
* ------------------------------------------------------------------------- */
.global _puts
_puts:
PUSH (r3)
l.add r2,r0,r3 /* Copy the string pointer */
/* Loop getting and printing each char until end of string */
162,10 → 162,80
l.j 60b /* Repeat */
l.nop NOP_PUTC /* Delay slot */
 
61: l.jr r9 /* Return */
61: POP (r3)
l.jr r9 /* Return */
l.nop
 
/* ----------------------------------------------------------------------------
* Subroutine to print out a register in hex
*
* Parameters:
* r3 The value to print
* ------------------------------------------------------------------------- */
.section .rodata
62: .string "0123456789abcdef"
.section .text
 
.global _puth
_puth:
PUSH (r3)
PUSH (r4)
l.add r2,r0,r3 /* Copy the value pointer */
LOAD_CONST (r4,62b) /* Ptr to digit chars */
l.srli r3,r2,28 /* Print each digit in turn. */
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
l.srli r3,r2,24
l.andi r3,r3,0xf
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
l.srli r3,r2,20
l.andi r3,r3,0xf
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
l.srli r3,r2,16
l.andi r3,r3,0xf
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
l.srli r3,r2,12
l.andi r3,r3,0xf
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
l.srli r3,r2,8
l.andi r3,r3,0xf
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
l.srli r3,r2,4
l.andi r3,r3,0xf
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
l.andi r3,r2,0xf
l.add r3,r4,r3
l.lbz r3,0(r3)
l.nop NOP_PUTC
 
POP (r4) /* Return */
POP (r3)
l.jr r9
l.nop
 
/* ----------------------------------------------------------------------------
* Subroutine to print out a test name prompt
*
* The string is preceded by two spaces
175,10 → 245,10
* ------------------------------------------------------------------------- */
.global _ptest
_ptest:
PUSH(r9) /* Save the return address */
PUSH(r3) /* Save the test name for later */
PUSH (r9) /* Save the return address */
PUSH (r3) /* Save the test name for later */
 
LOAD_STR(r3, " ") /* Prefix */
LOAD_STR (r3, " ") /* Prefix */
l.jal _puts
l.nop
 
197,12 → 267,14
* ------------------------------------------------------------------------- */
.global _pok
_pok:
PUSH(r9) /* Save the return address */
PUSH (r9) /* Save the return address */
PUSH (r3)
 
LOAD_STR(r3, "OK\n")
LOAD_STR (r3, "OK\n")
l.jal _puts
l.nop
 
POP (r3)
POP (r9)
l.jr r9
l.nop
214,12 → 286,14
* ------------------------------------------------------------------------- */
.global _pfail
_pfail:
PUSH(r9) /* Save the return address */
PUSH (r9) /* Save the return address */
PUSH (r3)
 
LOAD_STR(r3, "Failed: ")
LOAD_STR (r3, "Failed: ")
l.jal _puts
l.nop
 
POP (r3)
POP (r9)
l.jr r9
l.nop
229,12 → 303,14
* ------------------------------------------------------------------------- */
.global _ptrue
_ptrue:
PUSH(r9) /* Save the return address */
PUSH (r9) /* Save the return address */
PUSH (r3)
 
LOAD_STR(r3, "TRUE")
LOAD_STR (r3, "TRUE")
l.jal _puts
l.nop
 
POP (r3)
POP (r9)
l.jr r9
l.nop
244,12 → 320,14
* ------------------------------------------------------------------------- */
.global _pfalse
_pfalse:
PUSH(r9) /* Save the return address */
PUSH (r9) /* Save the return address */
PUSH (r3)
 
LOAD_STR(r3, "FALSE")
LOAD_STR (r3, "FALSE")
l.jal _puts
l.nop
 
POP (r3)
POP (r9)
l.jr r9
l.nop
261,12 → 339,14
* ------------------------------------------------------------------------- */
.global _punexpected
_punexpected:
PUSH(r9) /* Save the return address */
PUSH (r9) /* Save the return address */
PUSH (r3)
 
LOAD_STR(r3, " unexpected\n")
LOAD_STR (r3, " unexpected\n")
l.jal _puts
l.nop
 
POP (r3)
POP (r9)
l.jr r9
l.nop
/test-code-or1k/inst-set-test/is-find-test.S
23,22 → 23,7
*/
 
/* ----------------------------------------------------------------------------
* Coding conventions
*
* A simple rising stack is provided starting at _stack and pointed to by
* r1. r1 points to the next free word. Only 32-bit registers may be pushed
* onto the stack.
*
* Local labels up to 49 are reserved for macros. Each is used only once in
* all macros. You can get in a serious mess if you get local label clashing
* in macros.
*
* Arguments to functions are passed in r3 through r8.
* r9 is the link (return address)
* r11 is for returning results
*
* Only r1 and r2 are preserved across function calls. It is up to the callee
* to save any other registers required.
* Coding conventions are described in inst-set-test.S
* ------------------------------------------------------------------------- */
 
/* ----------------------------------------------------------------------------
/test-code-or1k/inst-set-test/is-mac-test.S
0,0 → 1,987
/* is-mac-test.S. l.mac, l.maci, l.macrc and l.msb 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.add, l.addc, l.addi and l.addic instructions should set the carry and
* overflow flags.
*
* In addition the l.addc and l.addic instructions should add in the carry
* bit.
*
* Problems in this area were reported in Bugs 1771 and 1776. Having fixed the
* problem, this is (in good software engineering style), a regression test
* to go with the fix.
*
* This is not a comprehensive test of any 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 multiply accumulate read and clear
*
* Arguments
* machi: Inital value of MACHI
* maclo: Inital value of MACLO
* op1: First operand value
* op2: Second operand value
* res: Expected result
* ------------------------------------------------------------------------- */
#define TEST_MACRC(machi, maclo, op1, op2, res) \
LOAD_CONST (r2,maclo) ;\
l.mtspr r0,r2,SPR_MACLO ;\
LOAD_CONST (r2,machi) ;\
l.mtspr r0,r2,SPR_MACHI ;\
;\
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
LOAD_CONST (r6,op2) ;\
l.mac r5,r6 ;\
l.macrc r4 ;\
PUSH (r4) /* Save for later */ ;\
PUTS (" 0x") ;\
PUTH (machi) ;\
PUTS (" ") ;\
PUTH (maclo) ;\
PUTS (" + 0x") ;\
PUTH (op1) ;\
PUTS (" * 0x") ;\
PUTH (op2) ;\
PUTS (" = 0x") ;\
PUTH (res) ;\
PUTS (": ") ;\
POP (r4) ;\
CHECK_RES ("", r4, res) ;\
;\
l.mfspr r5,r0,SPR_MACHI ;\
l.sfne r5,r0 ;\
l.bf 50f ;\
;\
PUTS (" - MACHI cleared\n") ;\
;\
50: l.mfspr r6,r0,SPR_MACLO ;\
l.sfne r6,r0 ;\
l.bf 51f ;\
;\
PUTS (" - MACLO cleared\n") ;\
51:
/* ----------------------------------------------------------------------------
* A macro to carry out a test of multiply accumulate in registers
*
* Arguments
* machi: Inital value of MACHI
* maclo: Inital value of MACLO
* op1: First operand value
* op2: Second operand value
* reshi: Expected result
* reslo: Expected result
* ------------------------------------------------------------------------- */
#define TEST_MAC(machi, maclo, op1, op2, reshi, reslo) \
LOAD_CONST (r2,maclo) ;\
l.mtspr r0,r2,SPR_MACLO ;\
LOAD_CONST (r2,machi) ;\
l.mtspr r0,r2,SPR_MACHI ;\
;\
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
LOAD_CONST (r6,op2) ;\
l.mac r5,r6 ;\
l.mfspr r5,r0,SPR_MACHI ;\
l.mfspr r6,r0,SPR_MACLO ;\
PUSH (r5) /* Save for later */ ;\
PUSH (r6) ;\
PUTS (" 0x") ;\
PUTH (machi) ;\
PUTS (" ") ;\
PUTH (maclo) ;\
PUTS (" + 0x") ;\
PUTH (op1) ;\
PUTS (" * 0x") ;\
PUTH (op2) ;\
PUTS (" = 0x") ;\
PUTH (reshi) ;\
PUTS (" ") ;\
PUTH (reslo) ;\
PUTS (": ") ;\
POP (r6) ;\
POP (r5) ;\
CHECK_RES2 (r5, r6, reshi, reslo)
/* ----------------------------------------------------------------------------
* A macro to carry out a test of multiply accumulate with immediate arg
*
* There is currently a bug in the assembler, so we must hand construct
* l.maci r5,op1.
*
* Arguments
* machi: Inital value of MACHI
* maclo: Inital value of MACLO
* op1: First operand value
* op2: Second operand value
* reshi: Expected result
* reslo: Expected result
* ------------------------------------------------------------------------- */
#define TEST_MACI(machi, maclo, op1, op2, reshi, reslo) \
LOAD_CONST (r2,maclo) ;\
l.mtspr r0,r2,SPR_MACLO ;\
LOAD_CONST (r2,machi) ;\
l.mtspr r0,r2,SPR_MACHI ;\
;\
LOAD_CONST (r5,op1) /* Load number to add */ ;\
.word (0x4c050000|op2) /* l.maci r5,op2 */ ;\
/* l.maci r5,op2 */ ;\
l.mfspr r5,r0,SPR_MACHI ;\
l.mfspr r6,r0,SPR_MACLO ;\
PUSH (r5) /* Save for later */ ;\
PUSH (r6) ;\
PUTS (" 0x") ;\
PUTH (machi) ;\
PUTS (" ") ;\
PUTH (maclo) ;\
PUTS (" + 0x") ;\
PUTH (op1) ;\
PUTS (" * 0x") ;\
PUTH (op2) ;\
PUTS (" = 0x") ;\
PUTH (reshi) ;\
PUTS (" ") ;\
PUTH (reslo) ;\
PUTS (": ") ;\
POP (r6) ;\
POP (r5) ;\
CHECK_RES2 (r5, r6, reshi, reslo)
 
 
/* ----------------------------------------------------------------------------
* A macro to carry out a test of multiply and subract
*
* Arguments
* machi: Inital value of MACHI
* maclo: Inital value of MACLO
* op1: First operand value
* op2: Second operand value
* reshi: Expected result
* reslo: Expected result
* ------------------------------------------------------------------------- */
#define TEST_MSB(machi, maclo, op1, op2, reshi, reslo) \
LOAD_CONST (r2,maclo) ;\
l.mtspr r0,r2,SPR_MACLO ;\
LOAD_CONST (r2,machi) ;\
l.mtspr r0,r2,SPR_MACHI ;\
;\
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
LOAD_CONST (r6,op2) ;\
l.msb r5,r6 ;\
l.mfspr r5,r0,SPR_MACHI ;\
l.mfspr r6,r0,SPR_MACLO ;\
PUSH (r5) /* Save for later */ ;\
PUSH (r6) ;\
PUTS (" 0x") ;\
PUTH (machi) ;\
PUTS (" ") ;\
PUTH (maclo) ;\
PUTS (" - 0x") ;\
PUTH (op1) ;\
PUTS (" * 0x") ;\
PUTH (op2) ;\
PUTS (" = 0x") ;\
PUTH (reshi) ;\
PUTS (" ") ;\
PUTH (reslo) ;\
PUTS (": ") ;\
POP (r6) ;\
POP (r5) ;\
CHECK_RES2 (r5, r6, reshi, reslo)
.section .text
.global _start
_start:
 
/* ----------------------------------------------------------------------------
* Test of multiply signed and accumulate, l.mac
* ------------------------------------------------------------------------- */
_mac:
LOAD_STR (r3, "l.mac\n")
l.jal _puts
l.nop
 
/* MAC two small positive numbers on a zero total */
TEST_MAC (0x00000000, 0x00000000,
0x00000002, 0x00000003,
0x00000000, 0x00000006)
 
/* MAC two small positive numbers on a small positive total */
TEST_MAC (0x00000000, 0x00000006,
0x00000002, 0x00000003,
0x00000000, 0x0000000c)
 
/* MAC two small positive numbers on a moderate positive total */
TEST_MAC (0x00000000, 0xfffffffa,
0x00000002, 0x00000003,
0x00000001, 0x00000000)
 
/* MAC two small positive numbers on a large positive total */
TEST_MAC (0x3fffffff, 0xfffffffa,
0x00000002, 0x00000003,
0x40000000, 0x00000000)
 
/* MAC two small positive numbers on a small negative total */
TEST_MAC (0xffffffff, 0xfffffffa,
0x00000002, 0x00000003,
0x00000000, 0x00000000)
 
/* MAC two small positive numbers on a moderate negative total */
TEST_MAC (0xffffffff, 0x00000000,
0x00000002, 0x00000003,
0xffffffff, 0x00000006)
 
/* MAC two small positive numbers on a large negative total */
TEST_MAC (0x80000000, 0x00000000,
0x00000002, 0x00000003,
0x80000000, 0x00000006)
 
PUTC ('\n')
 
/* MAC two moderate positive numbers on a zero total */
TEST_MAC (0x00000000, 0x00000000,
0x00008001, 0x0000fffe,
0x00000000, 0x7ffffffe)
 
/* MAC two moderate positive numbers on a small positive total */
TEST_MAC (0x00000000, 0x00000002,
0x00008001, 0x0000fffe,
0x00000000, 0x80000000)
 
/* MAC two moderate positive numbers on a moderate positive total */
TEST_MAC (0x00000000, 0x80000002,
0x00008001, 0x0000fffe,
0x00000001, 0x00000000)
 
/* MAC two moderate positive numbers on a large positive total */
TEST_MAC (0x7fffffff, 0x80000001,
0x00008001, 0x0000fffe,
0x7fffffff, 0xffffffff)
 
/* MAC two moderate positive numbers on a small negative total */
TEST_MAC (0xffffffff, 0xffffffff,
0x00008001, 0x0000fffe,
0x00000000, 0x7ffffffd)
 
/* MAC two moderate positive numbers on a moderate negative total */
TEST_MAC (0xffffffff, 0x80000002,
0x00008001, 0x0000fffe,
0x00000000, 0x00000000)
 
/* MAC two moderate positive numbers on a large negative total */
TEST_MAC (0xfffffffe, 0x80000002,
0x00008001, 0x0000fffe,
0xffffffff, 0x00000000)
 
PUTC ('\n')
 
/* MAC two small negative numbers on a zero total */
TEST_MAC (0x00000000, 0x00000000,
0xfffffffe, 0xfffffffd,
0x00000000, 0x00000006)
 
/* MAC two small negative numbers on a small positive total */
TEST_MAC (0x00000000, 0x00000006,
0xfffffffe, 0xfffffffd,
0x00000000, 0x0000000c)
 
/* MAC two small negative numbers on a small negative total */
TEST_MAC (0xffffffff, 0xffffffff,
0xfffffffe, 0xfffffffd,
0x00000000, 0x00000005)
 
PUTC ('\n')
 
/* MAC one small positive and one small negative number on a zero
total */
TEST_MAC (0x00000000, 0x00000000,
0x00000002, 0xfffffffd,
0xffffffff, 0xfffffffa)
 
/* MAC one small positive and one small negative number on a small
positive total */
TEST_MAC (0x00000000, 0x0000000c,
0x00000002, 0xfffffffd,
0x00000000, 0x00000006)
 
/* MAC one small positive and one small negative number on a moderate
positive total */
TEST_MAC (0x00000001, 0x00000005,
0x00000002, 0xfffffffd,
0x00000000, 0xffffffff)
 
/* MAC one small positive and one small negative number on a large
positive total */
TEST_MAC (0x7fffffff, 0xffffffff,
0x00000002, 0xfffffffd,
0x7fffffff, 0xfffffff9)
 
/* MAC one small positive and one small negative number on a small
negative total */
TEST_MAC (0xffffffff, 0xffffffff,
0x00000002, 0xfffffffd,
0xffffffff, 0xfffffff9)
 
/* MAC one small positive and one small negative number on a moderate
negative total */
TEST_MAC (0xffffffff, 0x00000005,
0x00000002, 0xfffffffd,
0xfffffffe, 0xffffffff)
 
/* MAC one small positive and one small negative number on a large
negative total */
TEST_MAC (0x80000000, 0x00000006,
0x00000002, 0xfffffffd,
0x80000000, 0x00000000)
 
PUTC ('\n')
 
/* MAC one moderate positive and one moderate negative number on a
zero total */
TEST_MAC (0x00000000, 0x00000000,
0x00008000, 0xffff0000,
0xffffffff, 0x80000000)
 
/* MAC one moderate positive and one moderate negative number on a
small positive total */
TEST_MAC (0x00000000, 0x00000006,
0x00008000, 0xffff0000,
0xffffffff, 0x80000006)
 
/* MAC one moderate positive and one moderate negative number on a
moderate positive total */
TEST_MAC (0x00000000, 0x80000000,
0x00008000, 0xffff0000,
0x00000000, 0x00000000)
 
/* MAC one moderate positive and one moderate negative number on a
large positive total */
TEST_MAC (0x7fffffff, 0xffffffff,
0x00008000, 0xffff0000,
0x7fffffff, 0x7fffffff)
 
/* MAC one moderate positive and one moderate negative number on a
small negative total */
TEST_MAC (0xffffffff, 0xffffffff,
0x00008000, 0xffff0000,
0xffffffff, 0x7fffffff)
 
/* MAC one moderate positive and one moderate negative number on a
moderate negative total */
TEST_MAC (0xffffffff, 0x7fffffff,
0x00008000, 0xffff0000,
0xfffffffe, 0xffffffff)
 
/* MAC one moderate positive and one moderate negative number on a
large negative total */
TEST_MAC (0x80000000, 0x80000000,
0x00008000, 0xffff0000,
0x80000000, 0x00000000)
 
PUTC ('\n')
 
/* ----------------------------------------------------------------------------
* Test of multiply signed and accumulate, l.maci
* ------------------------------------------------------------------------- */
_maci:
LOAD_STR (r3, "l.maci\n")
l.jal _puts
l.nop
 
/* MAC two small positive numbers on a zero total */
TEST_MACI (0x00000000, 0x00000000,
0x00000002, 0x0003,
0x00000000, 0x00000006)
 
/* MAC two small positive numbers on a small positive total */
TEST_MACI (0x00000000, 0x00000006,
0x00000002, 0x0003,
0x00000000, 0x0000000c)
 
/* MAC two small positive numbers on a moderate positive total */
TEST_MACI (0x00000000, 0xfffffffa,
0x00000002, 0x0003,
0x00000001, 0x00000000)
 
/* MAC two small positive numbers on a large positive total */
TEST_MACI (0x3fffffff, 0xfffffffa,
0x00000002, 0x0003,
0x40000000, 0x00000000)
 
/* MAC two small positive numbers on a small negative total */
TEST_MACI (0xffffffff, 0xfffffffa,
0x00000002, 0x0003,
0x00000000, 0x00000000)
 
/* MAC two small positive numbers on a moderate negative total */
TEST_MACI (0xffffffff, 0x00000000,
0x00000002, 0x0003,
0xffffffff, 0x00000006)
 
/* MAC two small positive numbers on a large negative total */
TEST_MACI (0x80000000, 0x00000000,
0x00000002, 0x0003,
0x80000000, 0x00000006)
 
PUTC ('\n')
tmp:
/* MAC two moderate positive numbers on a zero total */
TEST_MACI (0x00000000, 0x00000000,
0x00010002, 0x7fff,
0x00000000, 0x7ffffffe)
 
/* MAC two moderate positive numbers on a small positive total */
TEST_MACI (0x00000000, 0x00000002,
0x00010002, 0x7fff,
0x00000000, 0x80000000)
 
/* MAC two moderate positive numbers on a moderate positive total */
TEST_MACI (0x00000000, 0x80000002,
0x00010002, 0x7fff,
0x00000001, 0x00000000)
 
/* MAC two moderate positive numbers on a large positive total */
TEST_MACI (0x7fffffff, 0x80000001,
0x00010002, 0x7fff,
0x7fffffff, 0xffffffff)
 
/* MAC two moderate positive numbers on a small negative total */
TEST_MACI (0xffffffff, 0xffffffff,
0x00010002, 0x7fff,
0x00000000, 0x7ffffffd)
 
/* MAC two moderate positive numbers on a moderate negative total */
TEST_MACI (0xffffffff, 0x80000002,
0x00010002, 0x7fff,
0x00000000, 0x00000000)
 
/* MAC two moderate positive numbers on a large negative total */
TEST_MACI (0xfffffffe, 0x80000002,
0x00010002, 0x7fff,
0xffffffff, 0x00000000)
 
PUTC ('\n')
 
/* MAC two small negative numbers on a zero total */
TEST_MACI (0x00000000, 0x00000000,
0xfffffffe, 0xfffd,
0x00000000, 0x00000006)
 
/* MAC two small negative numbers on a small positive total */
TEST_MACI (0x00000000, 0x00000006,
0xfffffffe, 0xfffd,
0x00000000, 0x0000000c)
 
/* MAC two small negative numbers on a small negative total */
TEST_MACI (0xffffffff, 0xffffffff,
0xfffffffe, 0xfffd,
0x00000000, 0x00000005)
 
PUTC ('\n')
 
/* MAC one small positive and one small negative number on a zero
total */
TEST_MACI (0x00000000, 0x00000000,
0x00000002, 0xfffd,
0xffffffff, 0xfffffffa)
 
/* MAC one small positive and one small negative number on a small
positive total */
TEST_MACI (0x00000000, 0x0000000c,
0x00000002, 0xfffd,
0x00000000, 0x00000006)
 
/* MAC one small positive and one small negative number on a moderate
positive total */
TEST_MACI (0x00000001, 0x00000005,
0x00000002, 0xfffd,
0x00000000, 0xffffffff)
 
/* MAC one small positive and one small negative number on a large
positive total */
TEST_MACI (0x7fffffff, 0xffffffff,
0x00000002, 0xfffd,
0x7fffffff, 0xfffffff9)
 
/* MAC one small positive and one small negative number on a small
negative total */
TEST_MACI (0xffffffff, 0xffffffff,
0x00000002, 0xfffd,
0xffffffff, 0xfffffff9)
 
/* MAC one small positive and one small negative number on a moderate
negative total */
TEST_MACI (0xffffffff, 0x00000005,
0x00000002, 0xfffd,
0xfffffffe, 0xffffffff)
 
/* MAC one small positive and one small negative number on a large
negative total */
TEST_MACI (0x80000000, 0x00000006,
0x00000002, 0xfffd,
0x80000000, 0x00000000)
 
PUTC ('\n')
 
/* MAC one moderate positive and one moderate negative number on a
zero total */
TEST_MACI (0x00000000, 0x00000000,
0x00010000, 0x8000,
0xffffffff, 0x80000000)
 
/* MAC one moderate positive and one moderate negative number on a
small positive total */
TEST_MACI (0x00000000, 0x00000006,
0x00010000, 0x8000,
0xffffffff, 0x80000006)
 
/* MAC one moderate positive and one moderate negative number on a
moderate positive total */
TEST_MACI (0x00000000, 0x80000000,
0x00010000, 0x8000,
0x00000000, 0x00000000)
 
/* MAC one moderate positive and one moderate negative number on a
large positive total */
TEST_MACI (0x7fffffff, 0xffffffff,
0x00010000, 0x8000,
0x7fffffff, 0x7fffffff)
 
/* MAC one moderate positive and one moderate negative number on a
small negative total */
TEST_MACI (0xffffffff, 0xffffffff,
0x00010000, 0x8000,
0xffffffff, 0x7fffffff)
 
/* MAC one moderate positive and one moderate negative number on a
moderate negative total */
TEST_MACI (0xffffffff, 0x7fffffff,
0x00010000, 0x8000,
0xfffffffe, 0xffffffff)
 
/* MAC one moderate positive and one moderate negative number on a
large negative total */
TEST_MACI (0x80000000, 0x80000000,
0x00010000, 0x8000,
0x80000000, 0x00000000)
 
PUTC ('\n')
 
/* ----------------------------------------------------------------------------
* Test of multiply signed and accumulate, read and clear l.macrc
* ------------------------------------------------------------------------- */
_macrc:
LOAD_STR (r3, "l.macrc\n")
l.jal _puts
l.nop
 
/* MAC two small positive numbers on a zero total */
TEST_MACRC (0x00000000, 0x00000000,
0x00000002, 0x00000003,
0x00000006)
 
/* MAC two small positive numbers on a small positive total */
TEST_MACRC (0x00000000, 0x00000006,
0x00000002, 0x00000003,
0x0000000c)
 
/* MAC two small positive numbers on a moderate positive total */
TEST_MACRC (0x00000000, 0xfffffffa,
0x00000002, 0x00000003,
0x00000000)
 
/* MAC two small positive numbers on a large positive total */
TEST_MACRC (0x3fffffff, 0xfffffffa,
0x00000002, 0x00000003,
0x00000000)
 
/* MAC two small positive numbers on a small negative total */
TEST_MACRC (0xffffffff, 0xfffffffa,
0x00000002, 0x00000003,
0x00000000)
 
/* MAC two small positive numbers on a moderate negative total */
TEST_MACRC (0xffffffff, 0x00000000,
0x00000002, 0x00000003,
0x00000006)
 
/* MAC two small positive numbers on a large negative total */
TEST_MACRC (0x80000000, 0x00000000,
0x00000002, 0x00000003,
0x00000006)
 
PUTC ('\n')
 
/* MAC two moderate positive numbers on a zero total */
TEST_MACRC (0x00000000, 0x00000000,
0x00008001, 0x0000fffe,
0x7ffffffe)
 
/* MAC two moderate positive numbers on a small positive total */
TEST_MACRC (0x00000000, 0x00000002,
0x00008001, 0x0000fffe,
0x80000000)
 
/* MAC two moderate positive numbers on a moderate positive total */
TEST_MACRC (0x00000000, 0x80000002,
0x00008001, 0x0000fffe,
0x00000000)
 
/* MAC two moderate positive numbers on a large positive total */
TEST_MACRC (0x7fffffff, 0x80000001,
0x00008001, 0x0000fffe,
0xffffffff)
 
/* MAC two moderate positive numbers on a small negative total */
TEST_MACRC (0xffffffff, 0xffffffff,
0x00008001, 0x0000fffe,
0x7ffffffd)
 
/* MAC two moderate positive numbers on a moderate negative total */
TEST_MACRC (0xffffffff, 0x80000002,
0x00008001, 0x0000fffe,
0x00000000)
 
/* MAC two moderate positive numbers on a large negative total */
TEST_MACRC (0xfffffffe, 0x80000002,
0x00008001, 0x0000fffe,
0x00000000)
 
PUTC ('\n')
 
/* MAC two small negative numbers on a zero total */
TEST_MACRC (0x00000000, 0x00000000,
0xfffffffe, 0xfffffffd,
0x00000006)
 
/* MAC two small negative numbers on a small positive total */
TEST_MACRC (0x00000000, 0x00000006,
0xfffffffe, 0xfffffffd,
0x0000000c)
 
/* MAC two small negative numbers on a small negative total */
TEST_MACRC (0xffffffff, 0xffffffff,
0xfffffffe, 0xfffffffd,
0x00000005)
 
PUTC ('\n')
 
/* MAC one small positive and one small negative number on a zero
total */
TEST_MACRC (0x00000000, 0x00000000,
0x00000002, 0xfffffffd,
0xfffffffa)
 
/* MAC one small positive and one small negative number on a small
positive total */
TEST_MACRC (0x00000000, 0x0000000c,
0x00000002, 0xfffffffd,
0x00000006)
 
/* MAC one small positive and one small negative number on a moderate
positive total */
TEST_MACRC (0x00000001, 0x00000005,
0x00000002, 0xfffffffd,
0xffffffff)
 
/* MAC one small positive and one small negative number on a large
positive total */
TEST_MACRC (0x7fffffff, 0xffffffff,
0x00000002, 0xfffffffd,
0xfffffff9)
 
/* MAC one small positive and one small negative number on a small
negative total */
TEST_MACRC (0xffffffff, 0xffffffff,
0x00000002, 0xfffffffd,
0xfffffff9)
 
/* MAC one small positive and one small negative number on a moderate
negative total */
TEST_MACRC (0xffffffff, 0x00000005,
0x00000002, 0xfffffffd,
0xffffffff)
 
/* MAC one small positive and one small negative number on a large
negative total */
TEST_MACRC (0x80000000, 0x00000006,
0x00000002, 0xfffffffd,
0x00000000)
 
PUTC ('\n')
 
/* MAC one moderate positive and one moderate negative number on a
zero total */
TEST_MACRC (0x00000000, 0x00000000,
0x00008000, 0xffff0000,
0x80000000)
 
/* MAC one moderate positive and one moderate negative number on a
small positive total */
TEST_MACRC (0x00000000, 0x00000006,
0x00008000, 0xffff0000,
0x80000006)
 
/* MAC one moderate positive and one moderate negative number on a
moderate positive total */
TEST_MACRC (0x00000000, 0x80000000,
0x00008000, 0xffff0000,
0x00000000)
 
/* MAC one moderate positive and one moderate negative number on a
large positive total */
TEST_MACRC (0x7fffffff, 0xffffffff,
0x00008000, 0xffff0000,
0x7fffffff)
 
/* MAC one moderate positive and one moderate negative number on a
small negative total */
TEST_MACRC (0xffffffff, 0xffffffff,
0x00008000, 0xffff0000,
0x7fffffff)
 
/* MAC one moderate positive and one moderate negative number on a
moderate negative total */
TEST_MACRC (0xffffffff, 0x7fffffff,
0x00008000, 0xffff0000,
0xffffffff)
 
/* MAC one moderate positive and one moderate negative number on a
large negative total */
TEST_MACRC (0x80000000, 0x80000000,
0x00008000, 0xffff0000,
0x00000000)
 
PUTC ('\n')
 
/* ----------------------------------------------------------------------------
* Test of multiply signed and accumulate, l.msb
* ------------------------------------------------------------------------- */
_msb:
LOAD_STR (r3, "l.msb\n")
l.jal _puts
l.nop
 
/* MSB two small positive numbers on a zero total */
TEST_MSB (0x00000000, 0x00000000,
0x00000002, 0x00000003,
0xffffffff, 0xfffffffa)
 
/* MSB two small positive numbers on a small positive total */
TEST_MSB (0x00000000, 0x0000000c,
0x00000002, 0x00000003,
0x00000000, 0x00000006)
 
/* MSB two small positive numbers on a moderate positive total */
TEST_MSB (0x00000001, 0x00000000,
0x00000002, 0x00000003,
0x00000000, 0xfffffffa)
 
/* MSB two small positive numbers on a large positive total */
TEST_MSB (0x40000000, 0x00000000,
0x00000002, 0x00000003,
0x3fffffff, 0xfffffffa)
 
/* MSB two small positive numbers on a small negative total */
TEST_MSB (0xffffffff, 0xfffffffa,
0x00000002, 0x00000003,
0xffffffff, 0xfffffff4)
 
/* MSB two small positive numbers on a moderate negative total */
TEST_MSB (0xffffffff, 0x00000005,
0x00000002, 0x00000003,
0xfffffffe, 0xffffffff)
 
/* MSB two small positive numbers on a large negative total */
TEST_MSB (0x80000000, 0x00000006,
0x00000002, 0x00000003,
0x80000000, 0x00000000)
 
PUTC ('\n')
 
/* MSB two moderate positive numbers on a zero total */
TEST_MSB (0x00000000, 0x00000000,
0x00008001, 0x0000fffe,
0xffffffff, 0x80000002)
 
/* MSB two moderate positive numbers on a small positive total */
TEST_MSB (0x00000000, 0x00000002,
0x00008001, 0x0000fffe,
0xffffffff, 0x80000004)
 
/* MSB two moderate positive numbers on a moderate positive total */
TEST_MSB (0x00000000, 0x80000002,
0x00008001, 0x0000fffe,
0x00000000, 0x00000004)
 
/* MSB two moderate positive numbers on a large positive total */
TEST_MSB (0x7fffffff, 0x7ffffffd,
0x00008001, 0x0000fffe,
0x7ffffffe, 0xffffffff)
 
/* MSB two moderate positive numbers on a small negative total */
TEST_MSB (0xffffffff, 0xffffffff,
0x00008001, 0x0000fffe,
0xffffffff, 0x80000001)
 
/* MSB two moderate positive numbers on a moderate negative total */
TEST_MSB (0xffffffff, 0x80000002,
0x00008001, 0x0000fffe,
0xffffffff, 0x00000004)
 
/* MSB two moderate positive numbers on a large negative total */
TEST_MSB (0xfffffffe, 0x80000002,
0x00008001, 0x0000fffe,
0xfffffffe, 0x00000004)
 
PUTC ('\n')
 
/* MSB two small negative numbers on a zero total */
TEST_MSB (0x00000000, 0x00000006,
0xfffffffe, 0xfffffffd,
0x00000000, 0x00000000)
 
/* MSB two small negative numbers on a small positive total */
TEST_MSB (0x00000000, 0x0000000c,
0xfffffffe, 0xfffffffd,
0x00000000, 0x00000006)
 
/* MSB two small negative numbers on a small negative total */
TEST_MSB (0xffffffff, 0xffffffff,
0xfffffffe, 0xfffffffd,
0xffffffff, 0xfffffff9)
 
PUTC ('\n')
 
/* MSB one small positive and one small negative number on a zero
total */
TEST_MSB (0x00000000, 0x00000000,
0x00000002, 0xfffffffd,
0x00000000, 0x00000006)
 
/* MSB one small positive and one small negative number on a small
positive total */
TEST_MSB (0x00000000, 0x00000006,
0x00000002, 0xfffffffd,
0x00000000, 0x0000000c)
 
/* MSB one small positive and one small negative number on a moderate
positive total */
TEST_MSB (0x00000000, 0xffffffff,
0x00000002, 0xfffffffd,
0x00000001, 0x00000005)
 
/* MSB one small positive and one small negative number on a large
positive total */
TEST_MSB (0x7fffffff, 0xfffffff9,
0x00000002, 0xfffffffd,
0x7fffffff, 0xffffffff)
 
/* MSB one small positive and one small negative number on a small
negative total */
TEST_MSB (0xffffffff, 0xfffffff9,
0x00000002, 0xfffffffd,
0xffffffff, 0xffffffff)
 
/* MSB one small positive and one small negative number on a moderate
negative total */
TEST_MSB (0xfffffffe, 0xffffffff,
0x00000002, 0xfffffffd,
0xffffffff, 0x00000005)
 
/* MSB one small positive and one small negative number on a large
negative total */
TEST_MSB (0x80000000, 0x00000000,
0x00000002, 0xfffffffd,
0x80000000, 0x00000006)
 
PUTC ('\n')
 
/* MSB one moderate positive and one moderate negative number on a
zero total */
TEST_MSB (0x00000000, 0x00000000,
0x00008000, 0xffff0000,
0x00000000, 0x80000000)
 
/* MSB one moderate positive and one moderate negative number on a
small positive total */
TEST_MSB (0x00000000, 0x00000006,
0x00008000, 0xffff0000,
0x00000000, 0x80000006)
 
/* MSB one moderate positive and one moderate negative number on a
moderate positive total */
TEST_MSB (0x00000000, 0x80000000,
0x00008000, 0xffff0000,
0x00000001, 0x00000000)
 
/* MSB one moderate positive and one moderate negative number on a
large positive total */
TEST_MSB (0x7fffffff, 0x7fffffff,
0x00008000, 0xffff0000,
0x7fffffff, 0xffffffff)
 
/* MSB one moderate positive and one moderate negative number on a
small negative total */
TEST_MSB (0xffffffff, 0xffffffff,
0x00008000, 0xffff0000,
0x00000000, 0x7fffffff)
 
/* MSB one moderate positive and one moderate negative number on a
moderate negative total */
TEST_MSB (0xfffffffe, 0xffffffff,
0x00008000, 0xffff0000,
0xffffffff, 0x7fffffff)
 
/* MSB one moderate positive and one moderate negative number on a
large negative total */
TEST_MSB (0x80000000, 0x00000000,
0x00008000, 0xffff0000,
0x80000000, 0x80000000)
 
PUTC ('\n')
 
/* ----------------------------------------------------------------------------
* All done
* ------------------------------------------------------------------------- */
_exit:
LOAD_STR (r3, "Test completed\n")
l.jal _puts
l.nop
 
TEST_EXIT
test-code-or1k/inst-set-test/is-mac-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: test-code-or1k/inst-set-test/Makefile.am =================================================================== --- test-code-or1k/inst-set-test/Makefile.am (revision 115) +++ test-code-or1k/inst-set-test/Makefile.am (revision 116) @@ -44,6 +44,7 @@ check_PROGRAMS = is-add-test \ is-div-test \ is-find-test \ + is-mac-test \ is-lws-test \ $(INST_SET_TEST_OLD) @@ -63,6 +64,11 @@ is_find_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld is_find_test_LDADD = inst-set-test.lo +is_mac_test_SOURCES = inst-set-test.h \ + is-mac-test.S +is_mac_test_LDFLAGS = -T$(srcdir)/inst-set-test.ld +is_mac_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
/test-code-or1k/inst-set-test/inst-set-test.h
22,39 → 22,11
with this program. If not, see <http: www.gnu.org/licenses/>. */
 
 
/* ----------------------------------------------------------------------------
* Test coverage
*
* The l.lws instruction was omitted from Or1ksim originally. It is specified
* for ORBIS32, even though it is functionally equivalent to l.lwz.
*
* Having fixed the problem, this is (in good software engineering style), a
* regresison test to go with the fix.
*
* Of course what is really needed is a comprehensive instruction test...
* ------------------------------------------------------------------------- */
 
 
#include "spr-defs.h"
#include "board.h"
 
/* ----------------------------------------------------------------------------
* Coding conventions
*
* A simple rising stack is provided starting at _stack and pointed to by
* r1. r1 points to the next free word. Only 32-bit registers may be pushed
* onto the stack.
*
* Local labels up to 49 are reserved for macros. Each is used only once in
* all macros. You can get in a serious mess if you get local label clashing
* in macros.
*
* Arguments to functions are passed in r3 through r8.
* r9 is the link (return address)
* r11 is for returning results
*
* Only r1 and r2 are preserved across function calls. It is up to the callee
* to save any other registers required.
* Coding conventions are described in inst-set-test.S
* ------------------------------------------------------------------------- */
 
 
142,9 → 114,35
l.nop NOP_PUTC
/* ----------------------------------------------------------------------------
* Macro to print a string
*
* Arguments:
* s The string to print
* ------------------------------------------------------------------------- */
#define PUTS(s) \
LOAD_STR (r3, s) ;\
PUSH (r9) ;\
l.jal _puts ;\
l.nop ;\
POP (r9)
/* ----------------------------------------------------------------------------
* Macro to print a hex value
*
* Arguments:
* v The value to print
* ------------------------------------------------------------------------- */
#define PUTH(v) \
LOAD_CONST (r3, v) ;\
PUSH (r9) ;\
l.jal _puth ;\
l.nop ;\
POP (r9)
/* ----------------------------------------------------------------------------
* Macro for recording the result of a test
*
* The test result is in r4. Print out the name of test indented two spaces,
* The test result is in reg. Print out the name of test indented two spaces,
* followed by ": ", either "OK" or "Failed" and a newline.
*
* Arguments:
253,6 → 251,71
9:
 
/* ----------------------------------------------------------------------------
* Macro for recording the result of a test (in two regs)
*
* The test result is in reg1 and reg2. Print out the name of test indented
* two spaces, followed by ": ", either "OK" or "Failed" and a newline.
*
* Arguments:
* str Textual name of the test
* reg1 The result to test (not r2)
* reg2 The result to test (not r2)
* val1 Desired result of the test
* val2 Desired result of the test
* ------------------------------------------------------------------------- */
#define CHECK_RES2(reg1, reg2, val1, val2) \
PUSH (reg2) /* Save the test registers */ ;\
PUSH (reg1) ;\
;\
LOAD_CONST(r2,val1) /* First desired result */ ;\
POP (reg1) /* First register to test */ ;\
PUSH (reg1) /* May need again later */ ;\
l.sfeq r2,reg1 /* Does the result match? */ ;\
l.bf 10f ;\
l.nop ;\
;\
/* First register failed. */ ;\
l.jal _pfail /* Test failed */ ;\
l.nop ;\
POP (reg1) /* Report the registers */ ;\
l.add r3,r0,reg1 ;\
l.nop NOP_REPORT ;\
POP (reg2) /* Report the registers */ ;\
l.add r3,r0,reg2 ;\
l.j 12f ;\
l.nop NOP_REPORT ;\
;\
/* First register matched, check the second */ ;\
10: ;\
LOAD_CONST(r2,val2) /* Second desired result */ ;\
POP (reg1) /* First register to test */ ;\
POP (reg2) /* Second register to test */ ;\
PUSH (reg2) /* May need again later */ ;\
PUSH (reg1) /* May need again later */ ;\
l.sfeq r2,reg2 /* Does the result match? */ ;\
l.bf 11f ;\
l.nop ;\
;\
/* Second register failed. */ ;\
l.jal _pfail /* Test failed */ ;\
l.nop ;\
POP (reg1) /* Report the registers */ ;\
l.add r3,r0,reg1 ;\
l.nop NOP_REPORT ;\
POP (reg2) /* Report the registers */ ;\
l.add r3,r0,reg2 ;\
l.j 12f ;\
l.nop NOP_REPORT ;\
;\
/* Both registers passed */ ;\
11: ;\
POP (reg1) /* Discard the registers */ ;\
POP (reg2) /* Discard the registers */ ;\
l.jal _pok /* Test succeeded */ ;\
l.nop ;\
12:
/* ----------------------------------------------------------------------------
* Macro to report 0xdeaddead and then terminate
* ------------------------------------------------------------------------- */
#define TEST_EXIT \
/test-code-or1k/inst-set-test/is-div-test.S
23,22 → 23,7
*/
 
/* ----------------------------------------------------------------------------
* Coding conventions
*
* A simple rising stack is provided starting at _stack and pointed to by
* r1. r1 points to the next free word. Only 32-bit registers may be pushed
* onto the stack.
*
* Local labels up to 49 are reserved for macros. Each is used only once in
* all macros. You can get in a serious mess if you get local label clashing
* in macros.
*
* Arguments to functions are passed in r3 through r8.
* r9 is the link (return address)
* r11 is for returning results
*
* Only r1 and r2 are preserved across function calls. It is up to the callee
* to save any other registers required.
* Coding conventions are described in inst-set-test.S
* ------------------------------------------------------------------------- */
 
/* ----------------------------------------------------------------------------
/test-code-or1k/inst-set-test/is-lws-test.S
23,22 → 23,7
*/
 
/* ----------------------------------------------------------------------------
* Coding conventions
*
* A simple rising stack is provided starting at _stack and pointed to by
* r1. r1 points to the next free word. Only 32-bit registers may be pushed
* onto the stack.
*
* Local labels up to 49 are reserved for macros. Each is used only once in
* all macros. You can get in a serious mess if you get local label clashing
* in macros.
*
* Arguments to functions are passed in r3 through r8.
* r9 is the link (return address)
* r11 is for returning results
*
* Only r1 and r2 are preserved across function calls. It is up to the callee
* to save any other registers required.
* Coding conventions are described in inst-set-test.S
* ------------------------------------------------------------------------- */
 
/* ----------------------------------------------------------------------------
/test-code-or1k/ChangeLog
1,3 → 1,16
2010-06-11 Jeremy Bennett <jeremy.bennett@embecosm.com>
* inst-set-test/inst-set-test.h: Calling conventions updated.
<CHECK_RES2>: New macro created.
<PUTS>: New macro created.
<PUTH>: New macro created.
* inst-set-test/inst-set-test.S: New calling convention
implemented throughout.
(puth): Created.
* inst-set-test/is-mac-test.S: Created.
* inst-set-test/Makefile.am: Updated for new tests
* inst-set-test/Makefile.in: Regenerated.
* mul/mul.c: Corrected expected results.
 
2010-06-10 Jeremy Bennett <jeremy.bennett@embecosm.com>
* inst-set-test/is-add-test.S: Commenting corrected.
* inst-set-test/is-find-test.S: Created.
/test-code-or1k/mul/mul.c
30,8 → 30,8
#include "support.h"
 
#define T1 0xa6312f33
#define T2 0x0d4de375
#define T3 0x61ab48dc
#define T2 0x059b8f08
#define T3 0x00000000
 
#define MAC(x,y) asm volatile ("l.mac\t%0,%1" : : "r" (x), "r" (y))
#define MACRC macrc()
/or1ksim.tests/inst-set-test.exp
283,3 → 283,220
"!report(0xdeaddead);" \
"!exit(0)"] \
"inst-set-test.cfg" "inst-set-test/is-lws-test"
 
# Run the l.mac test
run_or1ksim "mac-test" \
[list "!l.mac" \
" 0x00000000 00000000 + 0x00000002 * 0x00000003 = 0x00000000 00000006: OK" \
" 0x00000000 00000006 + 0x00000002 * 0x00000003 = 0x00000000 0000000c: OK" \
" 0x00000000 fffffffa + 0x00000002 * 0x00000003 = 0x00000001 00000000: OK" \
" 0x3fffffff fffffffa + 0x00000002 * 0x00000003 = 0x40000000 00000000: OK" \
" 0xffffffff fffffffa + 0x00000002 * 0x00000003 = 0x00000000 00000000: OK" \
" 0xffffffff 00000000 + 0x00000002 * 0x00000003 = 0xffffffff 00000006: OK" \
" 0x80000000 00000000 + 0x00000002 * 0x00000003 = 0x80000000 00000006: OK" \
"!" \
" 0x00000000 00000000 + 0x00008001 * 0x0000fffe = 0x00000000 7ffffffe: OK" \
" 0x00000000 00000002 + 0x00008001 * 0x0000fffe = 0x00000000 80000000: OK" \
" 0x00000000 80000002 + 0x00008001 * 0x0000fffe = 0x00000001 00000000: OK" \
" 0x7fffffff 80000001 + 0x00008001 * 0x0000fffe = 0x7fffffff ffffffff: OK" \
" 0xffffffff ffffffff + 0x00008001 * 0x0000fffe = 0x00000000 7ffffffd: OK" \
" 0xffffffff 80000002 + 0x00008001 * 0x0000fffe = 0x00000000 00000000: OK" \
" 0xfffffffe 80000002 + 0x00008001 * 0x0000fffe = 0xffffffff 00000000: OK" \
"!" \
" 0x00000000 00000000 + 0xfffffffe * 0xfffffffd = 0x00000000 00000006: OK" \
" 0x00000000 00000006 + 0xfffffffe * 0xfffffffd = 0x00000000 0000000c: OK" \
" 0xffffffff ffffffff + 0xfffffffe * 0xfffffffd = 0x00000000 00000005: OK" \
"!" \
" 0x00000000 00000000 + 0x00000002 * 0xfffffffd = 0xffffffff fffffffa: OK" \
" 0x00000000 0000000c + 0x00000002 * 0xfffffffd = 0x00000000 00000006: OK" \
" 0x00000001 00000005 + 0x00000002 * 0xfffffffd = 0x00000000 ffffffff: OK" \
" 0x7fffffff ffffffff + 0x00000002 * 0xfffffffd = 0x7fffffff fffffff9: OK" \
" 0xffffffff ffffffff + 0x00000002 * 0xfffffffd = 0xffffffff fffffff9: OK" \
" 0xffffffff 00000005 + 0x00000002 * 0xfffffffd = 0xfffffffe ffffffff: OK" \
" 0x80000000 00000006 + 0x00000002 * 0xfffffffd = 0x80000000 00000000: OK" \
"!" \
" 0x00000000 00000000 + 0x00008000 * 0xffff0000 = 0xffffffff 80000000: OK" \
" 0x00000000 00000006 + 0x00008000 * 0xffff0000 = 0xffffffff 80000006: OK" \
" 0x00000000 80000000 + 0x00008000 * 0xffff0000 = 0x00000000 00000000: OK" \
" 0x7fffffff ffffffff + 0x00008000 * 0xffff0000 = 0x7fffffff 7fffffff: OK" \
" 0xffffffff ffffffff + 0x00008000 * 0xffff0000 = 0xffffffff 7fffffff: OK" \
" 0xffffffff 7fffffff + 0x00008000 * 0xffff0000 = 0xfffffffe ffffffff: OK" \
" 0x80000000 80000000 + 0x00008000 * 0xffff0000 = 0x80000000 00000000: OK" \
"!" \
"l.maci" \
" 0x00000000 00000000 + 0x00000002 * 0x00000003 = 0x00000000 00000006: OK" \
" 0x00000000 00000006 + 0x00000002 * 0x00000003 = 0x00000000 0000000c: OK" \
" 0x00000000 fffffffa + 0x00000002 * 0x00000003 = 0x00000001 00000000: OK" \
" 0x3fffffff fffffffa + 0x00000002 * 0x00000003 = 0x40000000 00000000: OK" \
" 0xffffffff fffffffa + 0x00000002 * 0x00000003 = 0x00000000 00000000: OK" \
" 0xffffffff 00000000 + 0x00000002 * 0x00000003 = 0xffffffff 00000006: OK" \
" 0x80000000 00000000 + 0x00000002 * 0x00000003 = 0x80000000 00000006: OK" \
"!" \
" 0x00000000 00000000 + 0x00010002 * 0x00007fff = 0x00000000 7ffffffe: OK" \
" 0x00000000 00000002 + 0x00010002 * 0x00007fff = 0x00000000 80000000: OK" \
" 0x00000000 80000002 + 0x00010002 * 0x00007fff = 0x00000001 00000000: OK" \
" 0x7fffffff 80000001 + 0x00010002 * 0x00007fff = 0x7fffffff ffffffff: OK" \
" 0xffffffff ffffffff + 0x00010002 * 0x00007fff = 0x00000000 7ffffffd: OK" \
" 0xffffffff 80000002 + 0x00010002 * 0x00007fff = 0x00000000 00000000: OK" \
" 0xfffffffe 80000002 + 0x00010002 * 0x00007fff = 0xffffffff 00000000: OK" \
"!" \
" 0x00000000 00000000 + 0xfffffffe * 0x0000fffd = 0x00000000 00000006: OK" \
" 0x00000000 00000006 + 0xfffffffe * 0x0000fffd = 0x00000000 0000000c: OK" \
" 0xffffffff ffffffff + 0xfffffffe * 0x0000fffd = 0x00000000 00000005: OK" \
"!" \
" 0x00000000 00000000 + 0x00000002 * 0x0000fffd = 0xffffffff fffffffa: OK" \
" 0x00000000 0000000c + 0x00000002 * 0x0000fffd = 0x00000000 00000006: OK" \
" 0x00000001 00000005 + 0x00000002 * 0x0000fffd = 0x00000000 ffffffff: OK" \
" 0x7fffffff ffffffff + 0x00000002 * 0x0000fffd = 0x7fffffff fffffff9: OK" \
" 0xffffffff ffffffff + 0x00000002 * 0x0000fffd = 0xffffffff fffffff9: OK" \
" 0xffffffff 00000005 + 0x00000002 * 0x0000fffd = 0xfffffffe ffffffff: OK" \
" 0x80000000 00000006 + 0x00000002 * 0x0000fffd = 0x80000000 00000000: OK" \
"!" \
" 0x00000000 00000000 + 0x00010000 * 0x00008000 = 0xffffffff 80000000: OK" \
" 0x00000000 00000006 + 0x00010000 * 0x00008000 = 0xffffffff 80000006: OK" \
" 0x00000000 80000000 + 0x00010000 * 0x00008000 = 0x00000000 00000000: OK" \
" 0x7fffffff ffffffff + 0x00010000 * 0x00008000 = 0x7fffffff 7fffffff: OK" \
" 0xffffffff ffffffff + 0x00010000 * 0x00008000 = 0xffffffff 7fffffff: OK" \
" 0xffffffff 7fffffff + 0x00010000 * 0x00008000 = 0xfffffffe ffffffff: OK" \
" 0x80000000 80000000 + 0x00010000 * 0x00008000 = 0x80000000 00000000: OK" \
"!" \
"l.macrc" \
" 0x00000000 00000000 + 0x00000002 * 0x00000003 = 0x00000006: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 00000006 + 0x00000002 * 0x00000003 = 0x0000000c: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 fffffffa + 0x00000002 * 0x00000003 = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x3fffffff fffffffa + 0x00000002 * 0x00000003 = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff fffffffa + 0x00000002 * 0x00000003 = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff 00000000 + 0x00000002 * 0x00000003 = 0x00000006: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x80000000 00000000 + 0x00000002 * 0x00000003 = 0x00000006: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
"!" \
" 0x00000000 00000000 + 0x00008001 * 0x0000fffe = 0x7ffffffe: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 00000002 + 0x00008001 * 0x0000fffe = 0x80000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 80000002 + 0x00008001 * 0x0000fffe = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x7fffffff 80000001 + 0x00008001 * 0x0000fffe = 0xffffffff: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff ffffffff + 0x00008001 * 0x0000fffe = 0x7ffffffd: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff 80000002 + 0x00008001 * 0x0000fffe = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xfffffffe 80000002 + 0x00008001 * 0x0000fffe = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
"!" \
" 0x00000000 00000000 + 0xfffffffe * 0xfffffffd = 0x00000006: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 00000006 + 0xfffffffe * 0xfffffffd = 0x0000000c: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff ffffffff + 0xfffffffe * 0xfffffffd = 0x00000005: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
"!" \
" 0x00000000 00000000 + 0x00000002 * 0xfffffffd = 0xfffffffa: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 0000000c + 0x00000002 * 0xfffffffd = 0x00000006: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000001 00000005 + 0x00000002 * 0xfffffffd = 0xffffffff: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x7fffffff ffffffff + 0x00000002 * 0xfffffffd = 0xfffffff9: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff ffffffff + 0x00000002 * 0xfffffffd = 0xfffffff9: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff 00000005 + 0x00000002 * 0xfffffffd = 0xffffffff: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x80000000 00000006 + 0x00000002 * 0xfffffffd = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
"!" \
" 0x00000000 00000000 + 0x00008000 * 0xffff0000 = 0x80000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 00000006 + 0x00008000 * 0xffff0000 = 0x80000006: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x00000000 80000000 + 0x00008000 * 0xffff0000 = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x7fffffff ffffffff + 0x00008000 * 0xffff0000 = 0x7fffffff: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff ffffffff + 0x00008000 * 0xffff0000 = 0x7fffffff: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0xffffffff 7fffffff + 0x00008000 * 0xffff0000 = 0xffffffff: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
" 0x80000000 80000000 + 0x00008000 * 0xffff0000 = 0x00000000: OK" \
" - MACHI cleared" \
" - MACLO cleared" \
"!" \
"l.msb" \
" 0x00000000 00000000 - 0x00000002 * 0x00000003 = 0xffffffff fffffffa: OK" \
" 0x00000000 0000000c - 0x00000002 * 0x00000003 = 0x00000000 00000006: OK" \
" 0x00000001 00000000 - 0x00000002 * 0x00000003 = 0x00000000 fffffffa: OK" \
" 0x40000000 00000000 - 0x00000002 * 0x00000003 = 0x3fffffff fffffffa: OK" \
" 0xffffffff fffffffa - 0x00000002 * 0x00000003 = 0xffffffff fffffff4: OK" \
" 0xffffffff 00000005 - 0x00000002 * 0x00000003 = 0xfffffffe ffffffff: OK" \
" 0x80000000 00000006 - 0x00000002 * 0x00000003 = 0x80000000 00000000: OK" \
"!" \
" 0x00000000 00000000 - 0x00008001 * 0x0000fffe = 0xffffffff 80000002: OK" \
" 0x00000000 00000002 - 0x00008001 * 0x0000fffe = 0xffffffff 80000004: OK" \
" 0x00000000 80000002 - 0x00008001 * 0x0000fffe = 0x00000000 00000004: OK" \
" 0x7fffffff 7ffffffd - 0x00008001 * 0x0000fffe = 0x7ffffffe ffffffff: OK" \
" 0xffffffff ffffffff - 0x00008001 * 0x0000fffe = 0xffffffff 80000001: OK" \
" 0xffffffff 80000002 - 0x00008001 * 0x0000fffe = 0xffffffff 00000004: OK" \
" 0xfffffffe 80000002 - 0x00008001 * 0x0000fffe = 0xfffffffe 00000004: OK" \
"!" \
" 0x00000000 00000006 - 0xfffffffe * 0xfffffffd = 0x00000000 00000000: OK" \
" 0x00000000 0000000c - 0xfffffffe * 0xfffffffd = 0x00000000 00000006: OK" \
" 0xffffffff ffffffff - 0xfffffffe * 0xfffffffd = 0xffffffff fffffff9: OK" \
"!" \
" 0x00000000 00000000 - 0x00000002 * 0xfffffffd = 0x00000000 00000006: OK" \
" 0x00000000 00000006 - 0x00000002 * 0xfffffffd = 0x00000000 0000000c: OK" \
" 0x00000000 ffffffff - 0x00000002 * 0xfffffffd = 0x00000001 00000005: OK" \
" 0x7fffffff fffffff9 - 0x00000002 * 0xfffffffd = 0x7fffffff ffffffff: OK" \
" 0xffffffff fffffff9 - 0x00000002 * 0xfffffffd = 0xffffffff ffffffff: OK" \
" 0xfffffffe ffffffff - 0x00000002 * 0xfffffffd = 0xffffffff 00000005: OK" \
" 0x80000000 00000000 - 0x00000002 * 0xfffffffd = 0x80000000 00000006: OK" \
"!" \
" 0x00000000 00000000 - 0x00008000 * 0xffff0000 = 0x00000000 80000000: OK" \
" 0x00000000 00000006 - 0x00008000 * 0xffff0000 = 0x00000000 80000006: OK" \
" 0x00000000 80000000 - 0x00008000 * 0xffff0000 = 0x00000001 00000000: OK" \
" 0x7fffffff 7fffffff - 0x00008000 * 0xffff0000 = 0x7fffffff ffffffff: OK" \
" 0xffffffff ffffffff - 0x00008000 * 0xffff0000 = 0x00000000 7fffffff: OK" \
" 0xfffffffe ffffffff - 0x00008000 * 0xffff0000 = 0xffffffff 7fffffff: OK" \
" 0x80000000 00000000 - 0x00008000 * 0xffff0000 = 0x80000000 80000000: OK" \
"!" \
"!Test completed" \
"!report(0xdeaddead);" \
"!exit(0)"] \
"inst-set-test.cfg" "inst-set-test/is-mac-test"
/or1ksim.tests/mul.exp
27,10 → 27,10
# Run the multiplication test
run_or1ksim "mul" \
[list "00000000" \
"70a2588c" \
"cac28a17" \
"a6312f33, expected a6312f33" \
"0d4de375, expected 0d4de375" \
"61ab48dc, expected 61ab48dc" \
"059b8f08, expected 059b8f08" \
"00000000, expected 00000000" \
"!report(0xdeaddead);" \
"!Test succesful." \
"!exit(0)"] \
/ChangeLog
1,3 → 1,8
2010-06-11 Jeremy Bennett <jeremy.bennett@embecosm.com>
* or1ksim.tests/inst-set-test.exp: Added MAC tests.
* or1ksim.tests/mul.exp: Corrected erroneous expected results.
* README: Updated with new tests.
 
2010-06-10 Jeremy Bennett <jeremy.bennett@embecosm.com>
* or1ksim.tests/inst-set-test.exp: Added find tests.
* README: Updated with new tests.
/README
12,9 → 12,9
Tests are provided for the standalone simulator (or1ksim) and for the library
(libsim.a).
 
At the time of writing a total of 1,261 tests compile, run and pass. That
figure is broken down into 997 tests of the standalone simulator and 264 tests
of the library
At the time of writing a total of 1,450 tests compile, run and pass. That
figure is broken down into 1,186 tests of the standalone simulator and 264
tests of the library
 
Configuration and make files are provided for further test programs. These
come in three categories.
46,7 → 46,7
Working tests
=============
 
A total of 997 tests of standalone Or1ksim:
A total of 1,186 tests of standalone Or1ksim:
 
basic: 8 tests of a wide range of instructions and registers.
cache: 5 tests of the Or1ksim cache modeling
70,6 → 70,7
is-div-test: 4 tests of the l.div and l.divu instructions (Bug 1770).
is-find-test: 14 tests of the l.ff1 and l.fl1 instructions (Bug 1772).
is-lws-test: 13 tests of the l.lws instruction (Bug 1767).
is-mac-test: 189 tests of the MAC instructions (Bug 1773).
mem-test: 16 tests of simple memory access.
mmu: 110 tests of the MMU.
mul: 5 tests of the multiply functionality.

powered by: WebSVN 2.1.0

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