core_portme.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*
  2. Copyright 2018 Embedded Microprocessor Benchmark Consortium (EEMBC)
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. Original Author: Shay Gal-on
  13. */
  14. /* Topic : Description
  15. This file contains configuration constants required to execute on different platforms
  16. */
  17. #ifndef CORE_PORTME_H
  18. #define CORE_PORTME_H
  19. #define ITERATIONS COREMARK_ITERATIONS
  20. /************************/
  21. /* Data types and settings */
  22. /************************/
  23. /* Configuration : HAS_FLOAT
  24. Define to 1 if the platform supports floating point.
  25. */
  26. #ifndef HAS_FLOAT
  27. #define HAS_FLOAT CORE_MARK_HAS_FLOAT
  28. #endif
  29. /* Configuration : HAS_TIME_H
  30. Define to 1 if platform has the time.h header file,
  31. and implementation of functions thereof.
  32. */
  33. #ifndef HAS_TIME_H
  34. #define HAS_TIME_H 1
  35. #endif
  36. /* Configuration : USE_CLOCK
  37. Define to 1 if platform has the time.h header file,
  38. and implementation of functions thereof.
  39. */
  40. #ifndef USE_CLOCK
  41. #define USE_CLOCK 1
  42. #endif
  43. /* Configuration : HAS_STDIO
  44. Define to 1 if the platform has stdio.h.
  45. */
  46. #ifndef HAS_STDIO
  47. #define HAS_STDIO 1
  48. #endif
  49. /* Configuration : HAS_PRINTF
  50. Define to 1 if the platform has stdio.h and implements the printf function.
  51. */
  52. #ifndef HAS_PRINTF
  53. #define HAS_PRINTF 1
  54. #endif
  55. /* Configuration : CORE_TICKS
  56. Define type of return from the timing functions.
  57. */
  58. #include <time.h>
  59. typedef clock_t CORE_TICKS;
  60. /* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
  61. Initialize these strings per platform
  62. */
  63. #ifndef COMPILER_VERSION
  64. #ifdef __GNUC__
  65. #define COMPILER_VERSION "GCC"__VERSION__
  66. #else
  67. #define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
  68. #endif
  69. #endif
  70. #ifndef COMPILER_FLAGS
  71. #define COMPILER_FLAGS "" /* "Please put compiler flags here (e.g. -o3)" */
  72. #endif
  73. #ifndef MEM_LOCATION
  74. #define MEM_LOCATION "STACK"
  75. #endif
  76. /* Data Types :
  77. To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in <core_portme.h>.
  78. *Imprtant* :
  79. ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!!
  80. */
  81. typedef signed short ee_s16;
  82. typedef unsigned short ee_u16;
  83. typedef signed int ee_s32;
  84. typedef double ee_f32;
  85. typedef unsigned char ee_u8;
  86. typedef unsigned int ee_u32;
  87. typedef ee_u32 ee_ptr_int;
  88. typedef size_t ee_size_t;
  89. /* align_mem :
  90. This macro is used to align an offset to point to a 32b value. It is used in the Matrix algorithm to initialize the input memory blocks.
  91. */
  92. #define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
  93. /* Configuration : SEED_METHOD
  94. Defines method to get seed values that cannot be computed at compile time.
  95. Valid values :
  96. SEED_ARG - from command line.
  97. SEED_FUNC - from a system function.
  98. SEED_VOLATILE - from volatile variables.
  99. */
  100. #ifndef SEED_METHOD
  101. #define SEED_METHOD SEED_VOLATILE
  102. #endif
  103. /* Configuration : MEM_METHOD
  104. Defines method to get a block of memry.
  105. Valid values :
  106. MEM_MALLOC - for platforms that implement malloc and have malloc.h.
  107. MEM_STATIC - to use a static memory array.
  108. MEM_STACK - to allocate the data block on the stack (NYI).
  109. */
  110. #ifndef MEM_METHOD
  111. #define MEM_METHOD MEM_STACK
  112. #endif
  113. /* Configuration : MULTITHREAD
  114. Define for parallel execution
  115. Valid values :
  116. 1 - only one context (default).
  117. N>1 - will execute N copies in parallel.
  118. Note :
  119. If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.
  120. Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them.
  121. It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>,
  122. to fit a particular architecture.
  123. */
  124. #ifndef MULTITHREAD
  125. #define MULTITHREAD 1
  126. #define USE_PTHREAD 0
  127. #define USE_FORK 0
  128. #define USE_SOCKET 0
  129. #endif
  130. /* Configuration : MAIN_HAS_NOARGC
  131. Needed if platform does not support getting arguments to main.
  132. Valid values :
  133. 0 - argc/argv to main is supported
  134. 1 - argc/argv to main is not supported
  135. Note :
  136. This flag only matters if MULTITHREAD has been defined to a value greater then 1.
  137. */
  138. #ifndef MAIN_HAS_NOARGC
  139. #define MAIN_HAS_NOARGC 0
  140. #endif
  141. /* Configuration : MAIN_HAS_NORETURN
  142. Needed if platform does not support returning a value from main.
  143. Valid values :
  144. 0 - main returns an int, and return value will be 0.
  145. 1 - platform does not support returning a value from main
  146. */
  147. #ifndef MAIN_HAS_NORETURN
  148. #define MAIN_HAS_NORETURN 0
  149. #endif
  150. /* Variable : default_num_contexts
  151. Not used for this simple port, must cintain the value 1.
  152. */
  153. extern ee_u32 default_num_contexts;
  154. typedef struct CORE_PORTABLE_S {
  155. ee_u8 portable_id;
  156. } core_portable;
  157. /* target specific init/fini */
  158. void portable_init(core_portable *p, int *argc, char *argv[]);
  159. void portable_fini(core_portable *p);
  160. #if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && !defined(VALIDATION_RUN)
  161. #if (TOTAL_DATA_SIZE==1200)
  162. #define PROFILE_RUN 1
  163. #elif (TOTAL_DATA_SIZE==2000)
  164. #define PERFORMANCE_RUN 1
  165. #else
  166. #define VALIDATION_RUN 1
  167. #endif
  168. #endif
  169. #endif /* CORE_PORTME_H */