updates scc and adds simspeed test
This commit is contained in:
@ -9,6 +9,7 @@ add_subdirectory(configuration)
|
||||
add_subdirectory(configurer)
|
||||
add_subdirectory(sc_fixed_tracing)
|
||||
add_subdirectory(cxs_tlm)
|
||||
add_subdirectory(sim_speed)
|
||||
if(FULL_TEST_SUITE)
|
||||
add_subdirectory(sim_performance)
|
||||
endif()
|
||||
|
3
tests/sim_speed/CMakeLists.txt
Normal file
3
tests/sim_speed/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
project (sim_speed)
|
||||
add_executable(${PROJECT_NAME} sc_main.cpp)
|
||||
target_link_libraries (${PROJECT_NAME} LINK_PUBLIC scc-sysc)
|
24
tests/sim_speed/sc_main.cpp
Normal file
24
tests/sim_speed/sc_main.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <chrono>
|
||||
#include <stdint.h>
|
||||
#include <systemc>
|
||||
|
||||
using namespace sc_core;
|
||||
|
||||
int sc_main(int argc, char* argv[]) {
|
||||
const uint64_t NS_VAL = 100000000;
|
||||
|
||||
sc_clock clk("clk", 1, SC_NS);
|
||||
sc_time run_time(NS_VAL, SC_NS);
|
||||
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
sc_start(run_time);
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
|
||||
|
||||
double simulated_cycles = (double)NS_VAL;
|
||||
double real_us = duration.count();
|
||||
double speed_Mhz = simulated_cycles / real_us;
|
||||
std::cout << "Simulation speed: " << speed_Mhz << " MHz\n";
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user