diff options
| author | uvok | 2026-01-11 11:55:39 +0100 |
|---|---|---|
| committer | uvok | 2026-01-11 11:59:20 +0100 |
| commit | f0af08d011935cce4191687fdecacdfef0cbe756 (patch) | |
| tree | 5ca945db14f9b921507daa8e2a79f0287a4d5946 | |
| parent | 68408d588444ae65e50e7e6e2c0af1bdbcd7a925 (diff) | |
computer: get rid of i
| -rw-r--r-- | nandgame/cpp/Vcomputer__main.cpp | 7 | ||||
| -rw-r--r-- | nandgame/cpp/simpc_ui.cpp | 2 | ||||
| -rw-r--r-- | nandgame/cpp/simpc_ui.h | 2 |
3 files changed, 5 insertions, 6 deletions
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<Vcomputer> &topp, int &i, +void simpc_ui_write(const std::unique_ptr<Vcomputer> &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 <memory> void simpc_ui_init(void); -void simpc_ui_write(const std::unique_ptr<Vcomputer> &topp, int &i, +void simpc_ui_write(const std::unique_ptr<Vcomputer> &topp, uint64_t &i, StepPosition_t sp); void simpc_ui_finish_message(const std::unique_ptr<VerilatedContext> &contextp, const std::unique_ptr<Vcomputer> &topp); |
