RISCVSchedSyntacoreSCR1.td 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. //==- RISCVSchedSyntacoreSCR1.td - Syntacore SCR1 Scheduling Definitions --------*- tablegen -*-=//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //===----------------------------------------------------------------------===//
  9. // SCR1: https://github.com/syntacore/scr1
  10. // This model covers SYNTACORE_SCR1_CFG_RV32IMC_MAX configuration (syntacore-scr1-max).
  11. // SYNTACORE_SCR1_CFG_RV32IC_BASE (syntacore-scr1-base) configuration has essentially
  12. // same scheduling characteristics.
  13. // SCR1 is single-issue in-order processor
  14. def SyntacoreSCR1Model : SchedMachineModel {
  15. let MicroOpBufferSize = 0;
  16. let IssueWidth = 1;
  17. let LoadLatency = 2;
  18. let MispredictPenalty = 3;
  19. let CompleteModel = 0;
  20. let UnsupportedFeatures = [HasStdExtZbkb, HasStdExtZbkc, HasStdExtZbkx,
  21. HasStdExtZknd, HasStdExtZkne, HasStdExtZknh,
  22. HasStdExtZksed, HasStdExtZksh, HasStdExtZkr,
  23. HasVInstructions];
  24. }
  25. let SchedModel = SyntacoreSCR1Model in {
  26. let BufferSize = 0 in {
  27. def SCR1_ALU : ProcResource<1>;
  28. def SCR1_LSU : ProcResource<1>;
  29. def SCR1_MUL : ProcResource<1>;
  30. def SCR1_DIV : ProcResource<1>;
  31. def SCR1_CFU : ProcResource<1>;
  32. }
  33. // Branching
  34. def : WriteRes<WriteJmp, [SCR1_CFU]>;
  35. def : WriteRes<WriteJal, [SCR1_CFU]>;
  36. def : WriteRes<WriteJalr, [SCR1_CFU]>;
  37. def : WriteRes<WriteJmpReg, [SCR1_CFU]>;
  38. // Integer arithmetic and logic
  39. def : WriteRes<WriteIALU32, [SCR1_ALU]>;
  40. def : WriteRes<WriteIALU, [SCR1_ALU]>;
  41. def : WriteRes<WriteShiftImm32, [SCR1_ALU]>;
  42. def : WriteRes<WriteShiftImm, [SCR1_ALU]>;
  43. def : WriteRes<WriteShiftReg32, [SCR1_ALU]>;
  44. def : WriteRes<WriteShiftReg, [SCR1_ALU]>;
  45. // Integer multiplication: single-cycle multiplier in SCR1_CFG_RV32IMC_MAX
  46. def : WriteRes<WriteIMul, [SCR1_MUL]>;
  47. def : WriteRes<WriteIMul32, [SCR1_MUL]>;
  48. // Integer division: latency 33, inverse throughput 33
  49. let Latency = 33, ResourceCycles = [33] in {
  50. def : WriteRes<WriteIDiv32, [SCR1_DIV]>;
  51. def : WriteRes<WriteIDiv, [SCR1_DIV]>;
  52. }
  53. // Load/store instructions on SCR1 have latency 2 and inverse throughput 2
  54. // (SCR1_CFG_RV32IMC_MAX includes TCM)
  55. let Latency = 2, ResourceCycles=[2] in {
  56. // Memory
  57. def : WriteRes<WriteSTB, [SCR1_LSU]>;
  58. def : WriteRes<WriteSTH, [SCR1_LSU]>;
  59. def : WriteRes<WriteSTW, [SCR1_LSU]>;
  60. def : WriteRes<WriteSTD, [SCR1_LSU]>;
  61. def : WriteRes<WriteLDB, [SCR1_LSU]>;
  62. def : WriteRes<WriteLDH, [SCR1_LSU]>;
  63. def : WriteRes<WriteLDW, [SCR1_LSU]>;
  64. def : WriteRes<WriteLDD, [SCR1_LSU]>;
  65. }
  66. let Unsupported = true in {
  67. // Atomic memory
  68. def : WriteRes<WriteAtomicW, [SCR1_LSU]>;
  69. def : WriteRes<WriteAtomicD, [SCR1_LSU]>;
  70. def : WriteRes<WriteAtomicLDW, [SCR1_LSU]>;
  71. def : WriteRes<WriteAtomicLDD, [SCR1_LSU]>;
  72. def : WriteRes<WriteAtomicSTW, [SCR1_LSU]>;
  73. def : WriteRes<WriteAtomicSTD, [SCR1_LSU]>;
  74. // FP load/store
  75. def : WriteRes<WriteFST32, [SCR1_LSU]>;
  76. def : WriteRes<WriteFST64, [SCR1_LSU]>;
  77. def : WriteRes<WriteFLD32, [SCR1_LSU]>;
  78. def : WriteRes<WriteFLD64, [SCR1_LSU]>;
  79. // FP instructions
  80. def : WriteRes<WriteFAdd32, []>;
  81. def : WriteRes<WriteFSGNJ32, []>;
  82. def : WriteRes<WriteFMinMax32, []>;
  83. def : WriteRes<WriteFAdd64, []>;
  84. def : WriteRes<WriteFSGNJ64, []>;
  85. def : WriteRes<WriteFMinMax64, []>;
  86. def : WriteRes<WriteFCvtI32ToF32, []>;
  87. def : WriteRes<WriteFCvtI32ToF64, []>;
  88. def : WriteRes<WriteFCvtI64ToF32, []>;
  89. def : WriteRes<WriteFCvtI64ToF64, []>;
  90. def : WriteRes<WriteFCvtF32ToI32, []>;
  91. def : WriteRes<WriteFCvtF32ToI64, []>;
  92. def : WriteRes<WriteFCvtF64ToI32, []>;
  93. def : WriteRes<WriteFCvtF64ToI64, []>;
  94. def : WriteRes<WriteFCvtF32ToF64, []>;
  95. def : WriteRes<WriteFCvtF64ToF32, []>;
  96. def : WriteRes<WriteFClass32, []>;
  97. def : WriteRes<WriteFClass64, []>;
  98. def : WriteRes<WriteFCmp32, []>;
  99. def : WriteRes<WriteFCmp64, []>;
  100. def : WriteRes<WriteFMovF32ToI32, []>;
  101. def : WriteRes<WriteFMovI32ToF32, []>;
  102. def : WriteRes<WriteFMovF64ToI64, []>;
  103. def : WriteRes<WriteFMovI64ToF64, []>;
  104. def : WriteRes<WriteFMul32, []>;
  105. def : WriteRes<WriteFMA32, []>;
  106. def : WriteRes<WriteFMul64, []>;
  107. def : WriteRes<WriteFMA64, []>;
  108. def : WriteRes<WriteFDiv32, []>;
  109. def : WriteRes<WriteFDiv64, []>;
  110. def : WriteRes<WriteFSqrt32, []>;
  111. def : WriteRes<WriteFSqrt64, []>;
  112. def : WriteRes<WriteSFB, []>;
  113. }
  114. // Others
  115. def : WriteRes<WriteCSR, []>;
  116. def : WriteRes<WriteNop, []>;
  117. def : InstRW<[WriteIALU], (instrs COPY)>;
  118. //===----------------------------------------------------------------------===//
  119. // Bypasses (none)
  120. def : ReadAdvance<ReadJmp, 0>;
  121. def : ReadAdvance<ReadJalr, 0>;
  122. def : ReadAdvance<ReadCSR, 0>;
  123. def : ReadAdvance<ReadStoreData, 0>;
  124. def : ReadAdvance<ReadMemBase, 0>;
  125. def : ReadAdvance<ReadIALU, 0>;
  126. def : ReadAdvance<ReadIALU32, 0>;
  127. def : ReadAdvance<ReadShiftImm, 0>;
  128. def : ReadAdvance<ReadShiftImm32, 0>;
  129. def : ReadAdvance<ReadShiftReg, 0>;
  130. def : ReadAdvance<ReadShiftReg32, 0>;
  131. def : ReadAdvance<ReadIDiv, 0>;
  132. def : ReadAdvance<ReadIDiv32, 0>;
  133. def : ReadAdvance<ReadIMul, 0>;
  134. def : ReadAdvance<ReadIMul32, 0>;
  135. def : ReadAdvance<ReadAtomicWA, 0>;
  136. def : ReadAdvance<ReadAtomicWD, 0>;
  137. def : ReadAdvance<ReadAtomicDA, 0>;
  138. def : ReadAdvance<ReadAtomicDD, 0>;
  139. def : ReadAdvance<ReadAtomicLDW, 0>;
  140. def : ReadAdvance<ReadAtomicLDD, 0>;
  141. def : ReadAdvance<ReadAtomicSTW, 0>;
  142. def : ReadAdvance<ReadAtomicSTD, 0>;
  143. def : ReadAdvance<ReadFStoreData, 0>;
  144. def : ReadAdvance<ReadFMemBase, 0>;
  145. def : ReadAdvance<ReadFAdd32, 0>;
  146. def : ReadAdvance<ReadFAdd64, 0>;
  147. def : ReadAdvance<ReadFMul32, 0>;
  148. def : ReadAdvance<ReadFMul64, 0>;
  149. def : ReadAdvance<ReadFMA32, 0>;
  150. def : ReadAdvance<ReadFMA64, 0>;
  151. def : ReadAdvance<ReadFDiv32, 0>;
  152. def : ReadAdvance<ReadFDiv64, 0>;
  153. def : ReadAdvance<ReadFSqrt32, 0>;
  154. def : ReadAdvance<ReadFSqrt64, 0>;
  155. def : ReadAdvance<ReadFCmp32, 0>;
  156. def : ReadAdvance<ReadFCmp64, 0>;
  157. def : ReadAdvance<ReadFSGNJ32, 0>;
  158. def : ReadAdvance<ReadFSGNJ64, 0>;
  159. def : ReadAdvance<ReadFMinMax32, 0>;
  160. def : ReadAdvance<ReadFMinMax64, 0>;
  161. def : ReadAdvance<ReadFCvtF32ToI32, 0>;
  162. def : ReadAdvance<ReadFCvtF32ToI64, 0>;
  163. def : ReadAdvance<ReadFCvtF64ToI32, 0>;
  164. def : ReadAdvance<ReadFCvtF64ToI64, 0>;
  165. def : ReadAdvance<ReadFCvtI32ToF32, 0>;
  166. def : ReadAdvance<ReadFCvtI32ToF64, 0>;
  167. def : ReadAdvance<ReadFCvtI64ToF32, 0>;
  168. def : ReadAdvance<ReadFCvtI64ToF64, 0>;
  169. def : ReadAdvance<ReadFCvtF32ToF64, 0>;
  170. def : ReadAdvance<ReadFCvtF64ToF32, 0>;
  171. def : ReadAdvance<ReadFMovF32ToI32, 0>;
  172. def : ReadAdvance<ReadFMovI32ToF32, 0>;
  173. def : ReadAdvance<ReadFMovF64ToI64, 0>;
  174. def : ReadAdvance<ReadFMovI64ToF64, 0>;
  175. def : ReadAdvance<ReadFClass32, 0>;
  176. def : ReadAdvance<ReadFClass64, 0>;
  177. def : ReadAdvance<ReadSFB, 0>;
  178. //===----------------------------------------------------------------------===//
  179. // Unsupported extensions
  180. defm : UnsupportedSchedV;
  181. defm : UnsupportedSchedZba;
  182. defm : UnsupportedSchedZbb;
  183. defm : UnsupportedSchedZbc;
  184. defm : UnsupportedSchedZbs;
  185. defm : UnsupportedSchedZbkb;
  186. defm : UnsupportedSchedZbkx;
  187. defm : UnsupportedSchedZfh;
  188. }