Skip to content

Commit

Permalink
修改性能计数器clock计数逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciliphen committed May 30, 2024
1 parent 35281cc commit 6b420f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/rv_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern long long bru_pred_fail;
extern long long bru_pred_fail;
extern long long dual_issue_cnt;
extern long long commit_cnt;
extern long long clock_cnt;

enum alu_op
{
Expand Down Expand Up @@ -125,7 +126,7 @@ class rv_core
printf("dcache hit rate: %.2lf\n", 1.0 * dcache_hit / dcache_req * 100);
printf("branch predication accuracy: %.2lf\n", (1 - 1.0 * bru_pred_fail / bru_pred_branch) * 100);
printf("dual issue rate: %.2lf\n", 1.0 * dual_issue_cnt / commit_cnt * 100);
printf("IPC: %.2lf\n", 1.0 * commit_cnt / priv.get_cycle());
printf("IPC: %.2lf\n", 1.0 * commit_cnt / clock_cnt);
}

printf("Test timeout! at pc 0x%lx\n", pc);
Expand Down
2 changes: 2 additions & 0 deletions src/sim_mycpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ long long bru_pred_branch = 0;
long long bru_pred_fail = 0;
long long dual_issue_cnt = 0;
long long commit_cnt = 0;
long long clock_cnt = 0;

long long current_pc;

Expand Down Expand Up @@ -559,6 +560,7 @@ void riscv_test_run(Vtop_axi_wrapper *top, axi4_ref<32, 64, 4> &mmio_ref, const
dcache_hit += top->debug_perf_dcache_hit;
bru_pred_branch += top->debug_perf_bru_pred_branch;
bru_pred_fail += top->debug_perf_bru_pred_fail;
clock_cnt++;
}
commit_cnt += top->debug_commit;
if (!top->clock && !top->reset)
Expand Down

0 comments on commit 6b420f4

Please sign in to comment.