cpuinfo.pas 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for the MIPS
  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. ts32real = single;
  17. ts64real = double;
  18. ts80real = type double;
  19. ts128real = type double;
  20. ts64comp = comp;
  21. pbestreal=^bestreal;
  22. { possible supported processors for this target }
  23. tcputype =
  24. (cpu_none,
  25. cpu_mips1,
  26. cpu_mips2,
  27. cpu_mips3,
  28. cpu_mips4,
  29. cpu_mips5,
  30. cpu_mips32,
  31. cpu_mips32r2,
  32. cpu_pic32mx
  33. );
  34. tfputype =(fpu_none,fpu_soft,fpu_mips2,fpu_mips3);
  35. tabitype =
  36. (
  37. abi_none,
  38. abi_default,
  39. abi_o32,
  40. abi_n32,
  41. abi_o64,
  42. abi_n64,
  43. abi_eabi
  44. );
  45. Const
  46. {# Size of native extended floating point type }
  47. extended_size = 8;
  48. {# Size of a multimedia register }
  49. mmreg_size = 0;
  50. { calling conventions supported by the code generator }
  51. supported_calling_conventions : tproccalloptions = [
  52. pocall_internproc,
  53. pocall_stdcall,
  54. pocall_safecall,
  55. { same as stdcall only different name mangling }
  56. pocall_cdecl,
  57. { same as stdcall only different name mangling }
  58. pocall_cppdecl
  59. ];
  60. { cpu strings as accepted by
  61. GNU assembler in -arch=XXX option
  62. this ilist needs to be uppercased }
  63. cputypestr : array[tcputype] of string[8] = ('',
  64. { cpu_mips1 } 'MIPS1',
  65. { cpu_mips2 } 'MIPS2',
  66. { cpu_mips3 } 'MIPS3',
  67. { cpu_mips4 } 'MIPS4',
  68. { cpu_mips5 } 'MIPS5',
  69. { cpu_mips32 } 'MIPS32',
  70. { cpu_mips32r2 } 'MIPS32R2',
  71. { cpu_pic32mx } 'PIC32MX'
  72. );
  73. fputypestr : array[tfputype] of string[9] = ('',
  74. 'SOFT',
  75. 'FPU_MIPS2','FPU_MIPS3'
  76. );
  77. { abi strings as accepted by
  78. GNU assembler in -abi=XXX option }
  79. abitypestr : array[tabitype] of string[4] =
  80. ({ abi_none } '',
  81. { abi_default } '32',
  82. { abi_o32 } '32',
  83. { abi_n32 } 'n32',
  84. { abi_o64 } 'o64',
  85. { abi_n64 } '64',
  86. { abi_eabi } 'eabi'
  87. );
  88. mips_abi : tabitype = abi_default;
  89. {$ifdef MIPSEL}
  90. type
  91. tcpuflags=(CPUMIPS_HAS_XXXX); //Todo: Does this need to be filled?
  92. const
  93. cpu_capabilities : array[tcputype] of set of tcpuflags =
  94. ( { cpu_none } [],
  95. { cpu_mips1 } [],
  96. { cpu_mips2 } [],
  97. { cpu_mips3 } [],
  98. { cpu_mips4 } [],
  99. { cpu_mips5 } [],
  100. { cpu_mips32 } [],
  101. { cpu_mips32r2 } [],
  102. { cpu_pic32mx } []
  103. );
  104. type
  105. tcontrollertype =
  106. (ct_none,
  107. { pic32mx }
  108. ct_pic32mx110f016b,
  109. ct_pic32mx110f016c,
  110. ct_pic32mx110f016d,
  111. ct_pic32mx120f032b,
  112. ct_pic32mx120f032c,
  113. ct_pic32mx120f032d,
  114. ct_pic32mx130f064b,
  115. ct_pic32mx130f064c,
  116. ct_pic32mx130f064d,
  117. ct_pic32mx150f128b,
  118. ct_pic32mx150f128c,
  119. ct_pic32mx150f128d,
  120. ct_pic32mx210f016b,
  121. ct_pic32mx210f016c,
  122. ct_pic32mx210f016d,
  123. ct_pic32mx220f032b,
  124. ct_pic32mx220f032c,
  125. ct_pic32mx220f032d,
  126. ct_pic32mx230f064b,
  127. ct_pic32mx230f064c,
  128. ct_pic32mx230f064d,
  129. ct_pic32mx250f128b,
  130. ct_pic32mx250f128c,
  131. ct_pic32mx250f128d,
  132. ct_pic32mx775f256h,
  133. ct_pic32mx775f256l,
  134. ct_pic32mx775f512h,
  135. ct_pic32mx775f512l,
  136. ct_pic32mx795f512h,
  137. ct_pic32mx795f512l
  138. );
  139. { We know that there are fields after sramsize
  140. but we don't care about this warning }
  141. {$WARN 3177 OFF}
  142. const
  143. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  144. (
  145. (controllertypestr:''; controllerunitstr:''; flashbase:0; flashsize:0; srambase:0; sramsize:0),
  146. { PIC32MX1xx Series}
  147. (controllertypestr:'PIC32MX110F016B'; controllerunitstr:'PIC32MX1xxFxxxB'; flashbase:$9d000000; flashsize:$00004000; srambase:$A0000000; sramsize:$00001000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  148. (controllertypestr:'PIC32MX110F016C'; controllerunitstr:'PIC32MX1xxFxxxC'; flashbase:$9d000000; flashsize:$00004000; srambase:$A0000000; sramsize:$00001000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  149. (controllertypestr:'PIC32MX110F016D'; controllerunitstr:'PIC32MX1xxFxxxD'; flashbase:$9d000000; flashsize:$00004000; srambase:$A0000000; sramsize:$00001000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  150. (controllertypestr:'PIC32MX120F032B'; controllerunitstr:'PIC32MX1xxFxxxB'; flashbase:$9d000000; flashsize:$00008000; srambase:$A0000000; sramsize:$00002000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  151. (controllertypestr:'PIC32MX120F032C'; controllerunitstr:'PIC32MX1xxFxxxC'; flashbase:$9d000000; flashsize:$00008000; srambase:$A0000000; sramsize:$00002000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  152. (controllertypestr:'PIC32MX120F032D'; controllerunitstr:'PIC32MX1xxFxxxD'; flashbase:$9d000000; flashsize:$00008000; srambase:$A0000000; sramsize:$00002000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  153. (controllertypestr:'PIC32MX130F064B'; controllerunitstr:'PIC32MX1xxFxxxB'; flashbase:$9d000000; flashsize:$00010000; srambase:$A0000000; sramsize:$00004000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  154. (controllertypestr:'PIC32MX130F064C'; controllerunitstr:'PIC32MX1xxFxxxC'; flashbase:$9d000000; flashsize:$00010000; srambase:$A0000000; sramsize:$00004000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  155. (controllertypestr:'PIC32MX130F064D'; controllerunitstr:'PIC32MX1xxFxxxD'; flashbase:$9d000000; flashsize:$00010000; srambase:$A0000000; sramsize:$00004000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  156. (controllertypestr:'PIC32MX150F128B'; controllerunitstr:'PIC32MX1xxFxxxB'; flashbase:$9d000000; flashsize:$00020000; srambase:$A0000000; sramsize:$00008000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  157. (controllertypestr:'PIC32MX150F128C'; controllerunitstr:'PIC32MX1xxFxxxC'; flashbase:$9d000000; flashsize:$00020000; srambase:$A0000000; sramsize:$00008000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  158. (controllertypestr:'PIC32MX150F128D'; controllerunitstr:'PIC32MX1xxFxxxD'; flashbase:$9d000000; flashsize:$00020000; srambase:$A0000000; sramsize:$00008000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  159. { PIC32MX2xx Series}
  160. (controllertypestr:'PIC32MX210F016B'; controllerunitstr:'PIC32MX2xxFxxxB'; flashbase:$9d000000; flashsize:$00004000; srambase:$A0000000; sramsize:$00001000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  161. (controllertypestr:'PIC32MX210F016C'; controllerunitstr:'PIC32MX2xxFxxxC'; flashbase:$9d000000; flashsize:$00004000; srambase:$A0000000; sramsize:$00001000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  162. (controllertypestr:'PIC32MX210F016D'; controllerunitstr:'PIC32MX2xxFxxxD'; flashbase:$9d000000; flashsize:$00004000; srambase:$A0000000; sramsize:$00001000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  163. (controllertypestr:'PIC32MX220F032B'; controllerunitstr:'PIC32MX2xxFxxxB'; flashbase:$9d000000; flashsize:$00008000; srambase:$A0000000; sramsize:$00002000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  164. (controllertypestr:'PIC32MX220F032C'; controllerunitstr:'PIC32MX2xxFxxxC'; flashbase:$9d000000; flashsize:$00008000; srambase:$A0000000; sramsize:$00002000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  165. (controllertypestr:'PIC32MX220F032D'; controllerunitstr:'PIC32MX2xxFxxxD'; flashbase:$9d000000; flashsize:$00008000; srambase:$A0000000; sramsize:$00002000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  166. (controllertypestr:'PIC32MX230F064B'; controllerunitstr:'PIC32MX2xxFxxxB'; flashbase:$9d000000; flashsize:$00010000; srambase:$A0000000; sramsize:$00004000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  167. (controllertypestr:'PIC32MX230F064C'; controllerunitstr:'PIC32MX2xxFxxxC'; flashbase:$9d000000; flashsize:$00010000; srambase:$A0000000; sramsize:$00004000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  168. (controllertypestr:'PIC32MX230F064D'; controllerunitstr:'PIC32MX2xxFxxxD'; flashbase:$9d000000; flashsize:$00010000; srambase:$A0000000; sramsize:$00004000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  169. (controllertypestr:'PIC32MX250F128B'; controllerunitstr:'PIC32MX2xxFxxxB'; flashbase:$9d000000; flashsize:$00020000; srambase:$A0000000; sramsize:$00008000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  170. (controllertypestr:'PIC32MX250F128C'; controllerunitstr:'PIC32MX2xxFxxxC'; flashbase:$9d000000; flashsize:$00020000; srambase:$80000000; sramsize:$00008000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  171. (controllertypestr:'PIC32MX250F128D'; controllerunitstr:'PIC32MX2xxFxxxD'; flashbase:$9d000000; flashsize:$00020000; srambase:$A0000000; sramsize:$00008000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00000BEF),
  172. { PIC32MX7x5 Series}
  173. (controllertypestr:'PIC32MX775F256H'; controllerunitstr:'PIC32MX7x5FxxxH'; flashbase:$9d000000; flashsize:$00040000; srambase:$A0000000; sramsize:$00010000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00002FEF),
  174. (controllertypestr:'PIC32MX775F256L'; controllerunitstr:'PIC32MX7x5FxxxL'; flashbase:$9d000000; flashsize:$00040000; srambase:$A0000000; sramsize:$00010000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00002FEF),
  175. (controllertypestr:'PIC32MX775F512H'; controllerunitstr:'PIC32MX7x5FxxxH'; flashbase:$9d000000; flashsize:$00080000; srambase:$A0000000; sramsize:$00010000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00002FEF),
  176. (controllertypestr:'PIC32MX775F512L'; controllerunitstr:'PIC32MX7x5FxxxL'; flashbase:$9d000000; flashsize:$00080000; srambase:$A0000000; sramsize:$00010000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00002FEF),
  177. (controllertypestr:'PIC32MX795F512H'; controllerunitstr:'PIC32MX7x5FxxxH'; flashbase:$9d000000; flashsize:$00080000; srambase:$A0000000; sramsize:$00020000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00002FEF),
  178. (controllertypestr:'PIC32MX795F512L'; controllerunitstr:'PIC32MX7x5FxxxL'; flashbase:$9d000000; flashsize:$00080000; srambase:$A0000000; sramsize:$00020000; eeprombase:0; eepromsize:0; bootbase:$BFC00000; bootsize:$00002FEF)
  179. );
  180. {$endif MIPSEL}
  181. { Supported optimizations, only used for information }
  182. supported_optimizerswitches = [cs_opt_regvar,cs_opt_loopunroll,cs_opt_nodecse,
  183. cs_opt_reorder_fields,cs_opt_fastmath];
  184. level1optimizerswitches = genericlevel1optimizerswitches;
  185. level2optimizerswitches = level1optimizerswitches + [cs_opt_regvar,cs_opt_stackframe,cs_opt_nodecse];
  186. level3optimizerswitches = level2optimizerswitches + [cs_opt_loopunroll];
  187. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  188. function SetMipsABIType(const s : string) : boolean;
  189. Implementation
  190. uses
  191. cutils;
  192. function SetMipsABIType(const s : string) : boolean;
  193. var
  194. abi : tabitype;
  195. begin
  196. SetMipsABIType:=false;
  197. for abi := low(tabitype) to high(tabitype) do
  198. if (lower(s)=abitypestr[abi]) then
  199. begin
  200. mips_abi:=abi;
  201. SetMipsABIType:=true;
  202. break;
  203. end;
  204. end;
  205. end.