2022-07-27 15:07:16 +08:00
|
|
|
#include <verilated.h>
|
|
|
|
|
|
|
|
#include "Vtestbench_top.h"
|
|
|
|
|
|
|
|
vluint64_t main_time = 0;
|
|
|
|
double sc_time_stamp() {
|
|
|
|
return main_time;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv, char **env) {
|
2022-07-29 17:44:11 +08:00
|
|
|
Verilated::commandArgs(argc, argv);
|
2022-07-27 15:07:16 +08:00
|
|
|
Verilated::randReset(2);
|
|
|
|
Verilated::traceEverOn(true);
|
|
|
|
Verilated::mkdir("logs");
|
|
|
|
|
|
|
|
const int reset_time = 10;
|
2022-07-29 18:26:27 +08:00
|
|
|
const int time_limit = 2000000;
|
2022-07-27 15:07:16 +08:00
|
|
|
|
2022-07-29 17:44:11 +08:00
|
|
|
Vtestbench_top *top = new Vtestbench_top;
|
2022-07-27 15:07:16 +08:00
|
|
|
|
|
|
|
top->clk = 0;
|
2022-07-29 17:44:11 +08:00
|
|
|
while (!Verilated::gotFinish() && main_time < time_limit) {
|
2022-07-27 15:07:16 +08:00
|
|
|
++main_time;
|
|
|
|
top->clk = !top->clk;
|
2022-07-29 17:44:11 +08:00
|
|
|
top->resetn = (main_time < reset_time) ? 0 : 1;
|
|
|
|
if (main_time < reset_time) VerilatedCov::zero();
|
|
|
|
|
2022-07-27 15:07:16 +08:00
|
|
|
top->eval();
|
|
|
|
}
|
|
|
|
|
2022-07-29 17:44:11 +08:00
|
|
|
if (main_time == time_limit)
|
|
|
|
std::cout << "Time Limit Reached" << std::endl;
|
|
|
|
|
2022-07-27 15:07:16 +08:00
|
|
|
top->final();
|
|
|
|
|
|
|
|
#if VM_COVERAGE
|
|
|
|
Verilated::mkdir("logs");
|
|
|
|
VerilatedCov::write("logs/coverage.dat");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
delete top;
|
|
|
|
top = NULL;
|
|
|
|
exit(0);
|
|
|
|
}
|