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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [sim/] [ppc/] [registers.h] - Diff between revs 827 and 840

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 827 Rev 840
/*  This file is part of the program psim.
/*  This file is part of the program psim.
 
 
    Copyright 1994, 1997, 2003 Andrew Cagney
    Copyright 1994, 1997, 2003 Andrew Cagney
 
 
    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 2 of the License, or
    the Free Software Foundation; either version 2 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, write to the Free Software
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 
    */
    */
 
 
 
 
#ifndef _REGISTERS_H_
#ifndef _REGISTERS_H_
#define _REGISTERS_H_
#define _REGISTERS_H_
 
 
 
 
/*
/*
 * The PowerPC registers
 * The PowerPC registers
 *
 *
 */
 */
 
 
/* FIXME:
/* FIXME:
 
 
   For the moment use macro's to determine if the E500 or Altivec
   For the moment use macro's to determine if the E500 or Altivec
   registers should be included.  IGEN should instead of a :register:
   registers should be included.  IGEN should instead of a :register:
   field to facilitate the specification and generation of per ISA
   field to facilitate the specification and generation of per ISA
   registers.  */
   registers.  */
 
 
#ifdef WITH_E500
#ifdef WITH_E500
#include "e500_registers.h"
#include "e500_registers.h"
#endif
#endif
#if WITH_ALTIVEC
#if WITH_ALTIVEC
#include "altivec_registers.h"
#include "altivec_registers.h"
#endif
#endif
 
 
/**
/**
 ** General Purpose Registers
 ** General Purpose Registers
 **/
 **/
 
 
typedef signed_word gpreg;
typedef signed_word gpreg;
 
 
 
 
 
 
/**
/**
 ** Floating Point Registers
 ** Floating Point Registers
 **/
 **/
 
 
typedef unsigned64 fpreg;
typedef unsigned64 fpreg;
 
 
 
 
 
 
/**
/**
 ** The condition register
 ** The condition register
 **
 **
 **/
 **/
 
 
typedef unsigned32 creg;
typedef unsigned32 creg;
 
 
/* The following sub bits are defined for the condition register */
/* The following sub bits are defined for the condition register */
enum {
enum {
  cr_i_negative = BIT4(0),
  cr_i_negative = BIT4(0),
  cr_i_positive = BIT4(1),
  cr_i_positive = BIT4(1),
  cr_i_zero = BIT4(2),
  cr_i_zero = BIT4(2),
  cr_i_summary_overflow = BIT4(3),
  cr_i_summary_overflow = BIT4(3),
#if 0
#if 0
  /* cr0 - integer status */
  /* cr0 - integer status */
  cr0_i_summary_overflow_bit = 3,
  cr0_i_summary_overflow_bit = 3,
  cr0_i_negative = BIT32(0),
  cr0_i_negative = BIT32(0),
  cr0_i_positive = BIT32(1),
  cr0_i_positive = BIT32(1),
  cr0_i_zero = BIT32(2),
  cr0_i_zero = BIT32(2),
  cr0_i_summary_overflow = BIT32(3),
  cr0_i_summary_overflow = BIT32(3),
  cr0_i_mask = MASK32(0,3),
  cr0_i_mask = MASK32(0,3),
#endif
#endif
  /* cr1 - floating-point status */
  /* cr1 - floating-point status */
  cr1_i_floating_point_exception_summary_bit = 4,
  cr1_i_floating_point_exception_summary_bit = 4,
  cr1_i_floating_point_enabled_exception_summary_bit = 5,
  cr1_i_floating_point_enabled_exception_summary_bit = 5,
  cr1_i_floating_point_invalid_operation_exception_summary_bit = 6,
  cr1_i_floating_point_invalid_operation_exception_summary_bit = 6,
  cr1_i_floating_point_overflow_exception_bit = 7,
  cr1_i_floating_point_overflow_exception_bit = 7,
  cr1_i_floating_point_exception_summary = BIT32(4),
  cr1_i_floating_point_exception_summary = BIT32(4),
  cr1_i_floating_point_enabled_exception_summary = BIT32(5),
  cr1_i_floating_point_enabled_exception_summary = BIT32(5),
  cr1_i_floating_point_invalid_operation_exception_summary = BIT32(6),
  cr1_i_floating_point_invalid_operation_exception_summary = BIT32(6),
  cr1_i_floating_point_overflow_exception = BIT32(7),
  cr1_i_floating_point_overflow_exception = BIT32(7),
  cr1_i_mask = MASK32(4,7),
  cr1_i_mask = MASK32(4,7),
};
};
 
 
 
 
/* Condition register 1 contains the result of floating point arithmetic */
/* Condition register 1 contains the result of floating point arithmetic */
enum {
enum {
  cr_fp_exception = BIT4(0),
  cr_fp_exception = BIT4(0),
  cr_fp_enabled_exception = BIT4(1),
  cr_fp_enabled_exception = BIT4(1),
  cr_fp_invalid_exception = BIT4(2),
  cr_fp_invalid_exception = BIT4(2),
  cr_fp_overflow_exception = BIT4(3),
  cr_fp_overflow_exception = BIT4(3),
};
};
 
 
 
 
 
 
/**
/**
 ** Floating-Point Status and Control Register
 ** Floating-Point Status and Control Register
 **/
 **/
 
 
typedef unsigned32 fpscreg;
typedef unsigned32 fpscreg;
enum {
enum {
  fpscr_fx_bit = 0,
  fpscr_fx_bit = 0,
  fpscr_fx = BIT32(0),
  fpscr_fx = BIT32(0),
  fpscr_fex_bit = 1,
  fpscr_fex_bit = 1,
  fpscr_fex = BIT32(1),
  fpscr_fex = BIT32(1),
  fpscr_vx_bit = 2,
  fpscr_vx_bit = 2,
  fpscr_vx = BIT32(2),
  fpscr_vx = BIT32(2),
  fpscr_ox_bit = 3,
  fpscr_ox_bit = 3,
  fpscr_ox = BIT32(3),
  fpscr_ox = BIT32(3),
  fpscr_ux = BIT32(4),
  fpscr_ux = BIT32(4),
  fpscr_zx = BIT32(5),
  fpscr_zx = BIT32(5),
  fpscr_xx = BIT32(6),
  fpscr_xx = BIT32(6),
  fpscr_vxsnan = BIT32(7), /* SNAN */
  fpscr_vxsnan = BIT32(7), /* SNAN */
  fpscr_vxisi = BIT32(8), /* INF - INF */
  fpscr_vxisi = BIT32(8), /* INF - INF */
  fpscr_vxidi = BIT32(9), /* INF / INF */
  fpscr_vxidi = BIT32(9), /* INF / INF */
  fpscr_vxzdz = BIT32(10), /* 0 / 0 */
  fpscr_vxzdz = BIT32(10), /* 0 / 0 */
  fpscr_vximz = BIT32(11), /* INF * 0 */
  fpscr_vximz = BIT32(11), /* INF * 0 */
  fpscr_vxvc = BIT32(12),
  fpscr_vxvc = BIT32(12),
  fpscr_fr = BIT32(13),
  fpscr_fr = BIT32(13),
  fpscr_fi = BIT32(14),
  fpscr_fi = BIT32(14),
  fpscr_fprf = MASK32(15, 19),
  fpscr_fprf = MASK32(15, 19),
  fpscr_c = BIT32(15),
  fpscr_c = BIT32(15),
  fpscr_fpcc_bit = 16, /* well sort of */
  fpscr_fpcc_bit = 16, /* well sort of */
  fpscr_fpcc = MASK32(16, 19),
  fpscr_fpcc = MASK32(16, 19),
  fpscr_fl = BIT32(16),
  fpscr_fl = BIT32(16),
  fpscr_fg = BIT32(17),
  fpscr_fg = BIT32(17),
  fpscr_fe = BIT32(18),
  fpscr_fe = BIT32(18),
  fpscr_fu = BIT32(19),
  fpscr_fu = BIT32(19),
  fpscr_rf_quiet_nan = fpscr_c | fpscr_fu,
  fpscr_rf_quiet_nan = fpscr_c | fpscr_fu,
  fpscr_rf_neg_infinity = fpscr_fl | fpscr_fu,
  fpscr_rf_neg_infinity = fpscr_fl | fpscr_fu,
  fpscr_rf_neg_normal_number = fpscr_fl,
  fpscr_rf_neg_normal_number = fpscr_fl,
  fpscr_rf_neg_denormalized_number = fpscr_c | fpscr_fl,
  fpscr_rf_neg_denormalized_number = fpscr_c | fpscr_fl,
  fpscr_rf_neg_zero = fpscr_c | fpscr_fe,
  fpscr_rf_neg_zero = fpscr_c | fpscr_fe,
  fpscr_rf_pos_zero = fpscr_fe,
  fpscr_rf_pos_zero = fpscr_fe,
  fpscr_rf_pos_denormalized_number = fpscr_c | fpscr_fg,
  fpscr_rf_pos_denormalized_number = fpscr_c | fpscr_fg,
  fpscr_rf_pos_normal_number = fpscr_fg,
  fpscr_rf_pos_normal_number = fpscr_fg,
  fpscr_rf_pos_infinity = fpscr_fg | fpscr_fu,
  fpscr_rf_pos_infinity = fpscr_fg | fpscr_fu,
  fpscr_reserved_20 = BIT32(20),
  fpscr_reserved_20 = BIT32(20),
  fpscr_vxsoft = BIT32(21),
  fpscr_vxsoft = BIT32(21),
  fpscr_vxsqrt = BIT32(22),
  fpscr_vxsqrt = BIT32(22),
  fpscr_vxcvi = BIT32(23),
  fpscr_vxcvi = BIT32(23),
  fpscr_ve = BIT32(24),
  fpscr_ve = BIT32(24),
  fpscr_oe = BIT32(25),
  fpscr_oe = BIT32(25),
  fpscr_ue = BIT32(26),
  fpscr_ue = BIT32(26),
  fpscr_ze = BIT32(27),
  fpscr_ze = BIT32(27),
  fpscr_xe = BIT32(28),
  fpscr_xe = BIT32(28),
  fpscr_ni = BIT32(29),
  fpscr_ni = BIT32(29),
  fpscr_rn = MASK32(30, 31),
  fpscr_rn = MASK32(30, 31),
  fpscr_rn_round_to_nearest = 0,
  fpscr_rn_round_to_nearest = 0,
  fpscr_rn_round_towards_zero = MASK32(31,31),
  fpscr_rn_round_towards_zero = MASK32(31,31),
  fpscr_rn_round_towards_pos_infinity = MASK32(30,30),
  fpscr_rn_round_towards_pos_infinity = MASK32(30,30),
  fpscr_rn_round_towards_neg_infinity = MASK32(30,31),
  fpscr_rn_round_towards_neg_infinity = MASK32(30,31),
  fpscr_vx_bits = (fpscr_vxsnan | fpscr_vxisi | fpscr_vxidi
  fpscr_vx_bits = (fpscr_vxsnan | fpscr_vxisi | fpscr_vxidi
                   | fpscr_vxzdz | fpscr_vximz | fpscr_vxvc
                   | fpscr_vxzdz | fpscr_vximz | fpscr_vxvc
                   | fpscr_vxsoft | fpscr_vxsqrt | fpscr_vxcvi),
                   | fpscr_vxsoft | fpscr_vxsqrt | fpscr_vxcvi),
};
};
 
 
 
 
 
 
/**
/**
 ** XER Register
 ** XER Register
 **/
 **/
 
 
typedef unsigned32 xereg;
typedef unsigned32 xereg;
 
 
enum {
enum {
  xer_summary_overflow = BIT32(0), xer_summary_overflow_bit = 0,
  xer_summary_overflow = BIT32(0), xer_summary_overflow_bit = 0,
  xer_carry = BIT32(2), xer_carry_bit = 2,
  xer_carry = BIT32(2), xer_carry_bit = 2,
  xer_overflow = BIT32(1),
  xer_overflow = BIT32(1),
  xer_reserved_3_24 = MASK32(3,24),
  xer_reserved_3_24 = MASK32(3,24),
  xer_byte_count_mask = MASK32(25,31)
  xer_byte_count_mask = MASK32(25,31)
};
};
 
 
 
 
/**
/**
 ** SPR's
 ** SPR's
 **/
 **/
 
 
#include "spreg.h"
#include "spreg.h"
 
 
 
 
/**
/**
 ** Segment Registers
 ** Segment Registers
 **/
 **/
 
 
typedef unsigned32 sreg;
typedef unsigned32 sreg;
enum {
enum {
  nr_of_srs = 16
  nr_of_srs = 16
};
};
 
 
 
 
/**
/**
 ** Machine state register
 ** Machine state register
 **/
 **/
typedef unsigned_word msreg; /* 32 or 64 bits */
typedef unsigned_word msreg; /* 32 or 64 bits */
 
 
enum {
enum {
#if (WITH_TARGET_WORD_BITSIZE == 64)
#if (WITH_TARGET_WORD_BITSIZE == 64)
  msr_64bit_mode = BIT(0),
  msr_64bit_mode = BIT(0),
#endif
#endif
#if (WITH_TARGET_WORD_BITSIZE == 32)
#if (WITH_TARGET_WORD_BITSIZE == 32)
  msr_64bit_mode = 0,
  msr_64bit_mode = 0,
#endif
#endif
  msr_power_management_enable = BIT(45),
  msr_power_management_enable = BIT(45),
  msr_tempoary_gpr_remapping = BIT(46), /* 603 specific */
  msr_tempoary_gpr_remapping = BIT(46), /* 603 specific */
  msr_interrupt_little_endian_mode = BIT(47),
  msr_interrupt_little_endian_mode = BIT(47),
  msr_external_interrupt_enable = BIT(48),
  msr_external_interrupt_enable = BIT(48),
  msr_problem_state = BIT(49),
  msr_problem_state = BIT(49),
  msr_floating_point_available = BIT(50),
  msr_floating_point_available = BIT(50),
  msr_machine_check_enable = BIT(51),
  msr_machine_check_enable = BIT(51),
  msr_floating_point_exception_mode_0 = BIT(52),
  msr_floating_point_exception_mode_0 = BIT(52),
  msr_single_step_trace_enable = BIT(53),
  msr_single_step_trace_enable = BIT(53),
  msr_branch_trace_enable = BIT(54),
  msr_branch_trace_enable = BIT(54),
  msr_floating_point_exception_mode_1 = BIT(55),
  msr_floating_point_exception_mode_1 = BIT(55),
  msr_interrupt_prefix = BIT(57),
  msr_interrupt_prefix = BIT(57),
  msr_instruction_relocate = BIT(58),
  msr_instruction_relocate = BIT(58),
  msr_data_relocate = BIT(59),
  msr_data_relocate = BIT(59),
  msr_recoverable_interrupt = BIT(62),
  msr_recoverable_interrupt = BIT(62),
  msr_little_endian_mode = BIT(63)
  msr_little_endian_mode = BIT(63)
};
};
 
 
enum {
enum {
  srr1_hash_table_or_ibat_miss = BIT(33),
  srr1_hash_table_or_ibat_miss = BIT(33),
  srr1_direct_store_error_exception = BIT(35),
  srr1_direct_store_error_exception = BIT(35),
  srr1_protection_violation = BIT(36),
  srr1_protection_violation = BIT(36),
  srr1_segment_table_miss = BIT(42),
  srr1_segment_table_miss = BIT(42),
  srr1_floating_point_enabled = BIT(43),
  srr1_floating_point_enabled = BIT(43),
  srr1_illegal_instruction = BIT(44),
  srr1_illegal_instruction = BIT(44),
  srr1_priviliged_instruction = BIT(45),
  srr1_priviliged_instruction = BIT(45),
  srr1_trap = BIT(46),
  srr1_trap = BIT(46),
  srr1_subsequent_instruction = BIT(47)
  srr1_subsequent_instruction = BIT(47)
};
};
 
 
/**
/**
 ** storage interrupt registers
 ** storage interrupt registers
 **/
 **/
 
 
typedef enum {
typedef enum {
  dsisr_direct_store_error_exception = BIT32(0),
  dsisr_direct_store_error_exception = BIT32(0),
  dsisr_hash_table_or_dbat_miss = BIT32(1),
  dsisr_hash_table_or_dbat_miss = BIT32(1),
  dsisr_protection_violation = BIT32(4),
  dsisr_protection_violation = BIT32(4),
  dsisr_earwax_violation = BIT32(5),
  dsisr_earwax_violation = BIT32(5),
  dsisr_store_operation = BIT32(6),
  dsisr_store_operation = BIT32(6),
  dsisr_segment_table_miss = BIT32(10),
  dsisr_segment_table_miss = BIT32(10),
  dsisr_earwax_disabled = BIT32(11)
  dsisr_earwax_disabled = BIT32(11)
} dsisr_status;
} dsisr_status;
 
 
 
 
 
 
/**
/**
 ** And the registers proper
 ** And the registers proper
 **/
 **/
typedef struct _registers {
typedef struct _registers {
 
 
  gpreg gpr[32];
  gpreg gpr[32];
  fpreg fpr[32];
  fpreg fpr[32];
  creg cr;
  creg cr;
  fpscreg fpscr;
  fpscreg fpscr;
 
 
  /* Machine state register */
  /* Machine state register */
  msreg msr;
  msreg msr;
 
 
  /* Spr's */
  /* Spr's */
  spreg spr[nr_of_sprs];
  spreg spr[nr_of_sprs];
 
 
  /* Segment Registers */
  /* Segment Registers */
  sreg sr[nr_of_srs];
  sreg sr[nr_of_srs];
 
 
#if WITH_ALTIVEC
#if WITH_ALTIVEC
  struct altivec_regs altivec;
  struct altivec_regs altivec;
#endif
#endif
#if WITH_E500
#if WITH_E500
  struct e500_regs e500;
  struct e500_regs e500;
#endif
#endif
 
 
} registers;
} registers;
 
 
/* dump out all the registers */
/* dump out all the registers */
 
 
INLINE_REGISTERS\
INLINE_REGISTERS\
(void) registers_dump
(void) registers_dump
(registers *regs);
(registers *regs);
 
 
 
 
/* return information on a register based on name */
/* return information on a register based on name */
 
 
typedef enum {
typedef enum {
  reg_invalid,
  reg_invalid,
  reg_gpr, reg_fpr, reg_spr, reg_msr,
  reg_gpr, reg_fpr, reg_spr, reg_msr,
  reg_cr, reg_fpscr, reg_pc, reg_sr,
  reg_cr, reg_fpscr, reg_pc, reg_sr,
  reg_insns, reg_stalls, reg_cycles,
  reg_insns, reg_stalls, reg_cycles,
#ifdef WITH_ALTIVEC
#ifdef WITH_ALTIVEC
  reg_vr, reg_vscr,
  reg_vr, reg_vscr,
#endif
#endif
#ifdef WITH_E500
#ifdef WITH_E500
  reg_acc, reg_gprh, reg_evr,
  reg_acc, reg_gprh, reg_evr,
#endif
#endif
  nr_register_types
  nr_register_types
} register_types;
} register_types;
 
 
typedef struct {
typedef struct {
  register_types type;
  register_types type;
  int index;
  int index;
  int size;
  int size;
} register_descriptions;
} register_descriptions;
 
 
INLINE_REGISTERS\
INLINE_REGISTERS\
(register_descriptions) register_description
(register_descriptions) register_description
(const char reg[]);
(const char reg[]);
 
 
 
 
/* Special purpose registers by their more common names */
/* Special purpose registers by their more common names */
 
 
#define SPREG(N)        cpu_registers(processor)->spr[N]
#define SPREG(N)        cpu_registers(processor)->spr[N]
#define XER             SPREG(spr_xer)
#define XER             SPREG(spr_xer)
#define LR              SPREG(spr_lr)
#define LR              SPREG(spr_lr)
#define CTR             SPREG(spr_ctr)
#define CTR             SPREG(spr_ctr)
#define SRR0            SPREG(spr_srr0)
#define SRR0            SPREG(spr_srr0)
#define SRR1            SPREG(spr_srr1)
#define SRR1            SPREG(spr_srr1)
#define DAR             SPREG(spr_dar)
#define DAR             SPREG(spr_dar)
#define DSISR           SPREG(spr_dsisr)
#define DSISR           SPREG(spr_dsisr)
 
 
/* general purpose registers - indexed access */
/* general purpose registers - indexed access */
#define GPR(N)          cpu_registers(processor)->gpr[N]
#define GPR(N)          cpu_registers(processor)->gpr[N]
 
 
/* segment registers */
/* segment registers */
#define SEGREG(N)       cpu_registers(processor)->sr[N]
#define SEGREG(N)       cpu_registers(processor)->sr[N]
 
 
/* condition register */
/* condition register */
#define CR              cpu_registers(processor)->cr
#define CR              cpu_registers(processor)->cr
 
 
/* machine status register */
/* machine status register */
#define MSR             cpu_registers(processor)->msr
#define MSR             cpu_registers(processor)->msr
 
 
/* floating-point status condition register */
/* floating-point status condition register */
#define FPSCR           cpu_registers(processor)->fpscr
#define FPSCR           cpu_registers(processor)->fpscr
 
 
#endif /* _REGISTERS_H_ */
#endif /* _REGISTERS_H_ */
 
 

powered by: WebSVN 2.1.0

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