cpuinfo.pas 7.3 KB

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