cpuinfo.pas 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for the Risc-V32
  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 = extended;
  23. ts64comp = comp;
  24. pbestreal=^bestreal;
  25. { possible supported processors for this target }
  26. tcputype =
  27. (cpu_none,
  28. cpu_rv32imafd,
  29. cpu_rv32ima,
  30. cpu_rv32im,
  31. cpu_rv32i
  32. );
  33. tfputype =
  34. (fpu_none,
  35. fpu_libgcc,
  36. fpu_soft,
  37. fpu_fd
  38. );
  39. tcontrollertype =
  40. (ct_none
  41. );
  42. tcontrollerdatatype = record
  43. controllertypestr, controllerunitstr: string[20];
  44. cputype: tcputype; fputype: tfputype;
  45. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  46. end;
  47. Const
  48. { Is there support for dealing with multiple microcontrollers available }
  49. { for this platform? }
  50. ControllerSupport = false;
  51. { We know that there are fields after sramsize
  52. but we don't care about this warning }
  53. {$PUSH}
  54. {$WARN 3177 OFF}
  55. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  56. (
  57. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; flashbase:0; flashsize:0; srambase:0; sramsize:0));
  58. {$POP}
  59. { calling conventions supported by the code generator }
  60. supported_calling_conventions : tproccalloptions = [
  61. pocall_internproc,
  62. pocall_stdcall,
  63. { the difference to stdcall is only the name mangling }
  64. pocall_cdecl,
  65. { the difference to stdcall is only the name mangling }
  66. pocall_cppdecl,
  67. { pass all const records by reference }
  68. pocall_mwpascal
  69. ];
  70. cputypestr : array[tcputype] of string[10] = ('',
  71. 'RV32IMAFD',
  72. 'RV32IMA',
  73. 'RV32IM',
  74. 'RV32I'
  75. );
  76. fputypestr : array[tfputype] of string[8] = (
  77. 'LIBGCC',
  78. 'NONE',
  79. 'SOFT',
  80. 'FD'
  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_nodecse,
  89. cs_opt_tailrecursion,cs_opt_reorder_fields,cs_opt_fastmath,
  90. cs_opt_stackframe];
  91. level1optimizerswitches = genericlevel1optimizerswitches;
  92. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches + [cs_opt_regvar,cs_opt_nodecse,cs_opt_tailrecursion];
  93. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}];
  94. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [cs_opt_stackframe];
  95. type
  96. tcpuflags =
  97. (CPURV_HAS_MUL,
  98. CPURV_HAS_ATOMIC,
  99. CPURV_HAS_COMPACT
  100. );
  101. const
  102. cpu_capabilities : array[tcputype] of set of tcpuflags =
  103. ( { cpu_none } [],
  104. { cpu_rv32imafd } [CPURV_HAS_MUL,CPURV_HAS_ATOMIC],
  105. { cpu_rv32ima } [CPURV_HAS_MUL,CPURV_HAS_ATOMIC],
  106. { cpu_rv32im } [CPURV_HAS_MUL],
  107. { cpu_rv32i } []
  108. );
  109. Implementation
  110. end.