cpuinfo.pas 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for the m68k
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. Unit CPUInfo;
  11. {$i fpcdefs.inc}
  12. Interface
  13. uses
  14. globtype;
  15. Type
  16. bestreal = double;
  17. {$if FPC_FULLVERSION>20700}
  18. bestrealrec = TDoubleRec;
  19. {$endif FPC_FULLVERSION>20700}
  20. ts32real = single;
  21. ts64real = double;
  22. ts80real = extended;
  23. ts128real = type extended;
  24. ts64comp = extended;
  25. pbestreal=^bestreal;
  26. { possible supported processors for this target }
  27. tcputype =
  28. (cpu_none,
  29. cpu_MC68000,
  30. cpu_MC68020,
  31. cpu_MC68040,
  32. cpu_MC68060,
  33. cpu_isa_a,
  34. cpu_isa_a_p,
  35. cpu_isa_b,
  36. cpu_isa_c,
  37. cpu_cfv4e
  38. );
  39. tfputype =
  40. (fpu_none,
  41. fpu_soft,
  42. fpu_libgcc,
  43. fpu_68881,
  44. fpu_coldfire
  45. );
  46. tcontrollertype =
  47. (ct_none
  48. );
  49. tcontrollerdatatype = record
  50. controllertypestr, controllerunitstr: string[20];
  51. cputype: tcputype; fputype: tfputype;
  52. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  53. end;
  54. Const
  55. { Is there support for dealing with multiple microcontrollers available }
  56. { for this platform? }
  57. ControllerSupport = false;
  58. { We know that there are fields after sramsize
  59. but we don't care about this warning }
  60. {$PUSH}
  61. {$WARN 3177 OFF}
  62. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  63. (
  64. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; flashbase:0; flashsize:0; srambase:0; sramsize:0));
  65. {$POP}
  66. { calling conventions supported by the code generator }
  67. supported_calling_conventions : tproccalloptions = [
  68. pocall_internproc,
  69. pocall_register,
  70. pocall_stdcall,
  71. pocall_safecall,
  72. { the difference to stdcall is only the name mangling }
  73. pocall_cdecl,
  74. { the difference to stdcall is only the name mangling }
  75. pocall_cppdecl,
  76. { this is used by PalmOS, Atari and Amiga-likes }
  77. pocall_syscall
  78. ];
  79. cputypestr : array[tcputype] of string[8] = ('',
  80. '68000',
  81. '68020',
  82. '68040',
  83. '68060',
  84. 'ISAA',
  85. 'ISAA+',
  86. 'ISAB',
  87. 'ISAC',
  88. 'CFV4E'
  89. );
  90. gascputypestr : array[tcputype] of string[8] = ('',
  91. '68000',
  92. '68020',
  93. '68040',
  94. '68060',
  95. 'isaa',
  96. 'isaaplus',
  97. 'isab',
  98. 'isac',
  99. 'cfv4e'
  100. );
  101. fputypestr : array[tfputype] of string[8] = (
  102. 'NONE',
  103. 'SOFT',
  104. 'LIBGCC',
  105. '68881',
  106. 'COLDFIRE'
  107. );
  108. { Supported optimizations, only used for information }
  109. supported_optimizerswitches = genericlevel1optimizerswitches+
  110. genericlevel2optimizerswitches+
  111. genericlevel3optimizerswitches-
  112. { no need to write info about those }
  113. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  114. [cs_opt_regvar,cs_opt_stackframe,cs_opt_loopunroll,
  115. cs_opt_tailrecursion,cs_opt_nodecse,
  116. cs_opt_reorder_fields,cs_opt_fastmath];
  117. level1optimizerswitches = genericlevel1optimizerswitches;
  118. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  119. [cs_opt_regvar,cs_opt_stackframe,cs_opt_tailrecursion,cs_opt_nodecse];
  120. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}];
  121. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  122. type
  123. tcpuflags =
  124. (CPUM68K_HAS_DBRA, { CPU supports the DBRA instruction }
  125. CPUM68K_HAS_CAS, { CPU supports the CAS instruction }
  126. CPUM68K_HAS_TAS, { CPU supports the TAS instruction }
  127. CPUM68K_HAS_BRAL, { CPU supports the BRA.L/Bcc.L instructions }
  128. CPUM68K_HAS_ROLROR, { CPU supports the ROL/ROR and ROXL/ROXR instructions }
  129. CPUM68K_HAS_BYTEREV, { CPU supports the BYTEREV instruction }
  130. CPUM68K_HAS_MVSMVZ, { CPU supports the MVZ and MVS instructions }
  131. CPUM68K_HAS_MOVE16, { CPU supports the MOVE16 instruction }
  132. CPUM68K_HAS_32BITMUL, { CPU supports MULS/MULU 32x32 -> 32bit }
  133. CPUM68K_HAS_64BITMUL, { CPU supports MULS/MULU 32x32 -> 64bit }
  134. CPUM68K_HAS_16BITDIV, { CPU supports DIVS/DIVU 32/16 -> 16bit }
  135. CPUM68K_HAS_32BITDIV, { CPU supports DIVS/DIVU 32/32 -> 32bit }
  136. CPUM68K_HAS_64BITDIV, { CPU supports DIVS/DIVU 64/32 -> 32bit }
  137. CPUM68K_HAS_REMSREMU, { CPU supports the REMS/REMU instructions }
  138. CPUM68K_HAS_UNALIGNED, { CPU supports unaligned access }
  139. CPUM68K_HAS_BASEDISP { CPU supports addressing with 32bit base displacements }
  140. );
  141. const
  142. cpu_capabilities : array[tcputype] of set of tcpuflags =
  143. ( { cpu_none } [],
  144. { cpu_68000 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_TAS,CPUM68K_HAS_ROLROR,CPUM68K_HAS_16BITDIV],
  145. { cpu_68020 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_CAS,CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_ROLROR,CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_BASEDISP,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_64BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_64BITDIV],
  146. { cpu_68040 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_CAS,CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_ROLROR,CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_BASEDISP,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_64BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_64BITDIV,CPUM68K_HAS_MOVE16],
  147. { cpu_68060 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_CAS,CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_ROLROR,CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_BASEDISP,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_MOVE16],
  148. { cpu_isaa } [CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_REMSREMU],
  149. { cpu_isaap } [CPUM68K_HAS_BRAL,CPUM68K_HAS_BYTEREV,CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_REMSREMU],
  150. { cpu_isab } [CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_MVSMVZ,CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_REMSREMU],
  151. { cpu_isac } [CPUM68K_HAS_TAS,CPUM68K_HAS_BYTEREV,CPUM68K_HAS_MVSMVZ,CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_REMSREMU],
  152. { cpu_cfv4e } [CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_MVSMVZ,CPUM68K_HAS_UNALIGNED,CPUM68K_HAS_32BITMUL,CPUM68K_HAS_16BITDIV,CPUM68K_HAS_32BITDIV,CPUM68K_HAS_REMSREMU]
  153. );
  154. { all CPUs commonly called "coldfire" }
  155. cpu_coldfire = [cpu_isa_a,cpu_isa_a_p,cpu_isa_b,cpu_isa_c,cpu_cfv4e];
  156. { all CPUs commonly called "68020+" }
  157. cpu_mc68020p = [cpu_mc68020,cpu_mc68040,cpu_mc68060];
  158. Implementation
  159. end.