From 35c6ac438af5086510fe120b575090cf8e9b917b Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Mon, 14 Mar 2016 17:47:25 -0700 Subject: Rework benchmarks to run in M-mode This broadens their utility and lets them use the M-mode counters directly. --- benchmarks/common/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'benchmarks/common/util.h') diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h index 2fcc89d..c35bf7c 100644 --- a/benchmarks/common/util.h +++ b/benchmarks/common/util.h @@ -126,9 +126,9 @@ static uint64_t lfsr(uint64_t x) #define stringify_1(s) #s #define stringify(s) stringify_1(s) #define stats(code, iter) do { \ - unsigned long _c = -rdcycle(), _i = -rdinstret(); \ + unsigned long _c = -read_csr(mcycle), _i = -read_csr(minstret); \ code; \ - _c += rdcycle(), _i += rdinstret(); \ + _c += read_csr(mcycle), _i += read_csr(minstret); \ if (cid == 0) \ printf("\n%s: %ld cycles, %ld.%ld cycles/iter, %ld.%ld CPI\n", \ stringify(code), _c, _c/iter, 10*_c/iter%10, _c/_i, 10*_c/_i%10); \ -- cgit v1.1