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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [frv/] [nsdivi.cgs] - Rev 827

Go to most recent revision | Compare with Previous | Blame | View Log

# frv testcase for nsdivi $GRi,$s12,$GRk
# mach: fr500 fr550 frv

        .include "testutils.inc"

        start

        .global nsdivi
nsdivi:
        set_spr_immed   0,gner0
        set_spr_immed   0,gner1

        ; simple division 12 / 3
        set_gr_immed    12,gr1
        nsdivi          gr1,3,gr2
        test_gr_immed   4,gr2
        test_spr_immed  0,gner0
        test_spr_immed  0,gner1

        ; Random example
        set_gr_limmed   0xfedc,0xba98,gr1
        nsdivi          gr1,0x7ff,gr2
        test_gr_limmed  0xffff,0xdb93,gr2
        test_spr_immed  0,gner0
        test_spr_immed  0,gner1

        ; Random negative example
        set_gr_limmed   0xfedc,0xba98,gr1
        nsdivi          gr1,-2048,gr2
        test_gr_immed   0x2468,gr2
        test_spr_immed  0,gner0
        test_spr_immed  0,gner1

        or_spr_immed    0x20,isr        ; turn on isr.edem
        set_gr_limmed   0x8000,0x0000,gr1
        nsdivi          gr1,-1,gr2
        test_gr_limmed  0x7fff,0xffff,gr2
        test_spr_immed  0,gner0
        test_spr_immed  0,gner1

        nsdivi          gr1,0,gr32      ; divide by zero
        test_spr_immed  1,gner0
        test_spr_immed  0,gner1

        ; Special case from the Arch Spec Vol 2
        and_spr_immed   -33,isr         ; turn off isr.edem
        set_gr_limmed   0x8000,0x0000,gr1
        nsdivi          gr1,-1,gr2
        test_gr_limmed  0x8000,0x0000,gr2
        test_spr_immed  1,gner0
        test_spr_immed  4,gner1

        nsdivi          gr1,0,gr10      ; divide by zero
        test_spr_immed  1,gner0
        test_spr_immed  0x00000404,gner1

        ; simple division 12 / 3 -- should turn off ne flag
        set_gr_immed    12,gr1
        nsdivi          gr1,3,gr2
        test_gr_immed   4,gr2
        test_spr_immed  1,gner0
        test_spr_immed  0x00000400,gner1

        pass

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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