StreamFMA.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /**\file */
  2. #ifndef SLIC_DECLARATIONS_StreamFMA_H
  3. #define SLIC_DECLARATIONS_StreamFMA_H
  4. #include "MaxSLiCInterface.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif /* __cplusplus */
  8. #define StreamFMA_DYNAMIC_CLOCKS_ENABLED (0)
  9. #define StreamFMA_PCIE_ALIGNMENT (16)
  10. /*----------------------------------------------------------------------------*/
  11. /*---------------------------- Interface default -----------------------------*/
  12. /*----------------------------------------------------------------------------*/
  13. /**
  14. * \brief Basic static function for the interface 'default'.
  15. *
  16. * \param [in] ticks_StreamFMAKernel The number of ticks for which kernel "StreamFMAKernel" will run.
  17. * \param [in] instream_inAT1 Stream "inAT1".
  18. * \param [in] instream_size_inAT1 The size of the stream instream_inAT1 in bytes.
  19. * \param [in] instream_inBT1 Stream "inBT1".
  20. * \param [in] instream_size_inBT1 The size of the stream instream_inBT1 in bytes.
  21. * \param [out] outstream_oDataT3 Stream "oDataT3".
  22. * \param [in] outstream_size_oDataT3 The size of the stream outstream_oDataT3 in bytes.
  23. * \param [in] lmem_address_MemoryControllerPro0_inAT2 Linear LMem control for "inAT2" stream: base address, in bytes.
  24. * \param [in] lmem_arr_size_MemoryControllerPro0_inAT2 Linear LMem control for "inAT2" stream: array size, in bytes.
  25. * \param [in] lmem_address_MemoryControllerPro0_inAT3 Linear LMem control for "inAT3" stream: base address, in bytes.
  26. * \param [in] lmem_arr_size_MemoryControllerPro0_inAT3 Linear LMem control for "inAT3" stream: array size, in bytes.
  27. * \param [in] lmem_address_MemoryControllerPro0_inBT2 Linear LMem control for "inBT2" stream: base address, in bytes.
  28. * \param [in] lmem_arr_size_MemoryControllerPro0_inBT2 Linear LMem control for "inBT2" stream: array size, in bytes.
  29. * \param [in] lmem_address_MemoryControllerPro0_inBT3 Linear LMem control for "inBT3" stream: base address, in bytes.
  30. * \param [in] lmem_arr_size_MemoryControllerPro0_inBT3 Linear LMem control for "inBT3" stream: array size, in bytes.
  31. * \param [in] lmem_address_MemoryControllerPro0_oDataT1 Linear LMem control for "oDataT1" stream: base address, in bytes.
  32. * \param [in] lmem_arr_size_MemoryControllerPro0_oDataT1 Linear LMem control for "oDataT1" stream: array size, in bytes.
  33. * \param [in] lmem_address_MemoryControllerPro0_oDataT2 Linear LMem control for "oDataT2" stream: base address, in bytes.
  34. * \param [in] lmem_arr_size_MemoryControllerPro0_oDataT2 Linear LMem control for "oDataT2" stream: array size, in bytes.
  35. */
  36. void StreamFMA(
  37. uint64_t ticks_StreamFMAKernel,
  38. const void *instream_inAT1,
  39. size_t instream_size_inAT1,
  40. const void *instream_inBT1,
  41. size_t instream_size_inBT1,
  42. void *outstream_oDataT3,
  43. size_t outstream_size_oDataT3,
  44. size_t lmem_address_MemoryControllerPro0_inAT2,
  45. size_t lmem_arr_size_MemoryControllerPro0_inAT2,
  46. size_t lmem_address_MemoryControllerPro0_inAT3,
  47. size_t lmem_arr_size_MemoryControllerPro0_inAT3,
  48. size_t lmem_address_MemoryControllerPro0_inBT2,
  49. size_t lmem_arr_size_MemoryControllerPro0_inBT2,
  50. size_t lmem_address_MemoryControllerPro0_inBT3,
  51. size_t lmem_arr_size_MemoryControllerPro0_inBT3,
  52. size_t lmem_address_MemoryControllerPro0_oDataT1,
  53. size_t lmem_arr_size_MemoryControllerPro0_oDataT1,
  54. size_t lmem_address_MemoryControllerPro0_oDataT2,
  55. size_t lmem_arr_size_MemoryControllerPro0_oDataT2);
  56. /**
  57. * \brief Basic static non-blocking function for the interface 'default'.
  58. *
  59. * Schedule to run on an engine and return immediately.
  60. * The status of the run can be checked either by ::max_wait or ::max_nowait;
  61. * note that one of these *must* be called, so that associated memory can be released.
  62. *
  63. *
  64. * \param [in] ticks_StreamFMAKernel The number of ticks for which kernel "StreamFMAKernel" will run.
  65. * \param [in] instream_inAT1 Stream "inAT1".
  66. * \param [in] instream_size_inAT1 The size of the stream instream_inAT1 in bytes.
  67. * \param [in] instream_inBT1 Stream "inBT1".
  68. * \param [in] instream_size_inBT1 The size of the stream instream_inBT1 in bytes.
  69. * \param [out] outstream_oDataT3 Stream "oDataT3".
  70. * \param [in] outstream_size_oDataT3 The size of the stream outstream_oDataT3 in bytes.
  71. * \param [in] lmem_address_MemoryControllerPro0_inAT2 Linear LMem control for "inAT2" stream: base address, in bytes.
  72. * \param [in] lmem_arr_size_MemoryControllerPro0_inAT2 Linear LMem control for "inAT2" stream: array size, in bytes.
  73. * \param [in] lmem_address_MemoryControllerPro0_inAT3 Linear LMem control for "inAT3" stream: base address, in bytes.
  74. * \param [in] lmem_arr_size_MemoryControllerPro0_inAT3 Linear LMem control for "inAT3" stream: array size, in bytes.
  75. * \param [in] lmem_address_MemoryControllerPro0_inBT2 Linear LMem control for "inBT2" stream: base address, in bytes.
  76. * \param [in] lmem_arr_size_MemoryControllerPro0_inBT2 Linear LMem control for "inBT2" stream: array size, in bytes.
  77. * \param [in] lmem_address_MemoryControllerPro0_inBT3 Linear LMem control for "inBT3" stream: base address, in bytes.
  78. * \param [in] lmem_arr_size_MemoryControllerPro0_inBT3 Linear LMem control for "inBT3" stream: array size, in bytes.
  79. * \param [in] lmem_address_MemoryControllerPro0_oDataT1 Linear LMem control for "oDataT1" stream: base address, in bytes.
  80. * \param [in] lmem_arr_size_MemoryControllerPro0_oDataT1 Linear LMem control for "oDataT1" stream: array size, in bytes.
  81. * \param [in] lmem_address_MemoryControllerPro0_oDataT2 Linear LMem control for "oDataT2" stream: base address, in bytes.
  82. * \param [in] lmem_arr_size_MemoryControllerPro0_oDataT2 Linear LMem control for "oDataT2" stream: array size, in bytes.
  83. * \return A handle on the execution status, or NULL in case of error.
  84. */
  85. max_run_t *StreamFMA_nonblock(
  86. uint64_t ticks_StreamFMAKernel,
  87. const void *instream_inAT1,
  88. size_t instream_size_inAT1,
  89. const void *instream_inBT1,
  90. size_t instream_size_inBT1,
  91. void *outstream_oDataT3,
  92. size_t outstream_size_oDataT3,
  93. size_t lmem_address_MemoryControllerPro0_inAT2,
  94. size_t lmem_arr_size_MemoryControllerPro0_inAT2,
  95. size_t lmem_address_MemoryControllerPro0_inAT3,
  96. size_t lmem_arr_size_MemoryControllerPro0_inAT3,
  97. size_t lmem_address_MemoryControllerPro0_inBT2,
  98. size_t lmem_arr_size_MemoryControllerPro0_inBT2,
  99. size_t lmem_address_MemoryControllerPro0_inBT3,
  100. size_t lmem_arr_size_MemoryControllerPro0_inBT3,
  101. size_t lmem_address_MemoryControllerPro0_oDataT1,
  102. size_t lmem_arr_size_MemoryControllerPro0_oDataT1,
  103. size_t lmem_address_MemoryControllerPro0_oDataT2,
  104. size_t lmem_arr_size_MemoryControllerPro0_oDataT2);
  105. /**
  106. * \brief Advanced static interface, structure for the engine interface 'default'
  107. *
  108. */
  109. typedef struct {
  110. uint64_t ticks_StreamFMAKernel; /**< [in] The number of ticks for which kernel "StreamFMAKernel" will run. */
  111. const void *instream_inAT1; /**< [in] Stream "inAT1". */
  112. size_t instream_size_inAT1; /**< [in] The size of the stream instream_inAT1 in bytes. */
  113. const void *instream_inBT1; /**< [in] Stream "inBT1". */
  114. size_t instream_size_inBT1; /**< [in] The size of the stream instream_inBT1 in bytes. */
  115. void *outstream_oDataT3; /**< [out] Stream "oDataT3". */
  116. size_t outstream_size_oDataT3; /**< [in] The size of the stream outstream_oDataT3 in bytes. */
  117. size_t lmem_address_MemoryControllerPro0_inAT2; /**< [in] Linear LMem control for "inAT2" stream: base address, in bytes. */
  118. size_t lmem_arr_size_MemoryControllerPro0_inAT2; /**< [in] Linear LMem control for "inAT2" stream: array size, in bytes. */
  119. size_t lmem_address_MemoryControllerPro0_inAT3; /**< [in] Linear LMem control for "inAT3" stream: base address, in bytes. */
  120. size_t lmem_arr_size_MemoryControllerPro0_inAT3; /**< [in] Linear LMem control for "inAT3" stream: array size, in bytes. */
  121. size_t lmem_address_MemoryControllerPro0_inBT2; /**< [in] Linear LMem control for "inBT2" stream: base address, in bytes. */
  122. size_t lmem_arr_size_MemoryControllerPro0_inBT2; /**< [in] Linear LMem control for "inBT2" stream: array size, in bytes. */
  123. size_t lmem_address_MemoryControllerPro0_inBT3; /**< [in] Linear LMem control for "inBT3" stream: base address, in bytes. */
  124. size_t lmem_arr_size_MemoryControllerPro0_inBT3; /**< [in] Linear LMem control for "inBT3" stream: array size, in bytes. */
  125. size_t lmem_address_MemoryControllerPro0_oDataT1; /**< [in] Linear LMem control for "oDataT1" stream: base address, in bytes. */
  126. size_t lmem_arr_size_MemoryControllerPro0_oDataT1; /**< [in] Linear LMem control for "oDataT1" stream: array size, in bytes. */
  127. size_t lmem_address_MemoryControllerPro0_oDataT2; /**< [in] Linear LMem control for "oDataT2" stream: base address, in bytes. */
  128. size_t lmem_arr_size_MemoryControllerPro0_oDataT2; /**< [in] Linear LMem control for "oDataT2" stream: array size, in bytes. */
  129. } StreamFMA_actions_t;
  130. /**
  131. * \brief Advanced static function for the interface 'default'.
  132. *
  133. * \param [in] engine The engine on which the actions will be executed.
  134. * \param [in,out] interface_actions Actions to be executed.
  135. */
  136. void StreamFMA_run(
  137. max_engine_t *engine,
  138. StreamFMA_actions_t *interface_actions);
  139. /**
  140. * \brief Advanced static non-blocking function for the interface 'default'.
  141. *
  142. * Schedule the actions to run on the engine and return immediately.
  143. * The status of the run can be checked either by ::max_wait or ::max_nowait;
  144. * note that one of these *must* be called, so that associated memory can be released.
  145. *
  146. *
  147. * \param [in] engine The engine on which the actions will be executed.
  148. * \param [in] interface_actions Actions to be executed.
  149. * \return A handle on the execution status of the actions, or NULL in case of error.
  150. */
  151. max_run_t *StreamFMA_run_nonblock(
  152. max_engine_t *engine,
  153. StreamFMA_actions_t *interface_actions);
  154. /**
  155. * \brief Group run advanced static function for the interface 'default'.
  156. *
  157. * \param [in] group Group to use.
  158. * \param [in,out] interface_actions Actions to run.
  159. *
  160. * Run the actions on the first device available in the group.
  161. */
  162. void StreamFMA_run_group(max_group_t *group, StreamFMA_actions_t *interface_actions);
  163. /**
  164. * \brief Group run advanced static non-blocking function for the interface 'default'.
  165. *
  166. *
  167. * Schedule the actions to run on the first device available in the group and return immediately.
  168. * The status of the run must be checked with ::max_wait.
  169. * Note that use of ::max_nowait is prohibited with non-blocking running on groups:
  170. * see the ::max_run_group_nonblock documentation for more explanation.
  171. *
  172. * \param [in] group Group to use.
  173. * \param [in] interface_actions Actions to run.
  174. * \return A handle on the execution status of the actions, or NULL in case of error.
  175. */
  176. max_run_t *StreamFMA_run_group_nonblock(max_group_t *group, StreamFMA_actions_t *interface_actions);
  177. /**
  178. * \brief Array run advanced static function for the interface 'default'.
  179. *
  180. * \param [in] engarray The array of devices to use.
  181. * \param [in,out] interface_actions The array of actions to run.
  182. *
  183. * Run the array of actions on the array of engines. The length of interface_actions
  184. * must match the size of engarray.
  185. */
  186. void StreamFMA_run_array(max_engarray_t *engarray, StreamFMA_actions_t *interface_actions[]);
  187. /**
  188. * \brief Array run advanced static non-blocking function for the interface 'default'.
  189. *
  190. *
  191. * Schedule to run the array of actions on the array of engines, and return immediately.
  192. * The length of interface_actions must match the size of engarray.
  193. * The status of the run can be checked either by ::max_wait or ::max_nowait;
  194. * note that one of these *must* be called, so that associated memory can be released.
  195. *
  196. * \param [in] engarray The array of devices to use.
  197. * \param [in] interface_actions The array of actions to run.
  198. * \return A handle on the execution status of the actions, or NULL in case of error.
  199. */
  200. max_run_t *StreamFMA_run_array_nonblock(max_engarray_t *engarray, StreamFMA_actions_t *interface_actions[]);
  201. /**
  202. * \brief Converts a static-interface action struct into a dynamic-interface max_actions_t struct.
  203. *
  204. * Note that this is an internal utility function used by other functions in the static interface.
  205. *
  206. * \param [in] maxfile The maxfile to use.
  207. * \param [in] interface_actions The interface-specific actions to run.
  208. * \return The dynamic-interface actions to run, or NULL in case of error.
  209. */
  210. max_actions_t* StreamFMA_convert(max_file_t *maxfile, StreamFMA_actions_t *interface_actions);
  211. /**
  212. * \brief Initialise a maxfile.
  213. */
  214. max_file_t* StreamFMA_init(void);
  215. /* Error handling functions */
  216. int StreamFMA_has_errors(void);
  217. const char* StreamFMA_get_errors(void);
  218. void StreamFMA_clear_errors(void);
  219. /* Free statically allocated maxfile data */
  220. void StreamFMA_free(void);
  221. /* returns: -1 = error running command; 0 = no error reported */
  222. int StreamFMA_simulator_start(void);
  223. /* returns: -1 = error running command; 0 = no error reported */
  224. int StreamFMA_simulator_stop(void);
  225. #ifdef __cplusplus
  226. }
  227. #endif /* __cplusplus */
  228. #endif /* SLIC_DECLARATIONS_StreamFMA_H */