Skip to content

Commit

Permalink
riscv: use rdcycle instead of rdtime
Browse files Browse the repository at this point in the history
Signed-off-by: Nils Wistoff <[email protected]>
  • Loading branch information
niwis committed Feb 19, 2021
1 parent 92737be commit 8d92b42
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/side-bench/src/mastik_common/low.h
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,9 @@ static inline int accesstime(void *v) {
int rv = 0;
asm volatile(
"fence\n"
"rdtime t0\n"
"rdcycle t0\n"
"lw t0, 0(%1)\n"
"rdtime a0\n"
"rdcycle a0\n"
"sub a0, a0, t0\n"
: "=r" (rv): "r" (v): );
return rv;
Expand Down
4 changes: 2 additions & 2 deletions apps/side-bench/src/mastik_riscv/bp.S
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
.type bp_probe, @function
.align 4
bp_probe:
rdtime t0
rdcycle t0
.rept CONFIG_BENCH_BHT_ENTRIES
.word 0x50A63 //beqz a0, 20. bloody compiler will rip this apart otherwise. 20 = CONFIG_BENCH_BHT_ALIGN
addi a0, a0, -1
.rept JMP_HW_ALIGN - 3
nop
.endr
.endr
rdtime a0
rdcycle a0
sub a0, a0, t0
ret
2 changes: 1 addition & 1 deletion include/channel-bench/bench_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ static inline uint32_t rdtscp() {

static inline uint32_t rdtime() {
uint32_t rv;
asm volatile ("rdtime %0": "=r" (rv) ::);
asm volatile ("rdcycle %0": "=r" (rv) ::);
return rv;
}

Expand Down

0 comments on commit 8d92b42

Please sign in to comment.