vfp.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. vfp/vfp.h - ARM VFPv3 emulation unit - vfp interface
  3. Copyright (C) 2003 Skyeye Develop Group
  4. for help please send mail to <skyeye-developer@lists.gro.clinux.org>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef __VFP_H__
  18. #define __VFP_H__
  19. #define DBG(...) DEBUG_LOG(ARM11, __VA_ARGS__)
  20. #define vfpdebug //printf
  21. #include "core/arm/interpreter/vfp/vfp_helper.h" /* for references to cdp SoftFloat functions */
  22. unsigned VFPInit (ARMul_State *state);
  23. unsigned VFPMRC (ARMul_State * state, unsigned type, ARMword instr, ARMword * value);
  24. unsigned VFPMCR (ARMul_State * state, unsigned type, ARMword instr, ARMword value);
  25. unsigned VFPMRRC (ARMul_State * state, unsigned type, ARMword instr, ARMword * value1, ARMword * value2);
  26. unsigned VFPMCRR (ARMul_State * state, unsigned type, ARMword instr, ARMword value1, ARMword value2);
  27. unsigned VFPSTC (ARMul_State * state, unsigned type, ARMword instr, ARMword * value);
  28. unsigned VFPLDC (ARMul_State * state, unsigned type, ARMword instr, ARMword value);
  29. unsigned VFPCDP (ARMul_State * state, unsigned type, ARMword instr);
  30. /* FPSID Information */
  31. #define VFP_FPSID_IMPLMEN 0 /* should be the same as cp15 0 c0 0*/
  32. #define VFP_FPSID_SW 0
  33. #define VFP_FPSID_SUBARCH 0x2 /* VFP version. Current is v3 (not strict) */
  34. #define VFP_FPSID_PARTNUM 0x1
  35. #define VFP_FPSID_VARIANT 0x1
  36. #define VFP_FPSID_REVISION 0x1
  37. /* FPEXC Flags */
  38. #define VFP_FPEXC_EX 1<<31
  39. #define VFP_FPEXC_EN 1<<30
  40. /* FPSCR Flags */
  41. #define VFP_FPSCR_NFLAG 1<<31
  42. #define VFP_FPSCR_ZFLAG 1<<30
  43. #define VFP_FPSCR_CFLAG 1<<29
  44. #define VFP_FPSCR_VFLAG 1<<28
  45. #define VFP_FPSCR_AHP 1<<26 /* Alternative Half Precision */
  46. #define VFP_FPSCR_DN 1<<25 /* Default NaN */
  47. #define VFP_FPSCR_FZ 1<<24 /* Flush-to-zero */
  48. #define VFP_FPSCR_RMODE 3<<22 /* Rounding Mode */
  49. #define VFP_FPSCR_STRIDE 3<<20 /* Stride (vector) */
  50. #define VFP_FPSCR_LEN 7<<16 /* Stride (vector) */
  51. #define VFP_FPSCR_IDE 1<<15 /* Input Denormal exc */
  52. #define VFP_FPSCR_IXE 1<<12 /* Inexact exc */
  53. #define VFP_FPSCR_UFE 1<<11 /* Undeflow exc */
  54. #define VFP_FPSCR_OFE 1<<10 /* Overflow exc */
  55. #define VFP_FPSCR_DZE 1<<9 /* Division by Zero exc */
  56. #define VFP_FPSCR_IOE 1<<8 /* Invalid Operation exc */
  57. #define VFP_FPSCR_IDC 1<<7 /* Input Denormal cum exc */
  58. #define VFP_FPSCR_IXC 1<<4 /* Inexact cum exc */
  59. #define VFP_FPSCR_UFC 1<<3 /* Undeflow cum exc */
  60. #define VFP_FPSCR_OFC 1<<2 /* Overflow cum exc */
  61. #define VFP_FPSCR_DZC 1<<1 /* Division by Zero cum exc */
  62. #define VFP_FPSCR_IOC 1<<0 /* Invalid Operation cum exc */
  63. /* Inline instructions. Note: Used in a cpp file as well */
  64. #ifdef __cplusplus
  65. extern "C" {
  66. #endif
  67. int32_t vfp_get_float(ARMul_State * state, unsigned int reg);
  68. void vfp_put_float(ARMul_State * state, int32_t val, unsigned int reg);
  69. uint64_t vfp_get_double(ARMul_State * state, unsigned int reg);
  70. void vfp_put_double(ARMul_State * state, uint64_t val, unsigned int reg);
  71. void vfp_raise_exceptions(ARMul_State * state, uint32_t exceptions, uint32_t inst, uint32_t fpscr);
  72. u32 vfp_single_cpdo(ARMul_State* state, u32 inst, u32 fpscr);
  73. u32 vfp_double_cpdo(ARMul_State* state, u32 inst, u32 fpscr);
  74. /* MRC */
  75. inline void VMRS(ARMul_State * state, ARMword reg, ARMword Rt, ARMword *value);
  76. inline void VMOVBRS(ARMul_State * state, ARMword to_arm, ARMword t, ARMword n, ARMword *value);
  77. inline void VMOVBRRD(ARMul_State * state, ARMword to_arm, ARMword t, ARMword t2, ARMword n, ARMword *value1, ARMword *value2);
  78. inline void VMOVI(ARMul_State * state, ARMword single, ARMword d, ARMword imm);
  79. inline void VMOVR(ARMul_State * state, ARMword single, ARMword d, ARMword imm);
  80. /* MCR */
  81. inline void VMSR(ARMul_State * state, ARMword reg, ARMword Rt);
  82. /* STC */
  83. inline int VSTM(ARMul_State * state, int type, ARMword instr, ARMword* value);
  84. inline int VPUSH(ARMul_State * state, int type, ARMword instr, ARMword* value);
  85. inline int VSTR(ARMul_State * state, int type, ARMword instr, ARMword* value);
  86. /* LDC */
  87. inline int VLDM(ARMul_State * state, int type, ARMword instr, ARMword value);
  88. inline int VPOP(ARMul_State * state, int type, ARMword instr, ARMword value);
  89. inline int VLDR(ARMul_State * state, int type, ARMword instr, ARMword value);
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif