#include #include #include "Vtestbench_top.h" #include vluint64_t main_time = 0; double sc_time_stamp() { return main_time; } int main(int argc, char **argv, char **env) { Verilated::commandArgs(argc, argv); Verilated::randReset(2); Verilated::traceEverOn(true); Verilated::mkdir("logs"); const int reset_time = 10; const int time_limit = 2100000; Vtestbench_top *top = new Vtestbench_top; std::cout << "<<< Simulation Started >>>" << std::endl; auto time_start = std::chrono::high_resolution_clock::now(); top->clk = 0; while (!Verilated::gotFinish() && main_time < time_limit) { ++main_time; top->clk = !top->clk; top->resetn = (main_time < reset_time) ? 0 : 1; if (main_time < reset_time) VerilatedCov::zero(); top->eval(); } auto time_end = std::chrono::high_resolution_clock::now(); if (main_time == time_limit) std::cout << "<<< Time Limit Reached >>>" << std::endl; std::cout << "<<< Simulation Ended >>>" << std::endl; std::cout << "Realworld Time: " << std::chrono::duration_cast(time_end - time_start).count() << "s" << std::endl; std::cout << "Simulation Time: " << main_time / 2 << " cycles" << std::endl; top->final(); #if VM_COVERAGE Verilated::mkdir("logs"); VerilatedCov::write("logs/coverage.dat"); #endif delete top; top = NULL; exit(0); }