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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gdb-6.8/] [pre-binutils-2.20.1-sync/] [sim/] [testsuite/] [sim/] [mips/] [testutils.inc] - Diff between revs 157 and 223

Only display areas with differences | Details | Blame | View Log

Rev 157 Rev 223
# MIPS simulator testsuite utility functions.
# MIPS simulator testsuite utility functions.
# Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
# Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
# Contributed by Chris Demetriou of Broadcom Corporation.
# Contributed by Chris Demetriou of Broadcom Corporation.
#
#
# This file is part of the GNU simulators.
# This file is part of the GNU simulators.
#
#
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .  */
# along with this program.  If not, see .  */
# $1, $4, $5, %6, are used as temps by the macros defined here.
# $1, $4, $5, %6, are used as temps by the macros defined here.
        .macro writemsg msg
        .macro writemsg msg
        .data
        .data
901:    .ascii  "\msg\n"
901:    .ascii  "\msg\n"
902:
902:
        .previous
        .previous
        la      $5, 901b
        la      $5, 901b
        li      $6, 902b - 901b
        li      $6, 902b - 901b
        .set push
        .set push
        .set noreorder
        .set noreorder
        jal     _dowrite
        jal     _dowrite
        li      $4, 0
        li      $4, 0
        .set pop
        .set pop
        .endm
        .endm
        # The MIPS simulator uses "break 0x3ff" as the code to exit,
        # The MIPS simulator uses "break 0x3ff" as the code to exit,
        # with the return value in $4 (a0).
        # with the return value in $4 (a0).
        .macro exit rc
        .macro exit rc
        li      $4, \rc
        li      $4, \rc
        break   0x3ff
        break   0x3ff
        .endm
        .endm
        .macro setup
        .macro setup
        .global _start
        .global _start
        .global __start
        .global __start
        .ent _start
        .ent _start
_start:
_start:
__start:
__start:
        .set push
        .set push
        .set noreorder
        .set noreorder
        j       DIAG
        j       DIAG
        nop
        nop
        .set pop
        .set pop
        .end _start
        .end _start
        .global _fail
        .global _fail
        .ent _fail
        .ent _fail
_fail:
_fail:
        writemsg "fail"
        writemsg "fail"
        exit 1
        exit 1
        .end _fail
        .end _fail
        .global _pass
        .global _pass
        .ent _pass
        .ent _pass
_pass:
_pass:
        writemsg "pass"
        writemsg "pass"
        exit 0
        exit 0
        .end _pass
        .end _pass
        # The MIPS simulator can use multiple different monitor types,
        # The MIPS simulator can use multiple different monitor types,
        # so we hard-code the simulator "write" reserved instruction opcode,
        # so we hard-code the simulator "write" reserved instruction opcode,
        # rather than jumping to a vector that invokes it.  The operation
        # rather than jumping to a vector that invokes it.  The operation
        # expects RA to point to the location at which to continue
        # expects RA to point to the location at which to continue
        # after writing.
        # after writing.
        .global _dowrite
        .global _dowrite
        .ent _dowrite
        .ent _dowrite
_dowrite:
_dowrite:
        # Write opcode (reserved instruction).  See sim_monitor and its
        # Write opcode (reserved instruction).  See sim_monitor and its
        # callers in sim/mips/interp.c.
        # callers in sim/mips/interp.c.
        .word   0x00000005 | ((8 << 1) << 6)
        .word   0x00000005 | ((8 << 1) << 6)
        .end _dowrite
        .end _dowrite
        .endm   # setup
        .endm   # setup
        .macro pass
        .macro pass
        .set push
        .set push
        .set noreorder
        .set noreorder
        j       _pass
        j       _pass
        nop
        nop
        .set pop
        .set pop
        .endm
        .endm
        .macro fail
        .macro fail
        .set push
        .set push
        .set noreorder
        .set noreorder
        j       _fail
        j       _fail
        nop
        nop
        .set pop
        .set pop
        .endm
        .endm
        .macro load32 reg, val
        .macro load32 reg, val
        li      \reg, \val
        li      \reg, \val
        .endm
        .endm
        .macro load64 reg, val
        .macro load64 reg, val
        dli     \reg, \val
        dli     \reg, \val
        .endm
        .endm
        .macro loadaddr reg, addr
        .macro loadaddr reg, addr
        la      \reg, \addr
        la      \reg, \addr
        .endm
        .endm
        .macro checkreg reg, expreg
        .macro checkreg reg, expreg
        .set push
        .set push
        .set noat
        .set noat
        .set noreorder
        .set noreorder
        beq     \expreg, \reg, 901f
        beq     \expreg, \reg, 901f
        nop
        nop
        fail
        fail
901:
901:
        .set pop
        .set pop
        .endm
        .endm
        .macro check32 reg, val
        .macro check32 reg, val
        .set push
        .set push
        .set noat
        .set noat
        load32  $1, \val
        load32  $1, \val
        checkreg \reg, $1
        checkreg \reg, $1
        .set pop
        .set pop
        .endm
        .endm
        .macro check64 reg, val
        .macro check64 reg, val
        .set push
        .set push
        .set noat
        .set noat
        load64  $1, \val
        load64  $1, \val
        checkreg \reg, $1
        checkreg \reg, $1
        .set pop
        .set pop
        .endm
        .endm
 
 

powered by: WebSVN 2.1.0

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