cpuinfo.pas 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for the Risc-V64
  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. bestrealrec = TDoubleRec;
  18. ts32real = single;
  19. ts64real = double;
  20. ts80real = extended;
  21. ts128real = extended;
  22. ts64comp = comp;
  23. pbestreal = ^bestreal;
  24. { possible supported processors for this target }
  25. tcputype = (cpu_none,
  26. cpu_rv64imac,
  27. cpu_rv64ima,
  28. cpu_rv64im,
  29. cpu_rv64i,
  30. cpu_rv64gc
  31. );
  32. tfputype =
  33. (fpu_none,
  34. fpu_libgcc,
  35. fpu_soft,
  36. fpu_fd
  37. );
  38. tcontrollertype =
  39. (ct_none
  40. );
  41. tcontrollerdatatype = record
  42. controllertypestr, controllerunitstr: string[20];
  43. cputype: tcputype; fputype: tfputype;
  44. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  45. end;
  46. Const
  47. { Is there support for dealing with multiple microcontrollers available }
  48. { for this platform? }
  49. ControllerSupport = false;
  50. { We know that there are fields after sramsize
  51. but we don't care about this warning }
  52. {$PUSH}
  53. {$WARN 3177 OFF}
  54. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  55. (
  56. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; flashbase:0; flashsize:0; srambase:0; sramsize:0));
  57. {$POP}
  58. { calling conventions supported by the code generator }
  59. supported_calling_conventions: tproccalloptions = [
  60. pocall_internproc,
  61. pocall_safecall,
  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. { the difference with stdcall is that all const record
  68. parameters are passed by reference }
  69. pocall_mwpascal
  70. ];
  71. cputypestr: array[tcputype] of string[10] = ('',
  72. 'RV64IMAC',
  73. 'RV64IMA',
  74. 'RV64IM',
  75. 'RV64I',
  76. 'RV64GC'
  77. );
  78. fputypestr: array[tfputype] of string[8] = (
  79. 'NONE',
  80. 'LIBGCC',
  81. 'SOFT',
  82. 'FD'
  83. );
  84. { Supported optimizations, only used for information }
  85. supported_optimizerswitches = genericlevel1optimizerswitches+
  86. genericlevel2optimizerswitches+
  87. genericlevel3optimizerswitches-
  88. { no need to write info about those }
  89. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  90. [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_loopunroll,cs_opt_nodecse,
  91. cs_opt_tailrecursion,cs_opt_reorder_fields,cs_opt_fastmath,
  92. cs_opt_stackframe];
  93. level1optimizerswitches = genericlevel1optimizerswitches;
  94. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  95. [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_stackframe,cs_opt_nodecse,cs_opt_tailrecursion,cs_opt_consts];
  96. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches;
  97. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [cs_opt_stackframe];
  98. type
  99. tcpuflags =
  100. (CPURV_HAS_MUL,
  101. CPURV_HAS_ATOMIC,
  102. CPURV_HAS_COMPACT,
  103. CPURV_HAS_ZBA,
  104. CPURV_HAS_ZBB,
  105. CPURV_HAS_ZBC,
  106. CPURV_HAS_ZBS,
  107. CPURV_HAS_CSR_INSTRUCTIONS, { extension Zicsr }
  108. CPURV_HAS_FETCH_FENCE { extension Zifencei }
  109. );
  110. const
  111. cpu_capabilities : array[tcputype] of set of tcpuflags =
  112. ( { cpu_none } [],
  113. { cpu_rv64imac } [CPURV_HAS_MUL,CPURV_HAS_ATOMIC,CPURV_HAS_COMPACT],
  114. { cpu_rv64ima } [CPURV_HAS_MUL,CPURV_HAS_ATOMIC],
  115. { cpu_rv64im } [CPURV_HAS_MUL],
  116. { cpu_rv64i } [],
  117. { cpu_rv64gc } [CPURV_HAS_MUL,CPURV_HAS_ATOMIC,CPURV_HAS_COMPACT,CPURV_HAS_CSR_INSTRUCTIONS,CPURV_HAS_FETCH_FENCE]
  118. );
  119. implementation
  120. end.