summaryrefslogtreecommitdiff
path: root/nandgame/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nandgame/cpp')
-rw-r--r--nandgame/cpp/Vcomputer__main.cpp7
-rw-r--r--nandgame/cpp/simpc_ui.cpp2
-rw-r--r--nandgame/cpp/simpc_ui.h2
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);