cpuinfo.pas 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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_isa_a,
  32. cpu_isa_a_p,
  33. cpu_isa_b,
  34. cpu_isa_c
  35. );
  36. tfputype =
  37. (fpu_none,
  38. fpu_soft,
  39. fpu_libgcc,
  40. fpu_68881
  41. );
  42. tcontrollertype =
  43. (ct_none
  44. );
  45. tcontrollerdatatype = record
  46. controllertypestr, controllerunitstr: string[20];
  47. cputype: tcputype; fputype: tfputype;
  48. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  49. end;
  50. Const
  51. { Is there support for dealing with multiple microcontrollers available }
  52. { for this platform? }
  53. ControllerSupport = false;
  54. { We know that there are fields after sramsize
  55. but we don't care about this warning }
  56. {$PUSH}
  57. {$WARN 3177 OFF}
  58. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  59. (
  60. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; flashbase:0; flashsize:0; srambase:0; sramsize:0));
  61. {$POP}
  62. { calling conventions supported by the code generator }
  63. supported_calling_conventions : tproccalloptions = [
  64. pocall_internproc,
  65. pocall_stdcall,
  66. { the difference to stdcall is only the name mangling }
  67. pocall_cdecl,
  68. { the difference to stdcall is only the name mangling }
  69. pocall_cppdecl,
  70. { this used by the PalmOS port only }
  71. pocall_syscall
  72. ];
  73. cputypestr : array[tcputype] of string[8] = ('',
  74. '68000',
  75. '68020',
  76. '68040',
  77. 'ISAA',
  78. 'ISAA+',
  79. 'ISAB',
  80. 'ISAC'
  81. );
  82. gascputypestr : array[tcputype] of string[8] = ('',
  83. '68000',
  84. '68020',
  85. '68040',
  86. 'isaa',
  87. 'isaaplus',
  88. 'isab',
  89. 'isac'
  90. );
  91. fputypestr : array[tfputype] of string[6] = ('',
  92. 'SOFT',
  93. 'LIBGCC',
  94. '68881'
  95. );
  96. { Supported optimizations, only used for information }
  97. supported_optimizerswitches = genericlevel1optimizerswitches+
  98. genericlevel2optimizerswitches+
  99. genericlevel3optimizerswitches-
  100. { no need to write info about those }
  101. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  102. [cs_opt_regvar,cs_opt_loopunroll,cs_opt_nodecse,
  103. cs_opt_reorder_fields,cs_opt_fastmath];
  104. level1optimizerswitches = genericlevel1optimizerswitches;
  105. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  106. [cs_opt_regvar,cs_opt_stackframe,cs_opt_nodecse];
  107. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}];
  108. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  109. type
  110. tcpuflags =
  111. (CPUM68K_HAS_DBRA, { CPU supports the DBRA instruction }
  112. CPUM68K_HAS_CAS, { CPU supports the CAS instruction }
  113. CPUM68K_HAS_TAS, { CPU supports the TAS instruction }
  114. CPUM68K_HAS_BRAL, { CPU supports the BRA.L/Bcc.L instructions }
  115. CPUM68K_HAS_ROLROR, { CPU supports the ROL/ROR and ROXL/ROXR instructions }
  116. CPUM68K_HAS_BYTEREV { CPU supports the BYTEREV instruction }
  117. );
  118. const
  119. cpu_capabilities : array[tcputype] of set of tcpuflags =
  120. ( { cpu_none } [],
  121. { cpu_68000 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_TAS,CPUM68K_HAS_ROLROR],
  122. { cpu_68020 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_CAS,CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_ROLROR],
  123. { cpu_68040 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_CAS,CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_ROLROR],
  124. { cpu_isaa } [],
  125. { cpu_isaap } [CPUM68K_HAS_BRAL,CPUM68K_HAS_BYTEREV],
  126. { cpu_isab } [CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL],
  127. { cpu_isac } [CPUM68K_HAS_TAS,CPUM68K_HAS_BYTEREV]
  128. );
  129. { all CPUs commonly called "coldfire" }
  130. cpu_coldfire = [cpu_isa_a,cpu_isa_a_p,cpu_isa_b,cpu_isa_c];
  131. Implementation
  132. end.