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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [binutils-2.18.50/] [gas/] [testsuite/] [gas/] [h8300/] [h8300-elf.exp] - Rev 156

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

#
# Some H8/300 elf tests
#
proc do_h8300_cbranch {} {
    set testname "cbranch.s: h8300 conditional branch tests"
    set x 0

    gas_start "cbranch.s" "-al"

    # Check each instruction bit pattern to verify it got
    # assembled correctly.
    while 1 {
        expect {
            -re " +\[0-9\]+ 0000 4000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0002 4000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0004 4100\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0006 4100\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0008 4200\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000a 4300\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000c 4400\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000e 4400\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0010 4500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0012 4500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0014 4600\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0016 4700\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0018 4800\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001a 4900\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001c 4A00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001e 4B00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0020 4C00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0022 4D00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0024 4E00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0026 4F00\[^\n\]*\n"   { set x [expr $x+1] }
            timeout                             { perror "timeout\n; break }
            eof                                 { break }
        }
    }

    # This was intended to do any cleanup necessary.  It kinda looks like it
    # isn't needed, but just in case, please keep it in for now.
    gas_finish

    # Did we find what we were looking for?  If not, flunk it.
    if [expr $x == 20] then { pass $testname } else { fail $testname }
}

proc do_h8300_branch {} {
    set testname "branch.s: h8300 branch tests"
    set x 0

    gas_start "branch-elf.s" "-al"

    # Check each instruction bit pattern to verify it got
    # assembled correctly.
    while 1 {
        expect {
            -re " +\[0-9\]+ 0000 5500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0002 5A000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0006 5900\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0008 5B00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000a 5E000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000e 5D00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0010 5F00\[^\n\]*\n"   { set x [expr $x+1] }
            timeout                             { perror "timeout\n; break }
            eof                                 { break }
        }
    }

    # This was intended to do any cleanup necessary.  It kinda looks like it
    # isn't needed, but just in case, please keep it in for now.
    gas_finish

    # Did we find what we were looking for?  If not, flunk it.
    if [expr $x == 7] then { pass $testname } else { fail $testname }
}

proc do_h8300h_cbranch {} {
    set testname "cbranchh.s: h8300h conditional branch tests"
    set x 0

    gas_start "cbranchh.s" "-al"

    # Check each instruction bit pattern to verify it got
    # assembled correctly.
    while 1 {
        expect {
            -re " +\[0-9\]+ 0000 4000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0002 4000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0004 4100\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0006 4100\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0008 4200\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000a 4300\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000c 4400\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000e 4400\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0010 4500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0012 4500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0014 4600\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0016 4700\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0018 4800\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001a 4900\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001c 4A00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001e 4B00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0020 4C00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0022 4D00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0024 4E00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0026 4F00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0028 58000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 002c 58000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0030 58100000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0034 58100000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0038 58200000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 003c 58300000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0040 58400000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0044 58400000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0048 58500000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 004c 58500000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0050 58600000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0054 58700000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0058 58800000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 005c 58900000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0060 58A00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0064 58B00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0068 58C00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 006c 58D00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0070 58E00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0074 58F00000\[^\n\]*\n"   { set x [expr $x+1] }
            timeout                             { perror "timeout\n; break }
            eof                                 { break }
        }
    }

    # This was intended to do any cleanup necessary.  It kinda looks like it
    # isn't needed, but just in case, please keep it in for now.
    gas_finish

    # Did we find what we were looking for?  If not, flunk it.
    if [expr $x == 40] then { pass $testname } else { fail $testname }
}

proc do_h8300h_branch {} {
    set testname "branchh.s: h8300h branch tests"
    set x 0

    gas_start "branchh-elf.s" "-al"

    # Check each instruction bit pattern to verify it got
    # assembled correctly.
    while 1 {
        expect {
            -re " +\[0-9\]+ 0000 5500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0002 5C000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0006 5A000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000a 5900\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000c 5B00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000e 5E000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0012 5D00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0014 5F00\[^\n\]*\n"   { set x [expr $x+1] }
            timeout                             { perror "timeout\n; break }
            eof                                 { break }
        }
    }

    # This was intended to do any cleanup necessary.  It kinda looks like it
    # isn't needed, but just in case, please keep it in for now.
    gas_finish

    # Did we find what we were looking for?  If not, flunk it.
    if [expr $x == 8] then { pass $testname } else { fail $testname }
}

proc do_h8300s_cbranch {} {
    set testname "cbranchs.s: h8300s conditional branch tests"
    set x 0

    gas_start "cbranchs.s" "-al"

    # Check each instruction bit pattern to verify it got
    # assembled correctly.
    while 1 {
        expect {
            -re " +\[0-9\]+ 0000 4000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0002 4000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0004 4100\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0006 4100\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0008 4200\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000a 4300\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000c 4400\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000e 4400\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0010 4500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0012 4500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0014 4600\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0016 4700\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0018 4800\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001a 4900\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001c 4A00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 001e 4B00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0020 4C00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0022 4D00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0024 4E00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0026 4F00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0028 58000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 002c 58000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0030 58100000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0034 58100000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0038 58200000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 003c 58300000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0040 58400000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0044 58400000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0048 58500000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 004c 58500000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0050 58600000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0054 58700000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0058 58800000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 005c 58900000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0060 58A00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0064 58B00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0068 58C00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 006c 58D00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0070 58E00000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0074 58F00000\[^\n\]*\n"   { set x [expr $x+1] }
            timeout                             { perror "timeout\n; break }
            eof                                 { break }
        }
    }

    # This was intended to do any cleanup necessary.  It kinda looks like it
    # isn't needed, but just in case, please keep it in for now.
    gas_finish

    # Did we find what we were looking for?  If not, flunk it.
    if [expr $x == 40] then { pass $testname } else { fail $testname }
}

proc do_h8300s_branch {} {
    set testname "branchs.s: h8300s branch tests"
    set x 0

    gas_start "branchs-elf.s" "-al"

    # Check each instruction bit pattern to verify it got
    # assembled correctly.
    while 1 {
        expect {
            -re " +\[0-9\]+ 0000 5500\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0002 5C000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0006 5A000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000a 5900\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000c 5B00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 000e 5E000000\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0012 5D00\[^\n\]*\n"   { set x [expr $x+1] }
            -re " +\[0-9\]+ 0014 5F00\[^\n\]*\n"   { set x [expr $x+1] }
            timeout                             { perror "timeout\n; break }
            eof                                 { break }
        }
    }

    # This was intended to do any cleanup necessary.  It kinda looks like it
    # isn't needed, but just in case, please keep it in for now.
    gas_finish

    # Did we find what we were looking for?  If not, flunk it.
    if [expr $x == 8] then { pass $testname } else { fail $testname }
}

if [istarget h8300*-*-elf] then {
    # Test the basic h8300 instruction parser
    do_h8300_cbranch
    do_h8300_branch

    # Now test the h8300h instruction parser
    do_h8300h_cbranch
    do_h8300h_branch

    # Now test the h8300s instruction parser
    do_h8300s_cbranch
    do_h8300s_branch

    # Now some random tests
    run_dump_test "ffxx1-elf"

    run_dump_test h8sx_disp2
    run_dump_test h8sx_rtsl
    run_dump_test h8sx_mov_imm
}

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.