summaryrefslogtreecommitdiff
path: root/software/coremark/core_portme.c
diff options
context:
space:
mode:
Diffstat (limited to 'software/coremark/core_portme.c')
-rw-r--r--software/coremark/core_portme.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/software/coremark/core_portme.c b/software/coremark/core_portme.c
new file mode 100644
index 0000000..cbf1396
--- /dev/null
+++ b/software/coremark/core_portme.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "coremark.h"
+#include "platform.h"
+#include "encoding.h"
+
+#if VALIDATION_RUN
+ volatile ee_s32 seed1_volatile=0x3415;
+ volatile ee_s32 seed2_volatile=0x3415;
+ volatile ee_s32 seed3_volatile=0x66;
+#endif
+
+#if PERFORMANCE_RUN
+ volatile ee_s32 seed1_volatile=0x0;
+ volatile ee_s32 seed2_volatile=0x0;
+ volatile ee_s32 seed3_volatile=0x66;
+#endif
+
+#if PROFILE_RUN
+ volatile ee_s32 seed1_volatile=0x8;
+ volatile ee_s32 seed2_volatile=0x8;
+ volatile ee_s32 seed3_volatile=0x8;
+#endif
+
+volatile ee_s32 seed4_volatile=ITERATIONS;
+volatile ee_s32 seed5_volatile=0;
+
+static CORE_TICKS t0, t1;
+
+void start_time(void)
+{
+ t0 = get_timer_value();
+}
+
+void stop_time(void)
+{
+ t1 = get_timer_value();
+}
+
+CORE_TICKS get_time(void)
+{
+ return t1 - t0;
+}
+
+secs_ret time_in_secs(CORE_TICKS ticks)
+{
+ // scale timer down to avoid uint64_t -> double conversion in RV32
+ int scale = 256;
+ uint32_t delta = ticks / scale;
+ uint32_t freq = get_timer_freq() / scale;
+ return delta / (double)freq;
+}