/* is-mac-test.S. l.mac, l.maci, l.macrc and l.msb instruction test of Or1ksim
|
/* is-mac-test.S. l.mac, l.maci, l.macrc and l.msb instruction test of Or1ksim
|
*
|
*
|
* Copyright (C) 1999-2006 OpenCores
|
* Copyright (C) 1999-2006 OpenCores
|
* Copyright (C) 2010 Embecosm Limited
|
* Copyright (C) 2010 Embecosm Limited
|
*
|
*
|
* Contributors various OpenCores participants
|
* Contributors various OpenCores participants
|
* Contributor Jeremy Bennett
|
* Contributor Jeremy Bennett
|
*
|
*
|
* This file is part of OpenRISC 1000 Architectural Simulator.
|
* This file is part of OpenRISC 1000 Architectural Simulator.
|
*
|
*
|
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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)
|
* Software Foundation; either version 3 of the License, or (at your option)
|
* any later version.
|
* any later version.
|
*
|
*
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* more details.
|
* more details.
|
*
|
*
|
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
* with this program. If not, see .
|
* with this program. If not, see .
|
*/
|
*/
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* Coding conventions are described in inst-set-test.S
|
* Coding conventions are described in inst-set-test.S
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* Test coverage
|
* Test coverage
|
*
|
*
|
* The l.add, l.addc, l.addi and l.addic instructions should set the carry and
|
* The l.mac, l.maci, l.macrc and l.msb instructions perform operations related
|
* overflow flags.
|
* to combined signed multiply and addition/subtraction.
|
*
|
*
|
* In addition the l.addc and l.addic instructions should add in the carry
|
* The precise definition of these instructions is in flux. In addition there
|
* bit.
|
* are known problems with the assembler/disassembler (will not correctly
|
|
* handle l.maci) and with the Verilog RTL implementation (not functional).
|
*
|
*
|
* Problems in this area were reported in Bugs 1771 and 1776. Having fixed the
|
* Problems in this area were reported in Bugs 1773 and 1777. Having fixed the
|
* problem, this is (in good software engineering style), a regression test
|
* problem, this is (in good software engineering style), a regression test
|
* to go with the fix.
|
* to go with the fix.
|
*
|
*
|
* This is not a comprehensive test of any instruction (yet).
|
* This is not a comprehensive test of any instruction (yet).
|
*
|
*
|
* Of course what is really needed is a comprehensive instruction test...
|
* Of course what is really needed is a comprehensive instruction test...
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
|
|
|
|
#include "inst-set-test.h"
|
#include "inst-set-test.h"
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* A macro to carry out a test of multiply accumulate read and clear
|
* A macro to carry out a test of multiply accumulate read and clear
|
*
|
*
|
* Arguments
|
* Arguments
|
* machi: Inital value of MACHI
|
* machi: Inital value of MACHI
|
* maclo: Inital value of MACLO
|
* maclo: Inital value of MACLO
|
* op1: First operand value
|
* op1: First operand value
|
* op2: Second operand value
|
* op2: Second operand value
|
* res: Expected result
|
* res: Expected result
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
#define TEST_MACRC(machi, maclo, op1, op2, res) \
|
#define TEST_MACRC(machi, maclo, op1, op2, res) \
|
LOAD_CONST (r2,maclo) ;\
|
LOAD_CONST (r2,maclo) ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
LOAD_CONST (r2,machi) ;\
|
LOAD_CONST (r2,machi) ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
;\
|
;\
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
LOAD_CONST (r6,op2) ;\
|
LOAD_CONST (r6,op2) ;\
|
l.mac r5,r6 ;\
|
l.mac r5,r6 ;\
|
l.macrc r4 ;\
|
l.macrc r4 ;\
|
PUSH (r4) /* Save for later */ ;\
|
PUSH (r4) /* Save for later */ ;\
|
PUTS (" 0x") ;\
|
PUTS (" 0x") ;\
|
PUTH (machi) ;\
|
PUTH (machi) ;\
|
PUTS (" ") ;\
|
PUTS (" ") ;\
|
PUTH (maclo) ;\
|
PUTH (maclo) ;\
|
PUTS (" + 0x") ;\
|
PUTS (" + 0x") ;\
|
PUTH (op1) ;\
|
PUTH (op1) ;\
|
PUTS (" * 0x") ;\
|
PUTS (" * 0x") ;\
|
PUTH (op2) ;\
|
PUTH (op2) ;\
|
PUTS (" = 0x") ;\
|
PUTS (" = 0x") ;\
|
PUTH (res) ;\
|
PUTH (res) ;\
|
PUTS (": ") ;\
|
PUTS (": ") ;\
|
POP (r4) ;\
|
POP (r4) ;\
|
CHECK_RES ("", r4, res) ;\
|
CHECK_RES ("", r4, res) ;\
|
;\
|
;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.sfne r5,r0 ;\
|
l.sfne r5,r0 ;\
|
l.bf 50f ;\
|
l.bf 50f ;\
|
;\
|
;\
|
PUTS (" - MACHI cleared\n") ;\
|
PUTS (" - MACHI cleared\n") ;\
|
;\
|
;\
|
50: l.mfspr r6,r0,SPR_MACLO ;\
|
50: l.mfspr r6,r0,SPR_MACLO ;\
|
l.sfne r6,r0 ;\
|
l.sfne r6,r0 ;\
|
l.bf 51f ;\
|
l.bf 51f ;\
|
;\
|
;\
|
PUTS (" - MACLO cleared\n") ;\
|
PUTS (" - MACLO cleared\n") ;\
|
51:
|
51:
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* A macro to carry out a test of multiply accumulate in registers
|
* A macro to carry out a test of multiply accumulate in registers
|
*
|
*
|
* Arguments
|
* Arguments
|
* machi: Inital value of MACHI
|
* machi: Inital value of MACHI
|
* maclo: Inital value of MACLO
|
* maclo: Inital value of MACLO
|
* op1: First operand value
|
* op1: First operand value
|
* op2: Second operand value
|
* op2: Second operand value
|
* reshi: Expected result
|
* reshi: Expected result
|
* reslo: Expected result
|
* reslo: Expected result
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
#define TEST_MAC(machi, maclo, op1, op2, reshi, reslo) \
|
#define TEST_MAC(machi, maclo, op1, op2, reshi, reslo) \
|
LOAD_CONST (r2,maclo) ;\
|
LOAD_CONST (r2,maclo) ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
LOAD_CONST (r2,machi) ;\
|
LOAD_CONST (r2,machi) ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
;\
|
;\
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
LOAD_CONST (r6,op2) ;\
|
LOAD_CONST (r6,op2) ;\
|
l.mac r5,r6 ;\
|
l.mac r5,r6 ;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.mfspr r6,r0,SPR_MACLO ;\
|
l.mfspr r6,r0,SPR_MACLO ;\
|
PUSH (r5) /* Save for later */ ;\
|
PUSH (r5) /* Save for later */ ;\
|
PUSH (r6) ;\
|
PUSH (r6) ;\
|
PUTS (" 0x") ;\
|
PUTS (" 0x") ;\
|
PUTH (machi) ;\
|
PUTH (machi) ;\
|
PUTS (" ") ;\
|
PUTS (" ") ;\
|
PUTH (maclo) ;\
|
PUTH (maclo) ;\
|
PUTS (" + 0x") ;\
|
PUTS (" + 0x") ;\
|
PUTH (op1) ;\
|
PUTH (op1) ;\
|
PUTS (" * 0x") ;\
|
PUTS (" * 0x") ;\
|
PUTH (op2) ;\
|
PUTH (op2) ;\
|
PUTS (" = 0x") ;\
|
PUTS (" = 0x") ;\
|
PUTH (reshi) ;\
|
PUTH (reshi) ;\
|
PUTS (" ") ;\
|
PUTS (" ") ;\
|
PUTH (reslo) ;\
|
PUTH (reslo) ;\
|
PUTS (": ") ;\
|
PUTS (": ") ;\
|
POP (r6) ;\
|
POP (r6) ;\
|
POP (r5) ;\
|
POP (r5) ;\
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* A macro to carry out a test of multiply accumulate with immediate arg
|
* 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
|
* There is currently a bug in the assembler, so we must hand construct
|
* l.maci r5,op1.
|
* l.maci r5,op1.
|
*
|
*
|
* Arguments
|
* Arguments
|
* machi: Inital value of MACHI
|
* machi: Inital value of MACHI
|
* maclo: Inital value of MACLO
|
* maclo: Inital value of MACLO
|
* op1: First operand value
|
* op1: First operand value
|
* op2: Second operand value
|
* op2: Second operand value
|
* reshi: Expected result
|
* reshi: Expected result
|
* reslo: Expected result
|
* reslo: Expected result
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
#define TEST_MACI(machi, maclo, op1, op2, reshi, reslo) \
|
#define TEST_MACI(machi, maclo, op1, op2, reshi, reslo) \
|
LOAD_CONST (r2,maclo) ;\
|
LOAD_CONST (r2,maclo) ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
LOAD_CONST (r2,machi) ;\
|
LOAD_CONST (r2,machi) ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
;\
|
;\
|
LOAD_CONST (r5,op1) /* Load number to add */ ;\
|
LOAD_CONST (r5,op1) /* Load number to add */ ;\
|
.word (0x4c050000|op2) /* l.maci r5,op2 */ ;\
|
.word (0x4c050000|op2) /* l.maci r5,op2 */ ;\
|
/* l.maci r5,op2 */ ;\
|
/* l.maci r5,op2 */ ;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.mfspr r6,r0,SPR_MACLO ;\
|
l.mfspr r6,r0,SPR_MACLO ;\
|
PUSH (r5) /* Save for later */ ;\
|
PUSH (r5) /* Save for later */ ;\
|
PUSH (r6) ;\
|
PUSH (r6) ;\
|
PUTS (" 0x") ;\
|
PUTS (" 0x") ;\
|
PUTH (machi) ;\
|
PUTH (machi) ;\
|
PUTS (" ") ;\
|
PUTS (" ") ;\
|
PUTH (maclo) ;\
|
PUTH (maclo) ;\
|
PUTS (" + 0x") ;\
|
PUTS (" + 0x") ;\
|
PUTH (op1) ;\
|
PUTH (op1) ;\
|
PUTS (" * 0x") ;\
|
PUTS (" * 0x") ;\
|
PUTH (op2) ;\
|
PUTH (op2) ;\
|
PUTS (" = 0x") ;\
|
PUTS (" = 0x") ;\
|
PUTH (reshi) ;\
|
PUTH (reshi) ;\
|
PUTS (" ") ;\
|
PUTS (" ") ;\
|
PUTH (reslo) ;\
|
PUTH (reslo) ;\
|
PUTS (": ") ;\
|
PUTS (": ") ;\
|
POP (r6) ;\
|
POP (r6) ;\
|
POP (r5) ;\
|
POP (r5) ;\
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* A macro to carry out a test of multiply and subract
|
* A macro to carry out a test of multiply and subract
|
*
|
*
|
* Arguments
|
* Arguments
|
* machi: Inital value of MACHI
|
* machi: Inital value of MACHI
|
* maclo: Inital value of MACLO
|
* maclo: Inital value of MACLO
|
* op1: First operand value
|
* op1: First operand value
|
* op2: Second operand value
|
* op2: Second operand value
|
* reshi: Expected result
|
* reshi: Expected result
|
* reslo: Expected result
|
* reslo: Expected result
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
#define TEST_MSB(machi, maclo, op1, op2, reshi, reslo) \
|
#define TEST_MSB(machi, maclo, op1, op2, reshi, reslo) \
|
LOAD_CONST (r2,maclo) ;\
|
LOAD_CONST (r2,maclo) ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
l.mtspr r0,r2,SPR_MACLO ;\
|
LOAD_CONST (r2,machi) ;\
|
LOAD_CONST (r2,machi) ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
l.mtspr r0,r2,SPR_MACHI ;\
|
;\
|
;\
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
LOAD_CONST (r6,op2) ;\
|
LOAD_CONST (r6,op2) ;\
|
l.msb r5,r6 ;\
|
l.msb r5,r6 ;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.mfspr r5,r0,SPR_MACHI ;\
|
l.mfspr r6,r0,SPR_MACLO ;\
|
l.mfspr r6,r0,SPR_MACLO ;\
|
PUSH (r5) /* Save for later */ ;\
|
PUSH (r5) /* Save for later */ ;\
|
PUSH (r6) ;\
|
PUSH (r6) ;\
|
PUTS (" 0x") ;\
|
PUTS (" 0x") ;\
|
PUTH (machi) ;\
|
PUTH (machi) ;\
|
PUTS (" ") ;\
|
PUTS (" ") ;\
|
PUTH (maclo) ;\
|
PUTH (maclo) ;\
|
PUTS (" - 0x") ;\
|
PUTS (" - 0x") ;\
|
PUTH (op1) ;\
|
PUTH (op1) ;\
|
PUTS (" * 0x") ;\
|
PUTS (" * 0x") ;\
|
PUTH (op2) ;\
|
PUTH (op2) ;\
|
PUTS (" = 0x") ;\
|
PUTS (" = 0x") ;\
|
PUTH (reshi) ;\
|
PUTH (reshi) ;\
|
PUTS (" ") ;\
|
PUTS (" ") ;\
|
PUTH (reslo) ;\
|
PUTH (reslo) ;\
|
PUTS (": ") ;\
|
PUTS (": ") ;\
|
POP (r6) ;\
|
POP (r6) ;\
|
POP (r5) ;\
|
POP (r5) ;\
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Start of code
|
|
* ------------------------------------------------------------------------- */
|
.section .text
|
.section .text
|
.global _start
|
.global _start
|
_start:
|
_start:
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* Test of multiply signed and accumulate, l.mac
|
* Test of multiply signed and accumulate, l.mac
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
_mac:
|
_mac:
|
LOAD_STR (r3, "l.mac\n")
|
LOAD_STR (r3, "l.mac\n")
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
/* MAC two small positive numbers on a zero total */
|
/* MAC two small positive numbers on a zero total */
|
TEST_MAC (0x00000000, 0x00000000,
|
TEST_MAC (0x00000000, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MAC two small positive numbers on a small positive total */
|
/* MAC two small positive numbers on a small positive total */
|
TEST_MAC (0x00000000, 0x00000006,
|
TEST_MAC (0x00000000, 0x00000006,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000, 0x0000000c)
|
0x00000000, 0x0000000c)
|
|
|
/* MAC two small positive numbers on a moderate positive total */
|
/* MAC two small positive numbers on a moderate positive total */
|
TEST_MAC (0x00000000, 0xfffffffa,
|
TEST_MAC (0x00000000, 0xfffffffa,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000001, 0x00000000)
|
0x00000001, 0x00000000)
|
|
|
/* MAC two small positive numbers on a large positive total */
|
/* MAC two small positive numbers on a large positive total */
|
TEST_MAC (0x3fffffff, 0xfffffffa,
|
TEST_MAC (0x3fffffff, 0xfffffffa,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x40000000, 0x00000000)
|
0x40000000, 0x00000000)
|
|
|
/* MAC two small positive numbers on a small negative total */
|
/* MAC two small positive numbers on a small negative total */
|
TEST_MAC (0xffffffff, 0xfffffffa,
|
TEST_MAC (0xffffffff, 0xfffffffa,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000, 0x00000000)
|
0x00000000, 0x00000000)
|
|
|
/* MAC two small positive numbers on a moderate negative total */
|
/* MAC two small positive numbers on a moderate negative total */
|
TEST_MAC (0xffffffff, 0x00000000,
|
TEST_MAC (0xffffffff, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0xffffffff, 0x00000006)
|
0xffffffff, 0x00000006)
|
|
|
/* MAC two small positive numbers on a large negative total */
|
/* MAC two small positive numbers on a large negative total */
|
TEST_MAC (0x80000000, 0x00000000,
|
TEST_MAC (0x80000000, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x80000000, 0x00000006)
|
0x80000000, 0x00000006)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC two moderate positive numbers on a zero total */
|
/* MAC two moderate positive numbers on a zero total */
|
TEST_MAC (0x00000000, 0x00000000,
|
TEST_MAC (0x00000000, 0x00000000,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000, 0x7ffffffe)
|
0x00000000, 0x7ffffffe)
|
|
|
/* MAC two moderate positive numbers on a small positive total */
|
/* MAC two moderate positive numbers on a small positive total */
|
TEST_MAC (0x00000000, 0x00000002,
|
TEST_MAC (0x00000000, 0x00000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000, 0x80000000)
|
0x00000000, 0x80000000)
|
|
|
/* MAC two moderate positive numbers on a moderate positive total */
|
/* MAC two moderate positive numbers on a moderate positive total */
|
TEST_MAC (0x00000000, 0x80000002,
|
TEST_MAC (0x00000000, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000001, 0x00000000)
|
0x00000001, 0x00000000)
|
|
|
/* MAC two moderate positive numbers on a large positive total */
|
/* MAC two moderate positive numbers on a large positive total */
|
TEST_MAC (0x7fffffff, 0x80000001,
|
TEST_MAC (0x7fffffff, 0x80000001,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x7fffffff, 0xffffffff)
|
0x7fffffff, 0xffffffff)
|
|
|
/* MAC two moderate positive numbers on a small negative total */
|
/* MAC two moderate positive numbers on a small negative total */
|
TEST_MAC (0xffffffff, 0xffffffff,
|
TEST_MAC (0xffffffff, 0xffffffff,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000, 0x7ffffffd)
|
0x00000000, 0x7ffffffd)
|
|
|
/* MAC two moderate positive numbers on a moderate negative total */
|
/* MAC two moderate positive numbers on a moderate negative total */
|
TEST_MAC (0xffffffff, 0x80000002,
|
TEST_MAC (0xffffffff, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000, 0x00000000)
|
0x00000000, 0x00000000)
|
|
|
/* MAC two moderate positive numbers on a large negative total */
|
/* MAC two moderate positive numbers on a large negative total */
|
TEST_MAC (0xfffffffe, 0x80000002,
|
TEST_MAC (0xfffffffe, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0xffffffff, 0x00000000)
|
0xffffffff, 0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC two small negative numbers on a zero total */
|
/* MAC two small negative numbers on a zero total */
|
TEST_MAC (0x00000000, 0x00000000,
|
TEST_MAC (0x00000000, 0x00000000,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MAC two small negative numbers on a small positive total */
|
/* MAC two small negative numbers on a small positive total */
|
TEST_MAC (0x00000000, 0x00000006,
|
TEST_MAC (0x00000000, 0x00000006,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x00000000, 0x0000000c)
|
0x00000000, 0x0000000c)
|
|
|
/* MAC two small negative numbers on a small negative total */
|
/* MAC two small negative numbers on a small negative total */
|
TEST_MAC (0xffffffff, 0xffffffff,
|
TEST_MAC (0xffffffff, 0xffffffff,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x00000000, 0x00000005)
|
0x00000000, 0x00000005)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC one small positive and one small negative number on a zero
|
/* MAC one small positive and one small negative number on a zero
|
total */
|
total */
|
TEST_MAC (0x00000000, 0x00000000,
|
TEST_MAC (0x00000000, 0x00000000,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xffffffff, 0xfffffffa)
|
0xffffffff, 0xfffffffa)
|
|
|
/* MAC one small positive and one small negative number on a small
|
/* MAC one small positive and one small negative number on a small
|
positive total */
|
positive total */
|
TEST_MAC (0x00000000, 0x0000000c,
|
TEST_MAC (0x00000000, 0x0000000c,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MAC one small positive and one small negative number on a moderate
|
/* MAC one small positive and one small negative number on a moderate
|
positive total */
|
positive total */
|
TEST_MAC (0x00000001, 0x00000005,
|
TEST_MAC (0x00000001, 0x00000005,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x00000000, 0xffffffff)
|
0x00000000, 0xffffffff)
|
|
|
/* MAC one small positive and one small negative number on a large
|
/* MAC one small positive and one small negative number on a large
|
positive total */
|
positive total */
|
TEST_MAC (0x7fffffff, 0xffffffff,
|
TEST_MAC (0x7fffffff, 0xffffffff,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x7fffffff, 0xfffffff9)
|
0x7fffffff, 0xfffffff9)
|
|
|
/* MAC one small positive and one small negative number on a small
|
/* MAC one small positive and one small negative number on a small
|
negative total */
|
negative total */
|
TEST_MAC (0xffffffff, 0xffffffff,
|
TEST_MAC (0xffffffff, 0xffffffff,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xffffffff, 0xfffffff9)
|
0xffffffff, 0xfffffff9)
|
|
|
/* MAC one small positive and one small negative number on a moderate
|
/* MAC one small positive and one small negative number on a moderate
|
negative total */
|
negative total */
|
TEST_MAC (0xffffffff, 0x00000005,
|
TEST_MAC (0xffffffff, 0x00000005,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xfffffffe, 0xffffffff)
|
0xfffffffe, 0xffffffff)
|
|
|
/* MAC one small positive and one small negative number on a large
|
/* MAC one small positive and one small negative number on a large
|
negative total */
|
negative total */
|
TEST_MAC (0x80000000, 0x00000006,
|
TEST_MAC (0x80000000, 0x00000006,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x80000000, 0x00000000)
|
0x80000000, 0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
zero total */
|
zero total */
|
TEST_MAC (0x00000000, 0x00000000,
|
TEST_MAC (0x00000000, 0x00000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0xffffffff, 0x80000000)
|
0xffffffff, 0x80000000)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
small positive total */
|
small positive total */
|
TEST_MAC (0x00000000, 0x00000006,
|
TEST_MAC (0x00000000, 0x00000006,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0xffffffff, 0x80000006)
|
0xffffffff, 0x80000006)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
moderate positive total */
|
moderate positive total */
|
TEST_MAC (0x00000000, 0x80000000,
|
TEST_MAC (0x00000000, 0x80000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x00000000, 0x00000000)
|
0x00000000, 0x00000000)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
large positive total */
|
large positive total */
|
TEST_MAC (0x7fffffff, 0xffffffff,
|
TEST_MAC (0x7fffffff, 0xffffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x7fffffff, 0x7fffffff)
|
0x7fffffff, 0x7fffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
small negative total */
|
small negative total */
|
TEST_MAC (0xffffffff, 0xffffffff,
|
TEST_MAC (0xffffffff, 0xffffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0xffffffff, 0x7fffffff)
|
0xffffffff, 0x7fffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
moderate negative total */
|
moderate negative total */
|
TEST_MAC (0xffffffff, 0x7fffffff,
|
TEST_MAC (0xffffffff, 0x7fffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0xfffffffe, 0xffffffff)
|
0xfffffffe, 0xffffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
large negative total */
|
large negative total */
|
TEST_MAC (0x80000000, 0x80000000,
|
TEST_MAC (0x80000000, 0x80000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x80000000, 0x00000000)
|
0x80000000, 0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* Test of multiply signed and accumulate, l.maci
|
* Test of multiply signed and accumulate, l.maci
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
_maci:
|
_maci:
|
LOAD_STR (r3, "l.maci\n")
|
LOAD_STR (r3, "l.maci\n")
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
/* MAC two small positive numbers on a zero total */
|
/* MAC two small positive numbers on a zero total */
|
TEST_MACI (0x00000000, 0x00000000,
|
TEST_MACI (0x00000000, 0x00000000,
|
0x00000002, 0x0003,
|
0x00000002, 0x0003,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MAC two small positive numbers on a small positive total */
|
/* MAC two small positive numbers on a small positive total */
|
TEST_MACI (0x00000000, 0x00000006,
|
TEST_MACI (0x00000000, 0x00000006,
|
0x00000002, 0x0003,
|
0x00000002, 0x0003,
|
0x00000000, 0x0000000c)
|
0x00000000, 0x0000000c)
|
|
|
/* MAC two small positive numbers on a moderate positive total */
|
/* MAC two small positive numbers on a moderate positive total */
|
TEST_MACI (0x00000000, 0xfffffffa,
|
TEST_MACI (0x00000000, 0xfffffffa,
|
0x00000002, 0x0003,
|
0x00000002, 0x0003,
|
0x00000001, 0x00000000)
|
0x00000001, 0x00000000)
|
|
|
/* MAC two small positive numbers on a large positive total */
|
/* MAC two small positive numbers on a large positive total */
|
TEST_MACI (0x3fffffff, 0xfffffffa,
|
TEST_MACI (0x3fffffff, 0xfffffffa,
|
0x00000002, 0x0003,
|
0x00000002, 0x0003,
|
0x40000000, 0x00000000)
|
0x40000000, 0x00000000)
|
|
|
/* MAC two small positive numbers on a small negative total */
|
/* MAC two small positive numbers on a small negative total */
|
TEST_MACI (0xffffffff, 0xfffffffa,
|
TEST_MACI (0xffffffff, 0xfffffffa,
|
0x00000002, 0x0003,
|
0x00000002, 0x0003,
|
0x00000000, 0x00000000)
|
0x00000000, 0x00000000)
|
|
|
/* MAC two small positive numbers on a moderate negative total */
|
/* MAC two small positive numbers on a moderate negative total */
|
TEST_MACI (0xffffffff, 0x00000000,
|
TEST_MACI (0xffffffff, 0x00000000,
|
0x00000002, 0x0003,
|
0x00000002, 0x0003,
|
0xffffffff, 0x00000006)
|
0xffffffff, 0x00000006)
|
|
|
/* MAC two small positive numbers on a large negative total */
|
/* MAC two small positive numbers on a large negative total */
|
TEST_MACI (0x80000000, 0x00000000,
|
TEST_MACI (0x80000000, 0x00000000,
|
0x00000002, 0x0003,
|
0x00000002, 0x0003,
|
0x80000000, 0x00000006)
|
0x80000000, 0x00000006)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
tmp:
|
tmp:
|
/* MAC two moderate positive numbers on a zero total */
|
/* MAC two moderate positive numbers on a zero total */
|
TEST_MACI (0x00000000, 0x00000000,
|
TEST_MACI (0x00000000, 0x00000000,
|
0x00010002, 0x7fff,
|
0x00010002, 0x7fff,
|
0x00000000, 0x7ffffffe)
|
0x00000000, 0x7ffffffe)
|
|
|
/* MAC two moderate positive numbers on a small positive total */
|
/* MAC two moderate positive numbers on a small positive total */
|
TEST_MACI (0x00000000, 0x00000002,
|
TEST_MACI (0x00000000, 0x00000002,
|
0x00010002, 0x7fff,
|
0x00010002, 0x7fff,
|
0x00000000, 0x80000000)
|
0x00000000, 0x80000000)
|
|
|
/* MAC two moderate positive numbers on a moderate positive total */
|
/* MAC two moderate positive numbers on a moderate positive total */
|
TEST_MACI (0x00000000, 0x80000002,
|
TEST_MACI (0x00000000, 0x80000002,
|
0x00010002, 0x7fff,
|
0x00010002, 0x7fff,
|
0x00000001, 0x00000000)
|
0x00000001, 0x00000000)
|
|
|
/* MAC two moderate positive numbers on a large positive total */
|
/* MAC two moderate positive numbers on a large positive total */
|
TEST_MACI (0x7fffffff, 0x80000001,
|
TEST_MACI (0x7fffffff, 0x80000001,
|
0x00010002, 0x7fff,
|
0x00010002, 0x7fff,
|
0x7fffffff, 0xffffffff)
|
0x7fffffff, 0xffffffff)
|
|
|
/* MAC two moderate positive numbers on a small negative total */
|
/* MAC two moderate positive numbers on a small negative total */
|
TEST_MACI (0xffffffff, 0xffffffff,
|
TEST_MACI (0xffffffff, 0xffffffff,
|
0x00010002, 0x7fff,
|
0x00010002, 0x7fff,
|
0x00000000, 0x7ffffffd)
|
0x00000000, 0x7ffffffd)
|
|
|
/* MAC two moderate positive numbers on a moderate negative total */
|
/* MAC two moderate positive numbers on a moderate negative total */
|
TEST_MACI (0xffffffff, 0x80000002,
|
TEST_MACI (0xffffffff, 0x80000002,
|
0x00010002, 0x7fff,
|
0x00010002, 0x7fff,
|
0x00000000, 0x00000000)
|
0x00000000, 0x00000000)
|
|
|
/* MAC two moderate positive numbers on a large negative total */
|
/* MAC two moderate positive numbers on a large negative total */
|
TEST_MACI (0xfffffffe, 0x80000002,
|
TEST_MACI (0xfffffffe, 0x80000002,
|
0x00010002, 0x7fff,
|
0x00010002, 0x7fff,
|
0xffffffff, 0x00000000)
|
0xffffffff, 0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC two small negative numbers on a zero total */
|
/* MAC two small negative numbers on a zero total */
|
TEST_MACI (0x00000000, 0x00000000,
|
TEST_MACI (0x00000000, 0x00000000,
|
0xfffffffe, 0xfffd,
|
0xfffffffe, 0xfffd,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MAC two small negative numbers on a small positive total */
|
/* MAC two small negative numbers on a small positive total */
|
TEST_MACI (0x00000000, 0x00000006,
|
TEST_MACI (0x00000000, 0x00000006,
|
0xfffffffe, 0xfffd,
|
0xfffffffe, 0xfffd,
|
0x00000000, 0x0000000c)
|
0x00000000, 0x0000000c)
|
|
|
/* MAC two small negative numbers on a small negative total */
|
/* MAC two small negative numbers on a small negative total */
|
TEST_MACI (0xffffffff, 0xffffffff,
|
TEST_MACI (0xffffffff, 0xffffffff,
|
0xfffffffe, 0xfffd,
|
0xfffffffe, 0xfffd,
|
0x00000000, 0x00000005)
|
0x00000000, 0x00000005)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC one small positive and one small negative number on a zero
|
/* MAC one small positive and one small negative number on a zero
|
total */
|
total */
|
TEST_MACI (0x00000000, 0x00000000,
|
TEST_MACI (0x00000000, 0x00000000,
|
0x00000002, 0xfffd,
|
0x00000002, 0xfffd,
|
0xffffffff, 0xfffffffa)
|
0xffffffff, 0xfffffffa)
|
|
|
/* MAC one small positive and one small negative number on a small
|
/* MAC one small positive and one small negative number on a small
|
positive total */
|
positive total */
|
TEST_MACI (0x00000000, 0x0000000c,
|
TEST_MACI (0x00000000, 0x0000000c,
|
0x00000002, 0xfffd,
|
0x00000002, 0xfffd,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MAC one small positive and one small negative number on a moderate
|
/* MAC one small positive and one small negative number on a moderate
|
positive total */
|
positive total */
|
TEST_MACI (0x00000001, 0x00000005,
|
TEST_MACI (0x00000001, 0x00000005,
|
0x00000002, 0xfffd,
|
0x00000002, 0xfffd,
|
0x00000000, 0xffffffff)
|
0x00000000, 0xffffffff)
|
|
|
/* MAC one small positive and one small negative number on a large
|
/* MAC one small positive and one small negative number on a large
|
positive total */
|
positive total */
|
TEST_MACI (0x7fffffff, 0xffffffff,
|
TEST_MACI (0x7fffffff, 0xffffffff,
|
0x00000002, 0xfffd,
|
0x00000002, 0xfffd,
|
0x7fffffff, 0xfffffff9)
|
0x7fffffff, 0xfffffff9)
|
|
|
/* MAC one small positive and one small negative number on a small
|
/* MAC one small positive and one small negative number on a small
|
negative total */
|
negative total */
|
TEST_MACI (0xffffffff, 0xffffffff,
|
TEST_MACI (0xffffffff, 0xffffffff,
|
0x00000002, 0xfffd,
|
0x00000002, 0xfffd,
|
0xffffffff, 0xfffffff9)
|
0xffffffff, 0xfffffff9)
|
|
|
/* MAC one small positive and one small negative number on a moderate
|
/* MAC one small positive and one small negative number on a moderate
|
negative total */
|
negative total */
|
TEST_MACI (0xffffffff, 0x00000005,
|
TEST_MACI (0xffffffff, 0x00000005,
|
0x00000002, 0xfffd,
|
0x00000002, 0xfffd,
|
0xfffffffe, 0xffffffff)
|
0xfffffffe, 0xffffffff)
|
|
|
/* MAC one small positive and one small negative number on a large
|
/* MAC one small positive and one small negative number on a large
|
negative total */
|
negative total */
|
TEST_MACI (0x80000000, 0x00000006,
|
TEST_MACI (0x80000000, 0x00000006,
|
0x00000002, 0xfffd,
|
0x00000002, 0xfffd,
|
0x80000000, 0x00000000)
|
0x80000000, 0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
zero total */
|
zero total */
|
TEST_MACI (0x00000000, 0x00000000,
|
TEST_MACI (0x00000000, 0x00000000,
|
0x00010000, 0x8000,
|
0x00010000, 0x8000,
|
0xffffffff, 0x80000000)
|
0xffffffff, 0x80000000)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
small positive total */
|
small positive total */
|
TEST_MACI (0x00000000, 0x00000006,
|
TEST_MACI (0x00000000, 0x00000006,
|
0x00010000, 0x8000,
|
0x00010000, 0x8000,
|
0xffffffff, 0x80000006)
|
0xffffffff, 0x80000006)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
moderate positive total */
|
moderate positive total */
|
TEST_MACI (0x00000000, 0x80000000,
|
TEST_MACI (0x00000000, 0x80000000,
|
0x00010000, 0x8000,
|
0x00010000, 0x8000,
|
0x00000000, 0x00000000)
|
0x00000000, 0x00000000)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
large positive total */
|
large positive total */
|
TEST_MACI (0x7fffffff, 0xffffffff,
|
TEST_MACI (0x7fffffff, 0xffffffff,
|
0x00010000, 0x8000,
|
0x00010000, 0x8000,
|
0x7fffffff, 0x7fffffff)
|
0x7fffffff, 0x7fffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
small negative total */
|
small negative total */
|
TEST_MACI (0xffffffff, 0xffffffff,
|
TEST_MACI (0xffffffff, 0xffffffff,
|
0x00010000, 0x8000,
|
0x00010000, 0x8000,
|
0xffffffff, 0x7fffffff)
|
0xffffffff, 0x7fffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
moderate negative total */
|
moderate negative total */
|
TEST_MACI (0xffffffff, 0x7fffffff,
|
TEST_MACI (0xffffffff, 0x7fffffff,
|
0x00010000, 0x8000,
|
0x00010000, 0x8000,
|
0xfffffffe, 0xffffffff)
|
0xfffffffe, 0xffffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
large negative total */
|
large negative total */
|
TEST_MACI (0x80000000, 0x80000000,
|
TEST_MACI (0x80000000, 0x80000000,
|
0x00010000, 0x8000,
|
0x00010000, 0x8000,
|
0x80000000, 0x00000000)
|
0x80000000, 0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* Test of multiply signed and accumulate, read and clear l.macrc
|
* Test of multiply signed and accumulate, read and clear l.macrc
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
_macrc:
|
_macrc:
|
LOAD_STR (r3, "l.macrc\n")
|
LOAD_STR (r3, "l.macrc\n")
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
/* MAC two small positive numbers on a zero total */
|
/* MAC two small positive numbers on a zero total */
|
TEST_MACRC (0x00000000, 0x00000000,
|
TEST_MACRC (0x00000000, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000006)
|
0x00000006)
|
|
|
/* MAC two small positive numbers on a small positive total */
|
/* MAC two small positive numbers on a small positive total */
|
TEST_MACRC (0x00000000, 0x00000006,
|
TEST_MACRC (0x00000000, 0x00000006,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x0000000c)
|
0x0000000c)
|
|
|
/* MAC two small positive numbers on a moderate positive total */
|
/* MAC two small positive numbers on a moderate positive total */
|
TEST_MACRC (0x00000000, 0xfffffffa,
|
TEST_MACRC (0x00000000, 0xfffffffa,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000)
|
0x00000000)
|
|
|
/* MAC two small positive numbers on a large positive total */
|
/* MAC two small positive numbers on a large positive total */
|
TEST_MACRC (0x3fffffff, 0xfffffffa,
|
TEST_MACRC (0x3fffffff, 0xfffffffa,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000)
|
0x00000000)
|
|
|
/* MAC two small positive numbers on a small negative total */
|
/* MAC two small positive numbers on a small negative total */
|
TEST_MACRC (0xffffffff, 0xfffffffa,
|
TEST_MACRC (0xffffffff, 0xfffffffa,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000)
|
0x00000000)
|
|
|
/* MAC two small positive numbers on a moderate negative total */
|
/* MAC two small positive numbers on a moderate negative total */
|
TEST_MACRC (0xffffffff, 0x00000000,
|
TEST_MACRC (0xffffffff, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000006)
|
0x00000006)
|
|
|
/* MAC two small positive numbers on a large negative total */
|
/* MAC two small positive numbers on a large negative total */
|
TEST_MACRC (0x80000000, 0x00000000,
|
TEST_MACRC (0x80000000, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000006)
|
0x00000006)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC two moderate positive numbers on a zero total */
|
/* MAC two moderate positive numbers on a zero total */
|
TEST_MACRC (0x00000000, 0x00000000,
|
TEST_MACRC (0x00000000, 0x00000000,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x7ffffffe)
|
0x7ffffffe)
|
|
|
/* MAC two moderate positive numbers on a small positive total */
|
/* MAC two moderate positive numbers on a small positive total */
|
TEST_MACRC (0x00000000, 0x00000002,
|
TEST_MACRC (0x00000000, 0x00000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x80000000)
|
0x80000000)
|
|
|
/* MAC two moderate positive numbers on a moderate positive total */
|
/* MAC two moderate positive numbers on a moderate positive total */
|
TEST_MACRC (0x00000000, 0x80000002,
|
TEST_MACRC (0x00000000, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000)
|
0x00000000)
|
|
|
/* MAC two moderate positive numbers on a large positive total */
|
/* MAC two moderate positive numbers on a large positive total */
|
TEST_MACRC (0x7fffffff, 0x80000001,
|
TEST_MACRC (0x7fffffff, 0x80000001,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0xffffffff)
|
0xffffffff)
|
|
|
/* MAC two moderate positive numbers on a small negative total */
|
/* MAC two moderate positive numbers on a small negative total */
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x7ffffffd)
|
0x7ffffffd)
|
|
|
/* MAC two moderate positive numbers on a moderate negative total */
|
/* MAC two moderate positive numbers on a moderate negative total */
|
TEST_MACRC (0xffffffff, 0x80000002,
|
TEST_MACRC (0xffffffff, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000)
|
0x00000000)
|
|
|
/* MAC two moderate positive numbers on a large negative total */
|
/* MAC two moderate positive numbers on a large negative total */
|
TEST_MACRC (0xfffffffe, 0x80000002,
|
TEST_MACRC (0xfffffffe, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000)
|
0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC two small negative numbers on a zero total */
|
/* MAC two small negative numbers on a zero total */
|
TEST_MACRC (0x00000000, 0x00000000,
|
TEST_MACRC (0x00000000, 0x00000000,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x00000006)
|
0x00000006)
|
|
|
/* MAC two small negative numbers on a small positive total */
|
/* MAC two small negative numbers on a small positive total */
|
TEST_MACRC (0x00000000, 0x00000006,
|
TEST_MACRC (0x00000000, 0x00000006,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x0000000c)
|
0x0000000c)
|
|
|
/* MAC two small negative numbers on a small negative total */
|
/* MAC two small negative numbers on a small negative total */
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x00000005)
|
0x00000005)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC one small positive and one small negative number on a zero
|
/* MAC one small positive and one small negative number on a zero
|
total */
|
total */
|
TEST_MACRC (0x00000000, 0x00000000,
|
TEST_MACRC (0x00000000, 0x00000000,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xfffffffa)
|
0xfffffffa)
|
|
|
/* MAC one small positive and one small negative number on a small
|
/* MAC one small positive and one small negative number on a small
|
positive total */
|
positive total */
|
TEST_MACRC (0x00000000, 0x0000000c,
|
TEST_MACRC (0x00000000, 0x0000000c,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x00000006)
|
0x00000006)
|
|
|
/* MAC one small positive and one small negative number on a moderate
|
/* MAC one small positive and one small negative number on a moderate
|
positive total */
|
positive total */
|
TEST_MACRC (0x00000001, 0x00000005,
|
TEST_MACRC (0x00000001, 0x00000005,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xffffffff)
|
0xffffffff)
|
|
|
/* MAC one small positive and one small negative number on a large
|
/* MAC one small positive and one small negative number on a large
|
positive total */
|
positive total */
|
TEST_MACRC (0x7fffffff, 0xffffffff,
|
TEST_MACRC (0x7fffffff, 0xffffffff,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xfffffff9)
|
0xfffffff9)
|
|
|
/* MAC one small positive and one small negative number on a small
|
/* MAC one small positive and one small negative number on a small
|
negative total */
|
negative total */
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xfffffff9)
|
0xfffffff9)
|
|
|
/* MAC one small positive and one small negative number on a moderate
|
/* MAC one small positive and one small negative number on a moderate
|
negative total */
|
negative total */
|
TEST_MACRC (0xffffffff, 0x00000005,
|
TEST_MACRC (0xffffffff, 0x00000005,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xffffffff)
|
0xffffffff)
|
|
|
/* MAC one small positive and one small negative number on a large
|
/* MAC one small positive and one small negative number on a large
|
negative total */
|
negative total */
|
TEST_MACRC (0x80000000, 0x00000006,
|
TEST_MACRC (0x80000000, 0x00000006,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x00000000)
|
0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
zero total */
|
zero total */
|
TEST_MACRC (0x00000000, 0x00000000,
|
TEST_MACRC (0x00000000, 0x00000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x80000000)
|
0x80000000)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
small positive total */
|
small positive total */
|
TEST_MACRC (0x00000000, 0x00000006,
|
TEST_MACRC (0x00000000, 0x00000006,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x80000006)
|
0x80000006)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
moderate positive total */
|
moderate positive total */
|
TEST_MACRC (0x00000000, 0x80000000,
|
TEST_MACRC (0x00000000, 0x80000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x00000000)
|
0x00000000)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
large positive total */
|
large positive total */
|
TEST_MACRC (0x7fffffff, 0xffffffff,
|
TEST_MACRC (0x7fffffff, 0xffffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x7fffffff)
|
0x7fffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
small negative total */
|
small negative total */
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x7fffffff)
|
0x7fffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
moderate negative total */
|
moderate negative total */
|
TEST_MACRC (0xffffffff, 0x7fffffff,
|
TEST_MACRC (0xffffffff, 0x7fffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0xffffffff)
|
0xffffffff)
|
|
|
/* MAC one moderate positive and one moderate negative number on a
|
/* MAC one moderate positive and one moderate negative number on a
|
large negative total */
|
large negative total */
|
TEST_MACRC (0x80000000, 0x80000000,
|
TEST_MACRC (0x80000000, 0x80000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x00000000)
|
0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* Test of multiply signed and accumulate, l.msb
|
* Test of multiply signed and accumulate, l.msb
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
_msb:
|
_msb:
|
LOAD_STR (r3, "l.msb\n")
|
LOAD_STR (r3, "l.msb\n")
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
/* MSB two small positive numbers on a zero total */
|
/* MSB two small positive numbers on a zero total */
|
TEST_MSB (0x00000000, 0x00000000,
|
TEST_MSB (0x00000000, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0xffffffff, 0xfffffffa)
|
0xffffffff, 0xfffffffa)
|
|
|
/* MSB two small positive numbers on a small positive total */
|
/* MSB two small positive numbers on a small positive total */
|
TEST_MSB (0x00000000, 0x0000000c,
|
TEST_MSB (0x00000000, 0x0000000c,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MSB two small positive numbers on a moderate positive total */
|
/* MSB two small positive numbers on a moderate positive total */
|
TEST_MSB (0x00000001, 0x00000000,
|
TEST_MSB (0x00000001, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x00000000, 0xfffffffa)
|
0x00000000, 0xfffffffa)
|
|
|
/* MSB two small positive numbers on a large positive total */
|
/* MSB two small positive numbers on a large positive total */
|
TEST_MSB (0x40000000, 0x00000000,
|
TEST_MSB (0x40000000, 0x00000000,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x3fffffff, 0xfffffffa)
|
0x3fffffff, 0xfffffffa)
|
|
|
/* MSB two small positive numbers on a small negative total */
|
/* MSB two small positive numbers on a small negative total */
|
TEST_MSB (0xffffffff, 0xfffffffa,
|
TEST_MSB (0xffffffff, 0xfffffffa,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0xffffffff, 0xfffffff4)
|
0xffffffff, 0xfffffff4)
|
|
|
/* MSB two small positive numbers on a moderate negative total */
|
/* MSB two small positive numbers on a moderate negative total */
|
TEST_MSB (0xffffffff, 0x00000005,
|
TEST_MSB (0xffffffff, 0x00000005,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0xfffffffe, 0xffffffff)
|
0xfffffffe, 0xffffffff)
|
|
|
/* MSB two small positive numbers on a large negative total */
|
/* MSB two small positive numbers on a large negative total */
|
TEST_MSB (0x80000000, 0x00000006,
|
TEST_MSB (0x80000000, 0x00000006,
|
0x00000002, 0x00000003,
|
0x00000002, 0x00000003,
|
0x80000000, 0x00000000)
|
0x80000000, 0x00000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MSB two moderate positive numbers on a zero total */
|
/* MSB two moderate positive numbers on a zero total */
|
TEST_MSB (0x00000000, 0x00000000,
|
TEST_MSB (0x00000000, 0x00000000,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0xffffffff, 0x80000002)
|
0xffffffff, 0x80000002)
|
|
|
/* MSB two moderate positive numbers on a small positive total */
|
/* MSB two moderate positive numbers on a small positive total */
|
TEST_MSB (0x00000000, 0x00000002,
|
TEST_MSB (0x00000000, 0x00000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0xffffffff, 0x80000004)
|
0xffffffff, 0x80000004)
|
|
|
/* MSB two moderate positive numbers on a moderate positive total */
|
/* MSB two moderate positive numbers on a moderate positive total */
|
TEST_MSB (0x00000000, 0x80000002,
|
TEST_MSB (0x00000000, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x00000000, 0x00000004)
|
0x00000000, 0x00000004)
|
|
|
/* MSB two moderate positive numbers on a large positive total */
|
/* MSB two moderate positive numbers on a large positive total */
|
TEST_MSB (0x7fffffff, 0x7ffffffd,
|
TEST_MSB (0x7fffffff, 0x7ffffffd,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0x7ffffffe, 0xffffffff)
|
0x7ffffffe, 0xffffffff)
|
|
|
/* MSB two moderate positive numbers on a small negative total */
|
/* MSB two moderate positive numbers on a small negative total */
|
TEST_MSB (0xffffffff, 0xffffffff,
|
TEST_MSB (0xffffffff, 0xffffffff,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0xffffffff, 0x80000001)
|
0xffffffff, 0x80000001)
|
|
|
/* MSB two moderate positive numbers on a moderate negative total */
|
/* MSB two moderate positive numbers on a moderate negative total */
|
TEST_MSB (0xffffffff, 0x80000002,
|
TEST_MSB (0xffffffff, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0xffffffff, 0x00000004)
|
0xffffffff, 0x00000004)
|
|
|
/* MSB two moderate positive numbers on a large negative total */
|
/* MSB two moderate positive numbers on a large negative total */
|
TEST_MSB (0xfffffffe, 0x80000002,
|
TEST_MSB (0xfffffffe, 0x80000002,
|
0x00008001, 0x0000fffe,
|
0x00008001, 0x0000fffe,
|
0xfffffffe, 0x00000004)
|
0xfffffffe, 0x00000004)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MSB two small negative numbers on a zero total */
|
/* MSB two small negative numbers on a zero total */
|
TEST_MSB (0x00000000, 0x00000006,
|
TEST_MSB (0x00000000, 0x00000006,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x00000000, 0x00000000)
|
0x00000000, 0x00000000)
|
|
|
/* MSB two small negative numbers on a small positive total */
|
/* MSB two small negative numbers on a small positive total */
|
TEST_MSB (0x00000000, 0x0000000c,
|
TEST_MSB (0x00000000, 0x0000000c,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MSB two small negative numbers on a small negative total */
|
/* MSB two small negative numbers on a small negative total */
|
TEST_MSB (0xffffffff, 0xffffffff,
|
TEST_MSB (0xffffffff, 0xffffffff,
|
0xfffffffe, 0xfffffffd,
|
0xfffffffe, 0xfffffffd,
|
0xffffffff, 0xfffffff9)
|
0xffffffff, 0xfffffff9)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MSB one small positive and one small negative number on a zero
|
/* MSB one small positive and one small negative number on a zero
|
total */
|
total */
|
TEST_MSB (0x00000000, 0x00000000,
|
TEST_MSB (0x00000000, 0x00000000,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x00000000, 0x00000006)
|
0x00000000, 0x00000006)
|
|
|
/* MSB one small positive and one small negative number on a small
|
/* MSB one small positive and one small negative number on a small
|
positive total */
|
positive total */
|
TEST_MSB (0x00000000, 0x00000006,
|
TEST_MSB (0x00000000, 0x00000006,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x00000000, 0x0000000c)
|
0x00000000, 0x0000000c)
|
|
|
/* MSB one small positive and one small negative number on a moderate
|
/* MSB one small positive and one small negative number on a moderate
|
positive total */
|
positive total */
|
TEST_MSB (0x00000000, 0xffffffff,
|
TEST_MSB (0x00000000, 0xffffffff,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x00000001, 0x00000005)
|
0x00000001, 0x00000005)
|
|
|
/* MSB one small positive and one small negative number on a large
|
/* MSB one small positive and one small negative number on a large
|
positive total */
|
positive total */
|
TEST_MSB (0x7fffffff, 0xfffffff9,
|
TEST_MSB (0x7fffffff, 0xfffffff9,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x7fffffff, 0xffffffff)
|
0x7fffffff, 0xffffffff)
|
|
|
/* MSB one small positive and one small negative number on a small
|
/* MSB one small positive and one small negative number on a small
|
negative total */
|
negative total */
|
TEST_MSB (0xffffffff, 0xfffffff9,
|
TEST_MSB (0xffffffff, 0xfffffff9,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xffffffff, 0xffffffff)
|
0xffffffff, 0xffffffff)
|
|
|
/* MSB one small positive and one small negative number on a moderate
|
/* MSB one small positive and one small negative number on a moderate
|
negative total */
|
negative total */
|
TEST_MSB (0xfffffffe, 0xffffffff,
|
TEST_MSB (0xfffffffe, 0xffffffff,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0xffffffff, 0x00000005)
|
0xffffffff, 0x00000005)
|
|
|
/* MSB one small positive and one small negative number on a large
|
/* MSB one small positive and one small negative number on a large
|
negative total */
|
negative total */
|
TEST_MSB (0x80000000, 0x00000000,
|
TEST_MSB (0x80000000, 0x00000000,
|
0x00000002, 0xfffffffd,
|
0x00000002, 0xfffffffd,
|
0x80000000, 0x00000006)
|
0x80000000, 0x00000006)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* MSB one moderate positive and one moderate negative number on a
|
/* MSB one moderate positive and one moderate negative number on a
|
zero total */
|
zero total */
|
TEST_MSB (0x00000000, 0x00000000,
|
TEST_MSB (0x00000000, 0x00000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x00000000, 0x80000000)
|
0x00000000, 0x80000000)
|
|
|
/* MSB one moderate positive and one moderate negative number on a
|
/* MSB one moderate positive and one moderate negative number on a
|
small positive total */
|
small positive total */
|
TEST_MSB (0x00000000, 0x00000006,
|
TEST_MSB (0x00000000, 0x00000006,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x00000000, 0x80000006)
|
0x00000000, 0x80000006)
|
|
|
/* MSB one moderate positive and one moderate negative number on a
|
/* MSB one moderate positive and one moderate negative number on a
|
moderate positive total */
|
moderate positive total */
|
TEST_MSB (0x00000000, 0x80000000,
|
TEST_MSB (0x00000000, 0x80000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x00000001, 0x00000000)
|
0x00000001, 0x00000000)
|
|
|
/* MSB one moderate positive and one moderate negative number on a
|
/* MSB one moderate positive and one moderate negative number on a
|
large positive total */
|
large positive total */
|
TEST_MSB (0x7fffffff, 0x7fffffff,
|
TEST_MSB (0x7fffffff, 0x7fffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x7fffffff, 0xffffffff)
|
0x7fffffff, 0xffffffff)
|
|
|
/* MSB one moderate positive and one moderate negative number on a
|
/* MSB one moderate positive and one moderate negative number on a
|
small negative total */
|
small negative total */
|
TEST_MSB (0xffffffff, 0xffffffff,
|
TEST_MSB (0xffffffff, 0xffffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x00000000, 0x7fffffff)
|
0x00000000, 0x7fffffff)
|
|
|
/* MSB one moderate positive and one moderate negative number on a
|
/* MSB one moderate positive and one moderate negative number on a
|
moderate negative total */
|
moderate negative total */
|
TEST_MSB (0xfffffffe, 0xffffffff,
|
TEST_MSB (0xfffffffe, 0xffffffff,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0xffffffff, 0x7fffffff)
|
0xffffffff, 0x7fffffff)
|
|
|
/* MSB one moderate positive and one moderate negative number on a
|
/* MSB one moderate positive and one moderate negative number on a
|
large negative total */
|
large negative total */
|
TEST_MSB (0x80000000, 0x00000000,
|
TEST_MSB (0x80000000, 0x00000000,
|
0x00008000, 0xffff0000,
|
0x00008000, 0xffff0000,
|
0x80000000, 0x80000000)
|
0x80000000, 0x80000000)
|
|
|
PUTC ('\n')
|
PUTC ('\n')
|
|
|
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
* All done
|
* All done
|
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
_exit:
|
_exit:
|
LOAD_STR (r3, "Test completed\n")
|
LOAD_STR (r3, "Test completed\n")
|
l.jal _puts
|
l.jal _puts
|
l.nop
|
l.nop
|
|
|
TEST_EXIT
|
TEST_EXIT
|
|
|