Browse Source
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 .ezannoni_pie-20030916-branch
16 changed files with 6387 additions and 99 deletions
File diff suppressed because it is too large
@ -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) |
|||
@ -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 |
|||
File diff suppressed because it is too large
@ -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. */; \ |
|||
} \ |
|||
} |
|||
@ -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)) |
|||
Loading…
Reference in new issue