sim: constify arg to sim_do_command
[deliverable/binutils-gdb.git] / sim / ppc / ppc-instructions
index d08861046bb51883a64b196a02409ee9eedaf8ed..1b8fd89ad29a369b793002f6ed462996b52150bb 100644 (file)
@@ -1,7 +1,7 @@
 #
 #   This file is part of the program psim.
 #
-#   Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
+#   Copyright 1994, 1995, 1996, 1997, 2003, 2004 Andrew Cagney
 #
 #   --
 #
@@ -21,7 +21,7 @@
 #
 #   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
+#   the Free Software Foundation; either version 3 of the License, or
 #   (at your option) any later version.
 #
 #   This program is distributed in the hope that it will be useful,
@@ -30,8 +30,7 @@
 #   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.
+#   along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
 
 :cache::::RA:RA:
          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 */
          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 +323,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 +410,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 +468,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;
@@ -1264,7 +1280,7 @@ void::function::convert_to_integer:cpu *processor, unsigned_word cia, unsigned64
            /* FPSCR[fprf] = undefined */
          }
        /**/
-       LABEL(Done):
+       LABEL(Done):;
 
 
 # extract out raw fields of a FP number
@@ -2303,6 +2319,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
            GPR(r) = 0;
          }
          GPR(r) |= INSERTED(MEM(unsigned, EA, 1), i, i+7);
+         i = i + 8;
          if (i == 64) i = 32;
          EA = EA + 1;
          n = n - 1;
@@ -2476,7 +2493,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
        }
        PPC_INSN_INT(0, (RA_BITMASK & ~1) | RB_BITMASK | RS_BITMASK, 1/*Rc*/);
 
-0.31,6./,11./,16./,21.598,31./:X::sync:Synchronize
+0.31,6./,9.L,11./,16./,21.598,31./:X::sync:Synchronize
 *601: PPC_UNIT_IU,    PPC_UNIT_IU,    1,  1,  0
 *603: PPC_UNIT_SRU,   PPC_UNIT_SRU,   1,  1,  0
 *603e:PPC_UNIT_SRU,   PPC_UNIT_SRU,   1,  1,  0
@@ -3384,6 +3401,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
            case spr_dec:
              *rT = cpu_get_decrementer(processor);
              break;
+               case spr_tbrl:
+                 if (is_64bit_implementation) *rT = TB;
+                 else                         *rT = EXTRACTED64(TB, 32, 63);
+               break;
+               case spr_tbru:
+                 if (is_64bit_implementation) *rT = EXTRACTED64(TB, 0, 31);
+                 else                         *rT = EXTRACTED64(TB, 0, 31);
+               break;
            case spr_tbu:
            case spr_tbl:
              /* NOTE - these SPR's are not readable. Use mftb[ul] */
@@ -3626,6 +3651,18 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
        STORE(EA, 8, *frS);
        PPC_INSN_INT_FLOAT(0, 0, (RA_BITMASK & ~1) | RB_BITMASK, FRS_BITMASK);
 
+0.31,6.FRS,11.RA,16.RB,21.983,31./:X:f::Store Floating-Point Integer Word Indexed
+*603: PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
+*603e:PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
+*604: PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  3,  0
+       unsigned_word b;
+       unsigned_word EA;
+       if (RA_is_0) b = 0;
+       else         b = *rA;
+       EA = b + *rB;
+       STORE(EA, 4, *frS);
+       PPC_INSN_INT_FLOAT(0, 0, (RA_BITMASK & ~1) | RB_BITMASK, FRS_BITMASK);
+
 0.55,6.FRS,11.RA,16.D:D:f::Store Floating-Point Double with Update
 *601: PPC_UNIT_IU,    PPC_UNIT_IU,    1,  1,  0
 *603: PPC_UNIT_LSU,   PPC_UNIT_LSU,   1,  2,  0
@@ -3935,12 +3972,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 0, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -3980,12 +4019,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 1, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -4025,12 +4066,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 0, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -4070,12 +4113,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 1, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -4115,12 +4160,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 0, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -4160,12 +4207,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 1, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -4205,12 +4254,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 0, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -4250,12 +4301,14 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
                                 fpscr_vxsnan | fpscr_vximz,
                                 1, /*single?*/
                                 0) /*negate?*/) {
+         union { double d; unsigned64 u; } tmp;
          invalid_arithemetic_operation(processor, cia,
-                                       (unsigned64*)&product, *frA, 0, *frC,
+                                       &tmp.u, *frA, 0, *frC,
                                        0, /*instruction_is_frsp*/
                                        0, /*instruction_is_convert_to_64bit*/
                                        0, /*instruction_is_convert_to_32bit*/
                                        0); /*single-precision*/
+         product = tmp.d;
        }
        else {
          /*HACK!*/
@@ -4664,13 +4717,6 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia,
        FPSCR |= bit;
        FPSCR_END(Rc);
 
-
-#
-# I.A.1.1 Floating-Point Store Instruction
-#
-0.31,6.FRS,11.RA,16.RB,21.983,31./:X:f,o::Store Floating-Point as Integer Word Indexed
-       program_interrupt(processor, cia, optional_instruction_program_interrupt);
-
 #
 # I.A.1.2 Floating-Point Arithmetic Instructions
 #
@@ -4972,3 +5018,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
This page took 0.02856 seconds and 4 git commands to generate.