cpuinfo.pas 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {
  2. Copyright (c) 2008 by the Free Pascal development team
  3. Basic Processor information for the Z80
  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 = type extended;
  23. ts128real = type extended;
  24. ts64comp = comp;
  25. pbestreal=^bestreal;
  26. { possible supported processors for this target }
  27. tcputype =
  28. (cpu_none,
  29. cpu_zilog_z80,
  30. cpu_zilog_ez80
  31. );
  32. tfputype =
  33. (fpu_none,
  34. fpu_soft,
  35. fpu_libgcc
  36. );
  37. tcontrollertype =
  38. (ct_none
  39. );
  40. tcontrollerdatatype = record
  41. controllertypestr, controllerunitstr: string[20];
  42. cputype: tcputype; fputype: tfputype;
  43. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  44. end;
  45. Const
  46. {# Size of native extended floating point type }
  47. extended_size = 12;
  48. { target cpu string (used by compiler options) }
  49. target_cpu_string = 'z80';
  50. { Is there support for dealing with multiple microcontrollers available }
  51. { for this platform? }
  52. ControllerSupport = false;
  53. { We know that there are fields after sramsize
  54. but we don't care about this warning }
  55. {$PUSH}
  56. {$WARN 3177 OFF}
  57. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  58. (
  59. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; flashbase:0; flashsize:0; srambase:0; sramsize:0));
  60. {$POP}
  61. { calling conventions supported by the code generator }
  62. supported_calling_conventions : tproccalloptions = [
  63. pocall_internproc,
  64. pocall_safecall,
  65. pocall_stdcall,
  66. { same as stdcall only different name mangling }
  67. pocall_cdecl,
  68. { same as stdcall only different name mangling }
  69. pocall_cppdecl,
  70. { same as stdcall but floating point numbers are handled like equal sized integers }
  71. pocall_softfloat
  72. ];
  73. cputypestr : array[tcputype] of string[5] = ('',
  74. 'Z80',
  75. 'EZ80'
  76. );
  77. fputypestr : array[tfputype] of string[6] = (
  78. 'NONE',
  79. 'SOFT',
  80. 'LIBGCC'
  81. );
  82. { Supported optimizations, only used for information }
  83. supported_optimizerswitches = genericlevel1optimizerswitches+
  84. genericlevel2optimizerswitches+
  85. genericlevel3optimizerswitches-
  86. { no need to write info about those }
  87. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  88. [{cs_opt_regvar,}cs_opt_loopunroll,cs_opt_tailrecursion,
  89. cs_opt_stackframe,cs_opt_nodecse,cs_opt_reorder_fields,cs_opt_fastmath];
  90. level1optimizerswitches = genericlevel1optimizerswitches;
  91. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  92. [{cs_opt_regvar,}cs_opt_stackframe,cs_opt_tailrecursion];
  93. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}];
  94. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  95. type
  96. tcpuflags =
  97. (CPUZ80_HAS_CALLCC
  98. );
  99. const
  100. cpu_capabilities : array[tcputype] of set of tcpuflags =
  101. ( { cpu_none } [],
  102. { cpu_zilog_z80 } [],
  103. { cpu_zilog_ez80 } [CPUZ80_HAS_CALLCC]
  104. );
  105. Implementation
  106. end.