From f0af08d011935cce4191687fdecacdfef0cbe756 Mon Sep 17 00:00:00 2001 From: uvok Date: Sun, 11 Jan 2026 11:55:39 +0100 Subject: computer: get rid of i --- nandgame/cpp/Vcomputer__main.cpp | 7 +++---- nandgame/cpp/simpc_ui.cpp | 2 +- nandgame/cpp/simpc_ui.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'nandgame') diff --git a/nandgame/cpp/Vcomputer__main.cpp b/nandgame/cpp/Vcomputer__main.cpp index cc0f7c0..6908377 100644 --- a/nandgame/cpp/Vcomputer__main.cpp +++ b/nandgame/cpp/Vcomputer__main.cpp @@ -31,7 +31,7 @@ int main(int argc, char **argv, char **) { fprintf(stderr, "Usage: %.20s [filename]\n\n", argv[0]); exit(-1); } - int i = 0; + puts("Start simulation."); // topp->computer->clk_in = 0; topp->clk_in = 0; @@ -53,9 +53,8 @@ int main(int argc, char **argv, char **) { simpc_ui_init(); - while (VL_LIKELY(!contextp->gotFinish()) && i < 500) { - // doesn't work. - // topp->computer->clk_in = ~topp->computer->clk_in; + while (VL_LIKELY(!contextp->gotFinish()) && contextp->time() < 500) { + auto i = contextp->time(); if (i != 0 && (i % TICKS_PER_INS) == 0) { topp->clk_in = !topp->clk_in; diff --git a/nandgame/cpp/simpc_ui.cpp b/nandgame/cpp/simpc_ui.cpp index 35cbdcb..eead4b5 100644 --- a/nandgame/cpp/simpc_ui.cpp +++ b/nandgame/cpp/simpc_ui.cpp @@ -44,7 +44,7 @@ bool paused = false; -void simpc_ui_write(const std::unique_ptr &topp, int &i, +void simpc_ui_write(const std::unique_ptr &topp, uint64_t &i, StepPosition_t sp) { uint16_t opcode = topp->computer->PC_content_int; diff --git a/nandgame/cpp/simpc_ui.h b/nandgame/cpp/simpc_ui.h index 4a990a6..71b651f 100644 --- a/nandgame/cpp/simpc_ui.h +++ b/nandgame/cpp/simpc_ui.h @@ -6,7 +6,7 @@ #include void simpc_ui_init(void); -void simpc_ui_write(const std::unique_ptr &topp, int &i, +void simpc_ui_write(const std::unique_ptr &topp, uint64_t &i, StepPosition_t sp); void simpc_ui_finish_message(const std::unique_ptr &contextp, const std::unique_ptr &topp); -- cgit v1.2.3