Skip to content

Commit

Permalink
application: use standard api to reset mcycle and minstret
Browse files Browse the repository at this point in the history
Signed-off-by: dongyongtao <[email protected]>
  • Loading branch information
dongyongtao committed Jan 4, 2024
1 parent 5528336 commit 8730fa7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions application/baremetal/benchmark/coremark/core_portme.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static CORE_TICKS i0, i1;

void start_time(void)
{
__RV_CSR_WRITE(CSR_MCYCLE, 0);
__set_rv_cycle(0);
t0 = __get_rv_cycle();
}

Expand All @@ -44,7 +44,7 @@ CORE_TICKS get_time(void)

void start_instret(void)
{
__RV_CSR_WRITE(CSR_MINSTRET, 0);
__set_rv_instret(0);
i0 = __get_rv_instret();
}

Expand Down
4 changes: 2 additions & 2 deletions application/baremetal/benchmark/dhrystone/dhry_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

void reset_cycle(void)
{
__RV_CSR_WRITE(CSR_MCYCLE, 0);
__set_rv_cycle(0);
}

void reset_instret(void)
{
__RV_CSR_WRITE(CSR_MINSTRET, 0);
__set_rv_instret(0);
}

long csr_cycle(void)
Expand Down
5 changes: 2 additions & 3 deletions application/baremetal/benchmark/whetstone/whets.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,9 @@ int main(void)
printf("\nLoop content Result MFLOPS "
" MOPS Seconds\n\n");

// TODO change to use standard clear time API
// reset instret and cycle
__RV_CSR_WRITE(CSR_MCYCLE, 0);
__RV_CSR_WRITE(CSR_MINSTRET, 0);
__set_rv_cycle(0);
__set_rv_instret(0);
start_cycle = __get_rv_cycle();
start_instret = __get_rv_instret();

Expand Down

0 comments on commit 8730fa7

Please sign in to comment.