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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [inst-set-test/] [is-find-test.S] - Diff between revs 116 and 118

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 116 Rev 118
Line 46... Line 46...
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * A macro to carry out a test of find
 * A macro to carry out a test of find
 *
 *
 * Arguments
 * Arguments
 *   opc:       The opcode
 
 *   op:        First operand value
 *   op:        First operand value
 *   res:       Expected result
 *   res:       Expected result
 *   str:       Output string
 
 * ------------------------------------------------------------------------- */
 * ------------------------------------------------------------------------- */
#define TEST_FIND(opc, op, res, str)                                     \
#define TEST_FF1(op, res)                                                \
        LOAD_CONST (r4,33)              /* Invalid result */            ;\
        LOAD_CONST (r4,33)              /* Invalid result */            ;\
        LOAD_CONST (r5,op)              /* Load number to analyse */    ;\
        LOAD_CONST (r5,op)              /* Load number to analyse */    ;\
        opc     r4,r5                                           ;\
        l.ff1   r4,r5                                                   ;\
        CHECK_RES (str, r4, res)
        PUSH    (r4)                    /* Save for later */            ;\
 
                                                                        ;\
 
        PUTS ("  ff1 (0x")                                              ;\
 
        PUTH (op)                                                       ;\
 
        PUTS (") = 0x")                                                 ;\
 
        PUTHQ (res)                                                     ;\
 
        PUTS (": ")                                                     ;\
 
                                                                        ;\
 
        CHECK_RES1 (r4, res)
 
 
 
 
 
/* ----------------------------------------------------------------------------
 
 * A macro to carry out a test of find
 
 *
 
 * Arguments
 
 *   op:        First operand value
 
 *   res:       Expected result
 
 * ------------------------------------------------------------------------- */
 
#define TEST_FL1(op, res)                                                \
 
        LOAD_CONST (r4,33)              /* Invalid result */            ;\
 
        LOAD_CONST (r5,op)              /* Load number to analyse */    ;\
 
        l.fl1   r4,r5                                                   ;\
 
        PUSH    (r4)                    /* Save for later */            ;\
 
                                                                        ;\
 
        PUTS ("  fl1 (0x")                                              ;\
 
        PUTH (op)                                                       ;\
 
        PUTS (") = 0x")                                                 ;\
 
        PUTHQ (res)                                                     ;\
 
        PUTS (": ")                                                     ;\
 
                                                                        ;\
 
        CHECK_RES1 (r4, res)
 
 
 
 
 
/* ----------------------------------------------------------------------------
 
 * Start of code
 
 * ------------------------------------------------------------------------- */
        .section .text
        .section .text
        .global _start
        .global _start
_start:
_start:
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
Line 71... Line 102...
        LOAD_STR (r3, "l.ff1\n")
        LOAD_STR (r3, "l.ff1\n")
        l.jal   _puts
        l.jal   _puts
        l.nop
        l.nop
 
 
        /* Try a range of candidates. */
        /* Try a range of candidates. */
        TEST_FIND (l.ff1, 0x00000001,  1, "ff1 (0x00000001) =  1: ")
        TEST_FF1 (0x00000001,  1)
        TEST_FIND (l.ff1, 0x80000000, 32, "ff1 (0x80000000) = 32: ")
        TEST_FF1 (0x80000000, 32)
        TEST_FIND (l.ff1, 0x55555555,  1, "ff1 (0x55555555) =  1: ")
        TEST_FF1 (0x55555555,  1)
        TEST_FIND (l.ff1, 0xaaaaaaaa,  2, "ff1 (0xaaaaaaaa) =  2: ")
        TEST_FF1 (0xaaaaaaaa,  2)
        TEST_FIND (l.ff1, 0x00018000, 16, "ff1 (0x00018000) = 16: ")
        TEST_FF1 (0x00018000, 16)
        TEST_FIND (l.ff1, 0xc0000000, 31, "ff1 (0xc0000000) = 31: ")
        TEST_FF1 (0xc0000000, 31)
        TEST_FIND (l.ff1, 0x00000000,  0, "ff1 (0x00000000) =  0: ")
        TEST_FF1 (0x00000000,  0)
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * Test of find first 1, l.fl1
 * Test of find first 1, l.fl1
 * ------------------------------------------------------------------------- */
 * ------------------------------------------------------------------------- */
_fl1:
_fl1:
        LOAD_STR (r3, "l.fl1\n")
        LOAD_STR (r3, "l.fl1\n")
        l.jal   _puts
        l.jal   _puts
        l.nop
        l.nop
 
 
        /* Try a range of candidates. */
        /* Try a range of candidates. */
        TEST_FIND (l.fl1, 0x00000001,  1, "fl1 (0x00000001) =  1: ")
        TEST_FL1 (0x00000001,  1)
        TEST_FIND (l.fl1, 0x80000000, 32, "fl1 (0x80000000) = 32: ")
        TEST_FL1 (0x80000000, 32)
        TEST_FIND (l.fl1, 0x55555555, 31, "fl1 (0x55555555) = 31: ")
        TEST_FL1 (0x55555555, 31)
        TEST_FIND (l.fl1, 0xaaaaaaaa, 32, "fl1 (0xaaaaaaaa) = 32: ")
        TEST_FL1 (0xaaaaaaaa, 32)
        TEST_FIND (l.fl1, 0x00018000, 17, "fl1 (0x00018000) = 17: ")
        TEST_FL1 (0x00018000, 17)
        TEST_FIND (l.fl1, 0xc0000000, 32, "fl1 (0xc0000000) = 32: ")
        TEST_FL1 (0xc0000000, 32)
        TEST_FIND (l.fl1, 0x00000000,  0, "fl1 (0x00000000) =  0: ")
        TEST_FL1 (0x00000000,  0)
 
 
/* ----------------------------------------------------------------------------
/* ----------------------------------------------------------------------------
 * All done
 * All done
 * ------------------------------------------------------------------------- */
 * ------------------------------------------------------------------------- */
_exit:
_exit:

powered by: WebSVN 2.1.0

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