Skip to content

Commit

Permalink
application: Fix wrong ipc calculation for benchmark code
Browse files Browse the repository at this point in the history
IPC = instruction / cycle

Signed-off-by: Huaqi Fang <[email protected]>
  • Loading branch information
fanghuaqi committed Jan 3, 2024
1 parent 4ce12ec commit 5967b2b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion application/baremetal/benchmark/coremark/core_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ MAIN_RETURN_TYPE main(int argc, char* argv[])
uint32_t i_ipc = (uint32_t)(f_ipc * 1000);
pstr = dec2str(i_ipc);

ee_printf("IPC = Cycle/Instret = %u/%u = %u.%s\n", (unsigned int)total_time, (unsigned int)total_instret, (unsigned int)(i_ipc/1000), pstr);
ee_printf("IPC = Instret/Cycle = %u/%u = %u.%s\n", (unsigned int)total_instret, (unsigned int)total_time, (unsigned int)(i_ipc/1000), pstr);

return MAIN_RETURN_VAL;
}
4 changes: 2 additions & 2 deletions application/baremetal/benchmark/dhrystone/dhry_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,11 @@ int main(void)
printf("CSV, Dhrystone, %u, %u, %u.%s\n", \
(unsigned int)Number_Of_Runs, (unsigned int)User_Cycle, (unsigned int)(dhry_dmips/1000), pstr);

float f_ipc = (((float)User_Cycle / User_Instret));
float f_ipc = (((float)User_Instret / User_Cycle));
uint32_t i_ipc = (uint32_t)(f_ipc * 1000);
pstr = dec2str(i_ipc);

printf("IPC = Cycle/Instret = %u/%u = %u.%s\n", (unsigned int)User_Cycle, (unsigned int)User_Instret, (unsigned int)(i_ipc/1000), pstr);
printf("IPC = Instret/Cycle = %u/%u = %u.%s\n", (unsigned int)User_Instret, (unsigned int)User_Cycle, (unsigned int)(i_ipc/1000), pstr);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion application/baremetal/benchmark/whetstone/whets.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ int main(void)
uint32_t i_ipc = (uint32_t)(f_ipc * 1000);
pstr = dec2str(i_ipc);

printf("IPC = Cycle/Instret = %u/%u = %u.%s\n", (unsigned int)used_cycle, (unsigned int)used_instret, (unsigned int)(i_ipc/1000), pstr);
printf("IPC = Instret/Cycle = %u/%u = %u.%s\n", (unsigned int)used_instret, (unsigned int)used_cycle, (unsigned int)(i_ipc/1000), pstr);

if (Check == 0) {
printf("Wrong answer \n");
Expand Down

0 comments on commit 5967b2b

Please sign in to comment.