2023-12-23 10:31:48 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <cassert>
|
|
|
|
#include <cstdlib>
|
2023-12-23 11:57:04 +00:00
|
|
|
#include <verilated.h>
|
|
|
|
#include <verilated_vcd_c.h>
|
2024-01-04 09:23:05 +00:00
|
|
|
#include <VMain.h>
|
2023-12-23 09:27:29 +00:00
|
|
|
|
2024-01-01 05:29:52 +00:00
|
|
|
const int MAX_SIM_TIME=100;
|
|
|
|
|
2023-12-23 09:27:29 +00:00
|
|
|
int main(int argc, char **argv, char **env) {
|
2023-12-23 11:58:48 +00:00
|
|
|
int sim_time = 0;
|
2023-12-23 09:27:29 +00:00
|
|
|
Verilated::commandArgs(argc, argv);
|
2024-01-04 09:23:05 +00:00
|
|
|
VMain *top = new VMain;
|
2023-12-23 11:57:21 +00:00
|
|
|
|
|
|
|
Verilated::traceEverOn(true);
|
2023-12-23 11:57:04 +00:00
|
|
|
VerilatedVcdC *m_trace = new VerilatedVcdC;
|
2024-01-01 05:29:52 +00:00
|
|
|
#ifdef VERILATOR_TRACE
|
2023-12-23 11:57:04 +00:00
|
|
|
top->trace(m_trace, 5);
|
|
|
|
m_trace->open("waveform.vcd");
|
2024-01-01 05:29:52 +00:00
|
|
|
#endif
|
2024-01-04 09:23:05 +00:00
|
|
|
// for (sim_time = 0; sim_time < MAX_SIM_TIME; sim_time++) {
|
|
|
|
// CData sw = rand() & 0b11;
|
|
|
|
// top->sw = sw;
|
|
|
|
// top->eval();
|
|
|
|
// printf("sw0 = %d, sw1 = %d, ledr = %d\n", sw & 0b1, sw >> 1, top->ledr);
|
|
|
|
// assert(top->ledr == ((sw >> 1) ^ (sw & 0b1)) );
|
|
|
|
// #ifdef VERILATOR_TRACE
|
|
|
|
// m_trace->dump(sim_time);
|
|
|
|
// #endif
|
|
|
|
// }
|
2024-01-01 05:29:52 +00:00
|
|
|
#ifdef VERILATOR_TRACE
|
2023-12-23 11:57:04 +00:00
|
|
|
m_trace->close();
|
2024-01-01 05:29:52 +00:00
|
|
|
#endif
|
2023-12-23 11:57:04 +00:00
|
|
|
delete top;
|
|
|
|
exit(EXIT_SUCCESS);
|
2023-12-23 09:27:29 +00:00
|
|
|
}
|