diff --git a/npc/csrc/main.cpp b/npc/csrc/main.cpp index 0b6fe1e..f39a65b 100644 --- a/npc/csrc/main.cpp +++ b/npc/csrc/main.cpp @@ -4,12 +4,9 @@ #include #include #include -#include const int MAX_SIM_TIME=100; -void nvboard_bind_all_pins(Vexample* top); - int main(int argc, char **argv, char **env) { int sim_time = 0; Verilated::commandArgs(argc, argv); @@ -17,20 +14,16 @@ int main(int argc, char **argv, char **env) { Verilated::traceEverOn(true); VerilatedVcdC *m_trace = new VerilatedVcdC; - nvboard_bind_all_pins(top); - nvboard_init(); #ifdef VERILATOR_TRACE top->trace(m_trace, 5); m_trace->open("waveform.vcd"); #endif - // for (sim_time = 0; sim_time < MAX_SIM_TIME; sim_time++) { - while (true) { - nvboard_update(); - // CData sw = rand() & 0b11; - // top->sw = sw; + 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)) ); + 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