From 6615352b771fe76236046de7800fb6fe79b96a12 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Mon, 1 Jan 2024 13:43:05 +0800 Subject: [PATCH] =?UTF-8?q?>=20sim=20RTL=20ysyx=5F22040000=20=E6=9D=8E?= =?UTF-8?q?=E5=BF=83=E6=9D=A8=20Linux=20calcite=206.1.69=20#1-NixOS=20SMP?= =?UTF-8?q?=20PREEMPT=5FDYNAMIC=20Wed=20Dec=2020=2016:00:29=20UTC=202023?= =?UTF-8?q?=20x86=5F64=20GNU/Linux=20=2013:43:05=20=20up=20=2022:22,=20=20?= =?UTF-8?q?2=20users,=20=20load=20average:=201.05,=200.90,=200.86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- npc/csrc/main.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) 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