diff options
Diffstat (limited to 'eater_cpu/cpp/Veater_computer__main.cpp')
| -rw-r--r-- | eater_cpu/cpp/Veater_computer__main.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/eater_cpu/cpp/Veater_computer__main.cpp b/eater_cpu/cpp/Veater_computer__main.cpp index d73e542..fe1a408 100644 --- a/eater_cpu/cpp/Veater_computer__main.cpp +++ b/eater_cpu/cpp/Veater_computer__main.cpp @@ -50,6 +50,26 @@ void load_program(const std::unique_ptr<Veater_computer> &topp) { topp->eater_computer->RAM->r_datastore[15] = 28; } +void load_program_countdown(const std::unique_ptr<Veater_computer> &topp) { + std::vector<uint8_t> instructions + // + {// LDI 2 + 0x52, + // SUB 15 + 0x3f, + // JZ 4 + 0x84, + // JMP -> @0 + 0x61, + // HALT + 0xf0}; + std::copy(instructions.begin(), instructions.end(), + &topp->eater_computer->RAM->r_datastore[0]); + + // Data @ 15 + topp->eater_computer->RAM->r_datastore[15] = 1; +} + int main(int argc, char **argv, char **) { // Setup context, defaults, and parse command line Verilated::debug(0); @@ -71,7 +91,7 @@ int main(int argc, char **argv, char **) { topp->auto_run_in = 1; // Load program - load_program(topp); + load_program_countdown(topp); simpc_ui_init(); |
