2003-06-22 Andrew Cagney <cagney@redhat.com>

Written by matthew green <mrg@redhat.com>, with fixes from Aldy
	Hernandez <aldyh@redhat.com>, Jim Wilson <wilson@redhat.com>, and
	Nick Clifton <nickc@redhat.com>.

	* ppc-instructions: Include altivec.igen and e500.igen.
	(model_busy, model_data): Add vr_busy and vscr_busy.
	(model_trace_release): Trace vr_busy and vscr_busy.
	(model_new_cycle): Update vr_busy and vscr_busy.
	(model_make_busy): Update vr_busy and vscr_busy.
	* registers.c (register_description): Add Altivec and e500
	registers.
	* psim.c (psim_read_register, psim_read_register): Handle Altivec
	and e500 registers.
	* ppc-spr-table (SPEFSCR): Add VRSAVE and SPEFSCR registers.
	* configure.in (sim_filter): When *altivec* add "av".  When *spe*
	or *simd* add e500.
	(sim_float): When *altivec* define WITH_ALTIVEC.  When *spe* add
	WITH_E500.
	* configure: Re-generate.
	* e500.igen, altivec.igen: New files.
	* e500_expression.h, altivec_expression.h: New files.
	* idecode_expression.h: Update copyright.  Include
	"e500_expression.h" and "altivec_expression.h".
	* e500_registers.h, altivec_registers.h: New files.
	* registers.h: Update copyright.  Include "e500_registers.h" and
	"altivec_registers.h".
	(registers): Add Altivec and e500 specific registers.
	* Makefile.in (IDECODE_H): Add "idecode_e500.h" and
	"idecode_altivec.h".
	(REGISTERS_H): Add "e500_registers.h" and "altivec_registers.h".
	(tmp-igen): Add dependencies on altivec.igen and e500.igen .
This commit is contained in:
Andrew Cagney 2003-06-22 16:48:12 +00:00
parent 70ecf948d9
commit 345d88d96e
16 changed files with 6387 additions and 99 deletions

View File

@ -1,3 +1,37 @@
2003-06-22 Andrew Cagney <cagney@redhat.com>
Written by matthew green <mrg@redhat.com>, with fixes from Aldy
Hernandez <aldyh@redhat.com>, Jim Wilson <wilson@redhat.com>, and
Nick Clifton <nickc@redhat.com>.
* ppc-instructions: Include altivec.igen and e500.igen.
(model_busy, model_data): Add vr_busy and vscr_busy.
(model_trace_release): Trace vr_busy and vscr_busy.
(model_new_cycle): Update vr_busy and vscr_busy.
(model_make_busy): Update vr_busy and vscr_busy.
* registers.c (register_description): Add Altivec and e500
registers.
* psim.c (psim_read_register, psim_read_register): Handle Altivec
and e500 registers.
* ppc-spr-table (SPEFSCR): Add VRSAVE and SPEFSCR registers.
* configure.in (sim_filter): When *altivec* add "av". When *spe*
or *simd* add e500.
(sim_float): When *altivec* define WITH_ALTIVEC. When *spe* add
WITH_E500.
* configure: Re-generate.
* e500.igen, altivec.igen: New files.
* e500_expression.h, altivec_expression.h: New files.
* idecode_expression.h: Update copyright. Include
"e500_expression.h" and "altivec_expression.h".
* e500_registers.h, altivec_registers.h: New files.
* registers.h: Update copyright. Include "e500_registers.h" and
"altivec_registers.h".
(registers): Add Altivec and e500 specific registers.
* Makefile.in (IDECODE_H): Add "idecode_e500.h" and
"idecode_altivec.h".
(REGISTERS_H): Add "e500_registers.h" and "altivec_registers.h".
(tmp-igen): Add dependencies on altivec.igen and e500.igen .
2003-06-22 Andrew Cagney <cagney@redhat.com>
Problems reported by Joshua LeVasseur.

View File

@ -187,13 +187,15 @@ PSIM_H = \
IDECODE_H = \
idecode.h \
idecode_expression.h \
idecode_expression.h e500_expression.h altivec_expression.h \
idecode_branch.h \
idecode_fields.h \
icache.h
REGISTERS_H = \
registers.h \
e500_registers.h \
altivec_registers.h \
spreg.h
CPU_H = \
@ -459,8 +461,7 @@ tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
$(SHELL) $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
touch tmp-dgen
tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) $(srcdir)/../../move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
tmp-igen: igen $(srcdir)/ppc-instructions $(srcdir)/altivec.igen $(srcdir)/e500.igen $(IGEN_OPCODE_RULES) $(srcdir)/../../move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
./igen $(IGEN_FLAGS) \
-o $(srcdir)/$(IGEN_OPCODE_RULES) \
-I $(srcdir) -i $(srcdir)/ppc-instructions \

2356
sim/ppc/altivec.igen Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
/* Altivec expression macros, for PSIM, the PowerPC simulator.
Copyright 2003 Free Software Foundation, Inc.
Contributed by Red Hat Inc; developed under contract from Motorola.
Written by matthew green <mrg@redhat.com>.
This file is part of GDB.
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 Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* AltiVec macro helpers. */
#define ALTIVEC_SET_CR6(vS, checkone) \
do { \
if (checkone && ((*vS).w[0] == 0xffffffff && \
(*vS).w[1] == 0xffffffff && \
(*vS).w[2] == 0xffffffff && \
(*vS).w[3] == 0xffffffff)) \
CR_SET(6, 1 << 3); \
else if ((*vS).w[0] == 0 && \
(*vS).w[1] == 0 && \
(*vS).w[2] == 0 && \
(*vS).w[3] == 0) \
CR_SET(6, 1 << 1); \
else \
CR_SET(6, 0); \
} while (0)
#define VSCR_SAT 0x00000001
#define VSCR_NJ 0x00010000
#define ALTIVEC_SET_SAT(sat) \
do { \
if (sat) \
VSCR |= VSCR_SAT; \
} while (0)

View File

@ -0,0 +1,63 @@
/* Altivec registers, for PSIM, the PowerPC simulator.
Copyright 2003 Free Software Foundation, Inc.
Contributed by Red Hat Inc; developed under contract from Motorola.
Written by matthew green <mrg@redhat.com>.
This file is part of GDB.
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 Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* Manage this as 4 32-bit entities, 8 16-bit entities or 16 8-bit
entities. */
typedef union
{
unsigned8 b[16];
unsigned16 h[8];
unsigned32 w[4];
} vreg;
typedef unsigned32 vscreg;
struct altivec_regs {
/* AltiVec Registers */
vreg vr[32];
vscreg vscr;
};
/* AltiVec registers */
#define VR(N) cpu_registers(processor)->altivec.vr[N]
/* AltiVec vector status and control register */
#define VSCR cpu_registers(processor)->altivec.vscr
/* AltiVec endian helpers, wrong endian hosts vs targets need to be
sure to get the right bytes/halfs/words when the order matters.
Note that many AltiVec instructions do not depend on byte order and
work on N independant bits of data. This is only for the
instructions that actually move data around. */
#if (WITH_HOST_BYTE_ORDER == BIG_ENDIAN)
#define AV_BINDEX(x) ((x) & 15)
#define AV_HINDEX(x) ((x) & 7)
#else
static char endian_b2l_bindex[16] = { 3, 2, 1, 0, 7, 6, 5, 4,
11, 10, 9, 8, 15, 14, 13, 12 };
static char endian_b2l_hindex[16] = { 1, 0, 3, 2, 5, 4, 7, 6 };
#define AV_BINDEX(x) endian_b2l_bindex[(x) & 15]
#define AV_HINDEX(x) endian_b2l_hindex[(x) & 7]
#endif

188
sim/ppc/configure vendored
View File

@ -163,7 +163,7 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-sim-filter=rule Specify filter rules."
ac_help="$ac_help
--enable-sim-float Specify whether to use host floating point or simulate."
--enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point."
ac_help="$ac_help
--enable-sim-hardware=list Specify the hardware to be included in the build."
ac_help="$ac_help
@ -3036,13 +3036,21 @@ if test "${enable_sim_float+set}" = set; then
case "${enableval}" in
yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
*spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
*) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-float"" 1>&2; exit 1; }; sim_float="";;
esac
if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
echo "Setting float flags = $sim_float" 6>&1
fi
else
sim_float=""
case "${target}" in
*altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
*spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
*) sim_float=""
esac
fi
@ -3103,14 +3111,14 @@ else
if test "x$cross_compiling" = "xno"; then
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
echo "configure:3107: checking whether byte ordering is bigendian" >&5
echo "configure:3115: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
#line 3114 "configure"
#line 3122 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@ -3121,11 +3129,11 @@ int main() {
#endif
; return 0; }
EOF
if { (eval echo configure:3125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
#line 3129 "configure"
#line 3137 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@ -3136,7 +3144,7 @@ int main() {
#endif
; return 0; }
EOF
if { (eval echo configure:3140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@ -3156,7 +3164,7 @@ if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 3160 "configure"
#line 3168 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@ -3169,7 +3177,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
if { (eval echo configure:3173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:3181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@ -3623,7 +3631,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:3627: checking host system type" >&5
echo "configure:3635: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -3644,7 +3652,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
echo "configure:3648: checking target system type" >&5
echo "configure:3656: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@ -3662,7 +3670,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:3666: checking build system type" >&5
echo "configure:3674: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@ -3709,12 +3717,12 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
echo "configure:3713: checking for st_blksize in struct stat" >&5
echo "configure:3721: checking for st_blksize in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3718 "configure"
#line 3726 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -3722,7 +3730,7 @@ int main() {
struct stat s; s.st_blksize;
; return 0; }
EOF
if { (eval echo configure:3726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blksize=yes
else
@ -3743,12 +3751,12 @@ EOF
fi
echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
echo "configure:3747: checking for st_blocks in struct stat" >&5
echo "configure:3755: checking for st_blocks in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3752 "configure"
#line 3760 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -3756,7 +3764,7 @@ int main() {
struct stat s; s.st_blocks;
; return 0; }
EOF
if { (eval echo configure:3760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3768: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blocks=yes
else
@ -3779,12 +3787,12 @@ else
fi
echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
echo "configure:3783: checking for st_rdev in struct stat" >&5
echo "configure:3791: checking for st_rdev in struct stat" >&5
if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3788 "configure"
#line 3796 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@ -3792,7 +3800,7 @@ int main() {
struct stat s; s.st_rdev;
; return 0; }
EOF
if { (eval echo configure:3796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_rdev=yes
else
@ -3813,12 +3821,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
echo "configure:3817: checking whether struct tm is in sys/time.h or time.h" >&5
echo "configure:3825: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3822 "configure"
#line 3830 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@ -3826,7 +3834,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
if { (eval echo configure:3830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@ -3847,12 +3855,12 @@ EOF
fi
echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
echo "configure:3851: checking for tm_zone in struct tm" >&5
echo "configure:3859: checking for tm_zone in struct tm" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3856 "configure"
#line 3864 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_cv_struct_tm>
@ -3860,7 +3868,7 @@ int main() {
struct tm tm; tm.tm_zone;
; return 0; }
EOF
if { (eval echo configure:3864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm_zone=yes
else
@ -3880,12 +3888,12 @@ EOF
else
echo $ac_n "checking for tzname""... $ac_c" 1>&6
echo "configure:3884: checking for tzname" >&5
echo "configure:3892: checking for tzname" >&5
if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3889 "configure"
#line 3897 "configure"
#include "confdefs.h"
#include <time.h>
#ifndef tzname /* For SGI. */
@ -3895,7 +3903,7 @@ int main() {
atoi(*tzname);
; return 0; }
EOF
if { (eval echo configure:3899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_var_tzname=yes
else
@ -3918,12 +3926,12 @@ fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
echo "configure:3922: checking for uid_t in sys/types.h" >&5
echo "configure:3930: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3927 "configure"
#line 3935 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@ -3952,7 +3960,7 @@ EOF
fi
echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
echo "configure:3956: checking type of array argument to getgroups" >&5
echo "configure:3964: checking type of array argument to getgroups" >&5
if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -3960,7 +3968,7 @@ else
ac_cv_type_getgroups=cross
else
cat > conftest.$ac_ext <<EOF
#line 3964 "configure"
#line 3972 "configure"
#include "confdefs.h"
/* Thanks to Mike Rendell for this test. */
@ -3985,7 +3993,7 @@ main()
}
EOF
if { (eval echo configure:3989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:3997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_type_getgroups=gid_t
else
@ -3999,7 +4007,7 @@ fi
if test $ac_cv_type_getgroups = cross; then
cat > conftest.$ac_ext <<EOF
#line 4003 "configure"
#line 4011 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
@ -4023,12 +4031,12 @@ EOF
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
echo "configure:4027: checking for mode_t" >&5
echo "configure:4035: checking for mode_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4032 "configure"
#line 4040 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -4056,12 +4064,12 @@ EOF
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
echo "configure:4060: checking for off_t" >&5
echo "configure:4068: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4065 "configure"
#line 4073 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -4089,12 +4097,12 @@ EOF
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
echo "configure:4093: checking for pid_t" >&5
echo "configure:4101: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4098 "configure"
#line 4106 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -4122,12 +4130,12 @@ EOF
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
echo "configure:4126: checking return type of signal handlers" >&5
echo "configure:4134: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4131 "configure"
#line 4139 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@ -4144,7 +4152,7 @@ int main() {
int i;
; return 0; }
EOF
if { (eval echo configure:4148: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@ -4163,12 +4171,12 @@ EOF
echo $ac_n "checking for size_t""... $ac_c" 1>&6
echo "configure:4167: checking for size_t" >&5
echo "configure:4175: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4172 "configure"
#line 4180 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -4196,12 +4204,12 @@ EOF
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
echo "configure:4200: checking for uid_t in sys/types.h" >&5
echo "configure:4208: checking for uid_t in sys/types.h" >&5
if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4205 "configure"
#line 4213 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
@ -4233,12 +4241,12 @@ fi
for ac_func in access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4237: checking for $ac_func" >&5
echo "configure:4245: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4242 "configure"
#line 4250 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -4261,7 +4269,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:4265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -4290,17 +4298,17 @@ for ac_hdr in fcntl.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/re
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:4294: checking for $ac_hdr" >&5
echo "configure:4302: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4299 "configure"
#line 4307 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:4304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:4312: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -4331,12 +4339,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
echo "configure:4335: checking for $ac_hdr that defines DIR" >&5
echo "configure:4343: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4340 "configure"
#line 4348 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@ -4344,7 +4352,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
if { (eval echo configure:4348: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4356: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@ -4369,7 +4377,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
echo "configure:4373: checking for opendir in -ldir" >&5
echo "configure:4381: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -4377,7 +4385,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4381 "configure"
#line 4389 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -4388,7 +4396,7 @@ int main() {
opendir()
; return 0; }
EOF
if { (eval echo configure:4392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -4410,7 +4418,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
echo "configure:4414: checking for opendir in -lx" >&5
echo "configure:4422: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -4418,7 +4426,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4422 "configure"
#line 4430 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -4429,7 +4437,7 @@ int main() {
opendir()
; return 0; }
EOF
if { (eval echo configure:4433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -4454,12 +4462,12 @@ fi
sim_termio=""
echo $ac_n "checking for struct termios""... $ac_c" 1>&6
echo "configure:4458: checking for struct termios" >&5
echo "configure:4466: checking for struct termios" >&5
if eval "test \"`echo '$''{'ac_cv_termios_struct'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4463 "configure"
#line 4471 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/termios.h>
@ -4472,7 +4480,7 @@ static struct termios x;
x.c_cc[NCCS] = 0;
; return 0; }
EOF
if { (eval echo configure:4476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4484: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_termios_struct=yes
else
@ -4491,12 +4499,12 @@ fi
if test "$ac_cv_termios_struct" = "yes"; then
echo $ac_n "checking for c_line field in struct termios""... $ac_c" 1>&6
echo "configure:4495: checking for c_line field in struct termios" >&5
echo "configure:4503: checking for c_line field in struct termios" >&5
if eval "test \"`echo '$''{'ac_cv_termios_cline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4500 "configure"
#line 4508 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/termios.h>
@ -4504,7 +4512,7 @@ int main() {
static struct termios x; x.c_line = 0;
; return 0; }
EOF
if { (eval echo configure:4508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4516: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_termios_cline=yes
else
@ -4527,12 +4535,12 @@ fi
if test "$ac_cv_termios_struct" != "yes"; then
echo $ac_n "checking for struct termio""... $ac_c" 1>&6
echo "configure:4531: checking for struct termio" >&5
echo "configure:4539: checking for struct termio" >&5
if eval "test \"`echo '$''{'ac_cv_termio_struct'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4536 "configure"
#line 4544 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/termio.h>
@ -4545,7 +4553,7 @@ static struct termio x;
x.c_cc[NCC] = 0;
; return 0; }
EOF
if { (eval echo configure:4549: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_termio_struct=yes
else
@ -4567,12 +4575,12 @@ fi
if test "$ac_cv_termio_struct" = "yes"; then
echo $ac_n "checking for c_line field in struct termio""... $ac_c" 1>&6
echo "configure:4571: checking for c_line field in struct termio" >&5
echo "configure:4579: checking for c_line field in struct termio" >&5
if eval "test \"`echo '$''{'ac_cv_termio_cline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4576 "configure"
#line 4584 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/termio.h>
@ -4580,7 +4588,7 @@ int main() {
static struct termio x; x.c_line = 0;
; return 0; }
EOF
if { (eval echo configure:4584: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_termio_cline=yes
else
@ -4603,7 +4611,7 @@ fi
sim_devzero=""
echo $ac_n "checking for /dev/zero""... $ac_c" 1>&6
echo "configure:4607: checking for /dev/zero" >&5
echo "configure:4615: checking for /dev/zero" >&5
if eval "test \"`echo '$''{'ac_cv_devzero'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -4611,7 +4619,7 @@ else
ac_cv_devzero=no
else
cat > conftest.$ac_ext <<EOF
#line 4615 "configure"
#line 4623 "configure"
#include "confdefs.h"
#include <fcntl.h>
main () {
@ -4630,7 +4638,7 @@ main () {
return 0;
}
EOF
if { (eval echo configure:4634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:4642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_devzero=yes
else
@ -4652,7 +4660,7 @@ else
fi
echo $ac_n "checking for common simulator directory""... $ac_c" 1>&6
echo "configure:4656: checking for common simulator directory" >&5
echo "configure:4664: checking for common simulator directory" >&5
if test -f "${srcdir}/../common/callback.c"; then
echo "$ac_t""yes" 1>&6
sim_callback="callback.o targ-map.o"
@ -4664,7 +4672,7 @@ else
fi
echo $ac_n "checking for common simulator directory fpu implementation""... $ac_c" 1>&6
echo "configure:4668: checking for common simulator directory fpu implementation" >&5
echo "configure:4676: checking for common simulator directory fpu implementation" >&5
if test -f "${srcdir}/../common/sim-fpu.c"; then
echo "$ac_t""yes" 1>&6
sim_fpu_cflags="-DHAVE_COMMON_FPU -I${srcdir}/../common"
@ -4676,12 +4684,12 @@ else
fi
echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
echo "configure:4680: checking for Cygwin environment" >&5
echo "configure:4688: checking for Cygwin environment" >&5
if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4685 "configure"
#line 4693 "configure"
#include "confdefs.h"
int main() {
@ -4692,7 +4700,7 @@ int main() {
return __CYGWIN__;
; return 0; }
EOF
if { (eval echo configure:4696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_cygwin=yes
else
@ -4709,19 +4717,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
echo "configure:4713: checking for mingw32 environment" >&5
echo "configure:4721: checking for mingw32 environment" >&5
if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 4718 "configure"
#line 4726 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
if { (eval echo configure:4725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@ -4740,7 +4748,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
echo "configure:4744: checking for executable suffix" >&5
echo "configure:4752: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -4750,7 +4758,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
if { (eval echo configure:4754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
if { (eval echo configure:4762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj | *.ilk | *.pdb) ;;
@ -4779,7 +4787,7 @@ AR=${AR-ar}
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:4783: checking for $ac_word" >&5
echo "configure:4791: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else

View File

@ -190,15 +190,23 @@ fi])dnl
AC_ARG_ENABLE(sim-float,
[ --enable-sim-float Specify whether to use host floating point or simulate.],
[ --enable-sim-float Specify whether the target has hard, soft, altivec or e500 floating point.],
[case "${enableval}" in
yes | hard) sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
no | soft) sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
altivec) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
*spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
*) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
esac
if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
echo "Setting float flags = $sim_float" 6>&1
fi],[sim_float=""])dnl
fi],[
case "${target}" in
*altivec*) sim_float="-DWITH_ALTIVEC" ; sim_filter="${sim_filter},av" ;;
*spe*|*simd*) sim_float="-DWITH_E500" ; sim_filter="${sim_filter},e500" ;;
*) sim_float=""
esac
])dnl
AC_ARG_ENABLE(sim-hardware,

3348
sim/ppc/e500.igen Normal file

File diff suppressed because it is too large Load Diff

173
sim/ppc/e500_expression.h Normal file
View File

@ -0,0 +1,173 @@
/* e500 expression macros, for PSIM, the PowerPC simulator.
Copyright 2003 Free Software Foundation, Inc.
Contributed by Red Hat Inc; developed under contract from Motorola.
Written by matthew green <mrg@redhat.com>.
This file is part of GDB.
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 Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* e500 register dance */
#define EV_SET_REG4(sh, sl, h0, h1, h2, h3) do { \
(sh) = (((h0) & 0xffff) << 16) | ((h1) & 0xffff); \
(sl) = (((h2) & 0xffff) << 16) | ((h3) & 0xffff); \
} while (0)
#define EV_SET_REG4_ACC(sh, sl, h0, h1, h2, h3) do { \
(sh) = (((h0) & 0xffff) << 16) | ((h1) & 0xffff); \
(sl) = (((h2) & 0xffff) << 16) | ((h3) & 0xffff); \
ACC = ((unsigned64)(sh) << 32) | (sl & 0xffffffff); \
} while (0)
#define EV_SET_REG2(sh, sl, dh, dl) do { \
(sh) = (dh) & 0xffffffff; \
(sl) = (dl) & 0xffffffff; \
} while (0)
#define EV_SET_REG2_ACC(sh, sl, dh, dl) do { \
(sh) = (dh) & 0xffffffff; \
(sl) = (dl) & 0xffffffff; \
ACC = ((unsigned64)(sh) << 32) | ((sl) & 0xffffffff); \
} while (0)
#define EV_SET_REG1(sh, sl, d) do { \
(sh) = ((unsigned64)(d) >> 32) & 0xffffffff; \
(sl) = (d) & 0xffffffff; \
} while (0)
#define EV_SET_REG1_ACC(sh, sl, d) do { \
(sh) = ((unsigned64)(d) >> 32) & 0xffffffff; \
(sl) = (d) & 0xffffffff; \
ACC = (d); \
} while (0)
#define EV_SET_REG(s, d) do { \
(s) = (d) & 0xffffffff; \
} while (0)
/* get the low or high half word of a word */
#define EV_LOHALF(x) ((unsigned32)(x) & 0xffff)
#define EV_HIHALF(x) (((unsigned32)(x) >> 16) & 0xffff)
/* partially visible accumulator accessors */
#define EV_SET_ACC(rh, rl) \
ACC = ((unsigned64)(rh) << 32) | ((rl) & 0xffffffff)
#define EV_ACCLOW (ACC & 0xffffffff)
#define EV_ACCHIGH ((ACC >> 32) & 0xffffffff)
/* bit manipulation macros needed for e500 SPE */
#define EV_BITREVERSE16(x) \
(((x) & 0x0001) << 15) \
| (((x) & 0x0002) << 13) \
| (((x) & 0x0004) << 11) \
| (((x) & 0x0008) << 9) \
| (((x) & 0x0010) << 7) \
| (((x) & 0x0020) << 5) \
| (((x) & 0x0040) << 3) \
| (((x) & 0x0080) << 1) \
| (((x) & 0x0100) >> 1) \
| (((x) & 0x0200) >> 3) \
| (((x) & 0x0400) >> 5) \
| (((x) & 0x0800) >> 7) \
| (((x) & 0x1000) >> 9) \
| (((x) & 0x2000) >> 11) \
| (((x) & 0x4000) >> 13) \
| (((x) & 0x8000) >> 15)
/* saturation helpers */
#define EV_MUL16_SSF(a,b) ((signed64)((signed32)(signed16)(a) * (signed32)(signed16)(b)) << 1)
/* this one loses the top sign bit; be careful */
#define EV_MUL32_SSF(a,b) (((signed64)(signed32)(a) * (signed64)(signed32)(b)) << 1)
#define EV_SAT_P_S32(x) ((((signed64)(x)) < -0x80000000LL) || (((signed64)(x)) > 0x7fffffffLL))
#define EV_SAT_P_U32(x) ((((signed64)(x)) < -0LL) || (((signed64)(x)) > 0xffffffffLL))
#define EV_SATURATE(flag, sat_val, val) \
((flag) ? (sat_val) : (val))
#define EV_SATURATE_ACC(flag, sign, negative_sat_val, positive_sat_val, val) \
((flag) ? ((((sign) >> 63) & 1) ? (negative_sat_val) : (positive_sat_val)) : (val))
/* SPEFSCR handling. */
/* These bits must be clear. */
#define EV_SPEFSCR_MASK (BIT(40) | BIT(41) | spefscr_mode | BIT(56))
/* The Inexact and Divide by zero sticky bits are based on others. */
#define EV_SET_SPEFSCR(bits) do { \
int finxs = (bits) & (spefscr_fgh|spefscr_fxh|spefscr_fg|spefscr_fx); \
int fdbzs = (bits) & (spefscr_fdbzh|spefscr_fdbz); \
SPREG(spr_spefscr) = ((bits) & ~EV_SPEFSCR_MASK) | \
(finxs ? spefscr_finxs : 0) | \
(fdbzs ? spefscr_fdbzs : 0); \
} while (0)
#define EV_SET_SPEFSCR_BITS(s) \
EV_SET_SPEFSCR(SPREG(spr_spefscr) | (s))
#define EV_SET_SPEFSCR_OV(l,h) do { \
unsigned32 _sPefScR = SPREG(spr_spefscr); \
if (l) \
_sPefScR |= spefscr_ov | spefscr_sov; \
else \
_sPefScR &= ~spefscr_ov; \
if (h) \
_sPefScR |= spefscr_ovh | spefscr_sovh; \
else \
_sPefScR &= ~spefscr_ovh; \
EV_SET_SPEFSCR(_sPefScR); \
} while (0)
/* SPE floating point helpers. */
#define EV_PMAX 0x7f7fffff
#define EV_NMAX 0xff7fffff
#define EV_PMIN 0x00800001
#define EV_NMIN 0x80800001
#define EV_IS_INFDENORMNAN(x) \
(sim_fpu_is_infinity(x) || sim_fpu_is_denorm(x) || sim_fpu_is_nan(x))
/* These aren't used (yet?) For now, SPU is always enabled.
Would be nice if they were generated by igen for e500. */
#define SPU_BEGIN \
{ \
if (MSR & msr_e500_spu_enable) { \
#define SPU_END \
} else { \
/* FIXME: raise SPU unavailable. */ \
} \
}
/* These are also not yet used. */
#define SPU_FP_BEGIN \
{
#define SPU_FP_END \
{ \
unsigned s = SPEFSCR; \
/* Check SPEFSCR; raise exceptions if any required. */ \
if (((spefscr_finxe || spefscr_finve) \
&& (s & (spefscr_finvh|spefscr_finv))) \
|| ((spefscr_finxe || spefscr_fdbze) \
&& (s & (spefscr_fdbzh|spefscr_fdbz))) \
|| ((spefscr_finxe || spefscr_funfe) \
&& (s & (spefscr_funfh|spefscr_funf))) \
|| ((spefscr_finxe || spefscr_fovfe) \
&& (s & (spefscr_fovfh|spefscr_fovf)))) \
/* FIXME: raise exceptions. */; \
} \
}

83
sim/ppc/e500_registers.h Normal file
View File

@ -0,0 +1,83 @@
/* e500 registers, for PSIM, the PowerPC simulator.
Copyright 2003 Free Software Foundation, Inc.
Contributed by Red Hat Inc; developed under contract from Motorola.
Written by matthew green <mrg@redhat.com>.
This file is part of GDB.
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 Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* e500 accumulator. */
typedef unsigned64 accreg;
enum {
msr_e500_spu_enable = BIT(38)
};
/* E500 regsiters. */
enum
{
spefscr_sovh = BIT(32), /* summary integer overlow (high) */
spefscr_ovh = BIT(33), /* int overflow (high) */
spefscr_fgh = BIT(34), /* FP guard (high) */
spefscr_fxh = BIT(35), /* FP sticky (high) */
spefscr_finvh = BIT(36), /* FP invalid operand (high) */
spefscr_fdbzh = BIT(37), /* FP divide by zero (high) */
spefscr_funfh = BIT(38), /* FP underflow (high) */
spefscr_fovfh = BIT(39), /* FP overflow (high) */
spefscr_finxs = BIT(42), /* FP inexact sticky */
spefscr_finvs = BIT(43), /* FP invalid operand sticky */
spefscr_fdbzs = BIT(44), /* FP divide by zero sticky */
spefscr_funfs = BIT(45), /* FP underflow sticky */
spefscr_fovfs = BIT(46), /* FP overflow sticky */
spefscr_mode = BIT(47), /* SPU MODE (read only) */
spefscr_sov = BIT(48), /* Summary integer overlow (low) */
spefscr_ov = BIT(49), /* int overflow (low) */
spefscr_fg = BIT(50), /* FP guard (low) */
spefscr_fx = BIT(51), /* FP sticky (low) */
spefscr_finv = BIT(52), /* FP invalid operand (low) */
spefscr_fdbz = BIT(53), /* FP divide by zero (low) */
spefscr_funf = BIT(54), /* FP underflow (low) */
spefscr_fovf = BIT(55), /* FP overflow (low) */
spefscr_finxe = BIT(57), /* FP inexact enable */
spefscr_finve = BIT(58), /* FP invalid operand enable */
spefscr_fdbze = BIT(59), /* FP divide by zero enable */
spefscr_funfe = BIT(60), /* FP underflow enable */
spefscr_fovfe = BIT(61), /* FP overflow enable */
spefscr_frmc0 = BIT(62), /* FP round mode control */
spefscr_frmc1 = BIT(63),
spefscr_frmc = (spefscr_frmc0 | spefscr_frmc1),
};
struct e500_regs {
/* e500 high bits. */
signed_word gprh[32];
/* Accumulator */
accreg acc;
};
/* SPE partially visible acculator */
#define ACC cpu_registers(processor)->e500.acc
/* e500 register high bits */
#define GPRH(N) cpu_registers(processor)->e500.gprh[N]
/* e500 unified vector register */
#define EVR(N) ((((unsigned64)GPRH(N)) << 32) | GPR(N))

View File

@ -1,6 +1,6 @@
/* This file is part of the program psim.
Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
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
@ -18,6 +18,13 @@
*/
/* Additional, and optional expressions. */
#ifdef WITH_ALTIVEC
#include "altivec_expression.h"
#endif
#ifdef WITH_E500
#include "e500_expression.h"
#endif
/* 32bit target expressions:

View File

@ -198,6 +198,8 @@
unsigned32 fp_busy; /* floating point registers that are busy */
unsigned32 cr_fpscr_busy; /* CR/FPSCR registers that are busy */
signed16 spr_busy; /* SPR register that is busy or PPC_NO_SPR */
unsigned32 vr_busy; /* AltiVec registers that are busy */
signed16 vscr_busy; /* AltiVec status register busy */
signed16 issue; /* # of cycles until unit can accept another insn */
signed16 done; /* # of cycles until insn is done */
signed16 nr_writebacks; /* # of registers this unit writes back */
@ -228,6 +230,8 @@
unsigned32 fp_busy; /* floating point registers that are busy */
unsigned32 cr_fpscr_busy; /* CR/FPSCR registers that are busy */
unsigned8 spr_busy[nr_of_sprs]; /* SPR registers that are busy */
unsigned32 vr_busy; /* AltiVec registers that are busy */
unsigned8 vscr_busy; /* AltiVec SC register busy */
unsigned8 busy[nr_ppc_function_units]; /* whether a function is busy or not */
};
@ -320,6 +324,15 @@ void::model-static::model_trace_release:model_data *model_ptr, model_busy *busy
}
if (busy->spr_busy != PPC_NO_SPR)
TRACE(trace_model, ("Register %s is now available.\n", spr_name(busy->spr_busy)));
if (busy->vr_busy) {
for(i = 0; i < 32; i++) {
if (((1 << i) & busy->vr_busy) != 0) {
TRACE(trace_model, ("Register v%d is now available.\n", i));
}
}
}
if (busy->vscr_busy)
TRACE(trace_model, ("VSCR Register is now available.\n", spr_name(busy->spr_busy)));
# Trace making registers busy
void::model-static::model_trace_make_busy:model_data *model_ptr, unsigned32 int_mask, unsigned32 fp_mask, unsigned32 cr_mask
@ -398,6 +411,8 @@ void::model-internal::model_new_cycle:model_data *model_ptr
model_ptr->cr_fpscr_busy &= ~cur_busy->cr_fpscr_busy;
if (cur_busy->spr_busy != PPC_NO_SPR)
model_ptr->spr_busy[cur_busy->spr_busy] = 0;
model_ptr->vr_busy &= ~cur_busy->vr_busy;
model_ptr->vscr_busy = ~cur_busy->vscr_busy;
if (WITH_TRACE && ppc_trace[trace_model])
model_trace_release(model_ptr, cur_busy);
@ -454,6 +469,8 @@ model_busy *::model-internal::model_make_busy:model_data *model_ptr, ppc_functio
busy->fp_busy = 0;
busy->cr_fpscr_busy = 0;
busy->nr_writebacks = 0;
busy->vr_busy = 0;
busy->vscr_busy = 0;
}
busy->unit = unit;
@ -4973,3 +4990,6 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
0.31,6.RT,11.RA,16.RB,21.310,31./:X:earwax::External Control In Word Indexed
0.31,6.RS,11.RA,16.RB,21.438,31./:X:earwax::External Control Out Word Indexed
:include:::altivec.igen
:include:::e500.igen

View File

@ -31,6 +31,7 @@ DEC:22:0:0
SDR1:25:0:0
SRR0:26:0:0
SRR1:27:0:0
VRSAVE:256:0:0
SPRG0:272:0:0
SPRG1:273:0:0
SPRG2:274:0:0
@ -39,6 +40,7 @@ EAR:282:0:0
TBL:284:0:0
TBU:285:0:0
PVR:287:0:0
SPEFSCR:512:0:0
IBAT0U:528:0:0
IBAT0L:529:0:0
IBAT1U:530:0:0

View File

@ -848,6 +848,30 @@ psim_read_register(psim *system,
*(unsigned_word*)cooked_buf = model_get_number_of_cycles(cpu_model(processor));
break;
#ifdef WITH_ALTIVEC
case reg_vr:
*(vreg*)cooked_buf = cpu_registers(processor)->altivec.vr[description.index];
break;
case reg_vscr:
*(vscreg*)cooked_buf = cpu_registers(processor)->altivec.vscr;
break;
#endif
#ifdef WITH_E500
case reg_gprh:
*(gpreg*)cooked_buf = cpu_registers(processor)->e500.gprh[description.index];
break;
case reg_evr:
*(unsigned64*)cooked_buf = EVR(description.index);
break;
case reg_acc:
*(accreg*)cooked_buf = cpu_registers(processor)->e500.acc;
break;
#endif
default:
printf_filtered("psim_read_register(processor=0x%lx,buf=0x%lx,reg=%s) %s\n",
(unsigned long)processor, (unsigned long)buf, reg,
@ -873,6 +897,21 @@ psim_read_register(psim *system,
case 8:
*(unsigned_8*)buf = H2T_8(*(unsigned_8*)cooked_buf);
break;
#ifdef WITH_ALTIVEC
case 16:
if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
{
union { vreg v; unsigned_8 d[2]; } h, t;
memcpy(&h.v/*dest*/, cooked_buf/*src*/, description.size);
{ _SWAP_8(t.d[0] =, h.d[1]); }
{ _SWAP_8(t.d[1] =, h.d[0]); }
memcpy(buf/*dest*/, &t/*src*/, description.size);
break;
}
else
memcpy(buf/*dest*/, cooked_buf/*src*/, description.size);
break;
#endif
}
}
else {
@ -937,6 +976,20 @@ psim_write_register(psim *system,
case 8:
*(unsigned_8*)cooked_buf = T2H_8(*(unsigned_8*)buf);
break;
#ifdef WITH_ALTIVEC
case 16:
if (CURRENT_HOST_BYTE_ORDER != CURRENT_TARGET_BYTE_ORDER)
{
union { vreg v; unsigned_8 d[2]; } h, t;
memcpy(&t.v/*dest*/, buf/*src*/, description.size);
{ _SWAP_8(h.d[0] =, t.d[1]); }
{ _SWAP_8(h.d[1] =, t.d[0]); }
memcpy(cooked_buf/*dest*/, &h/*src*/, description.size);
break;
}
else
memcpy(cooked_buf/*dest*/, buf/*src*/, description.size);
#endif
}
}
else {
@ -978,6 +1031,35 @@ psim_write_register(psim *system,
cpu_registers(processor)->fpscr = *(fpscreg*)cooked_buf;
break;
#ifdef WITH_E500
case reg_gprh:
cpu_registers(processor)->e500.gprh[description.index] = *(gpreg*)cooked_buf;
break;
case reg_evr:
{
unsigned64 v;
v = *(unsigned64*)cooked_buf;
cpu_registers(processor)->e500.gprh[description.index] = v >> 32;
cpu_registers(processor)->gpr[description.index] = v;
break;
}
case reg_acc:
cpu_registers(processor)->e500.acc = *(accreg*)cooked_buf;
break;
#endif
#ifdef WITH_ALTIVEC
case reg_vr:
cpu_registers(processor)->altivec.vr[description.index] = *(vreg*)cooked_buf;
break;
case reg_vscr:
cpu_registers(processor)->altivec.vscr = *(vscreg*)cooked_buf;
break;
#endif
default:
printf_filtered("psim_write_register(processor=0x%lx,cooked_buf=0x%lx,reg=%s) %s\n",
(unsigned long)processor, (unsigned long)cooked_buf, reg,

View File

@ -150,6 +150,35 @@ register_description(const char reg[])
description.index = spr_ctr;
description.size = sizeof(unsigned_word);
}
#ifdef WITH_ALTIVEC
else if (reg[0] == 'v' && reg[1] == 'r' && are_digits(reg + 2)) {
description.type = reg_vr;
description.index = atoi(reg+2);
description.size = sizeof(vreg);
}
else if (!strcmp(reg, "vscr")) {
description.type = reg_vscr;
description.index = 0;
description.size = sizeof(vscreg);
}
#endif
#ifdef WITH_E500
else if (reg[0] == 'e' && reg[1] == 'v' && are_digits(reg + 2)) {
description.type = reg_evr;
description.index = atoi(reg+2);
description.size = sizeof(unsigned64);
}
else if (reg[0] == 'r' && reg[1] == 'h' && are_digits(reg + 2)) {
description.type = reg_gprh;
description.index = atoi(reg+2);
description.size = sizeof(gpreg);
}
else if (!strcmp(reg, "acc")) {
description.type = reg_acc;
description.index = 0;
description.size = sizeof(unsigned64);
}
#endif
else {
sprs spr = find_spr(reg);
if (spr != nr_of_sprs) {

View File

@ -1,6 +1,6 @@
/* This file is part of the program psim.
Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
Copyright 1994, 1997, 2003 Andrew Cagney
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
@ -28,6 +28,19 @@
*
*/
/* FIXME:
For the moment use macro's to determine if the E500 or Altivec
registers should be included. IGEN should instead of a :register:
field to facilitate the specification and generation of per ISA
registers. */
#ifdef WITH_E500
#include "e500_registers.h"
#endif
#if WITH_ALTIVEC
#include "altivec_registers.h"
#endif
/**
** General Purpose Registers
@ -228,7 +241,6 @@ enum {
srr1_subsequent_instruction = BIT(47)
};
/**
** storage interrupt registers
**/
@ -264,8 +276,14 @@ typedef struct _registers {
/* Segment Registers */
sreg sr[nr_of_srs];
} registers;
#if WITH_ALTIVEC
struct altivec_regs altivec;
#endif
#if WITH_E500
struct e500_regs e500;
#endif
} registers;
/* dump out all the registers */
@ -281,6 +299,12 @@ typedef enum {
reg_gpr, reg_fpr, reg_spr, reg_msr,
reg_cr, reg_fpscr, reg_pc, reg_sr,
reg_insns, reg_stalls, reg_cycles,
#ifdef WITH_ALTIVEC
reg_vr, reg_vscr,
#endif
#ifdef WITH_E500
reg_acc, reg_gprh, reg_evr,
#endif
nr_register_types
} register_types;