summaryrefslogtreecommitdiff
path: root/software/dhrystone/dhry_stubs.c
blob: d3bd14c19c57683f42787c783c7ef55cf4e2f467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "platform.h"

/* The functions in this file are only meant to support Dhrystone on an
 * embedded RV32 system and are obviously incorrect in general. */

// return the cycle counter as though it were the current time
long time(void)
{
  long t;
  asm volatile ("csrr %0, mcycle" : "=r" (t));
  return t / (get_cpu_freq() / 1000);
}

// set the number of dhrystone iterations
void __wrap_scanf(const char* fmt, int* n)
{
  *n = 1500000;
}