diff options
| author | uvok | 2026-01-26 20:34:08 +0100 |
|---|---|---|
| committer | uvok | 2026-01-26 20:34:08 +0100 |
| commit | b0324ec3b6e670b21a2369faa92483c381f0742e (patch) | |
| tree | e9c835d3adbe80634f6b1764212ce85f2f27c6cc /eater_cpu | |
| parent | 067f2c20c7106d6b843d6411a9e8e8de360ecb78 (diff) | |
eater: add countdown programmain
Diffstat (limited to 'eater_cpu')
| -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(); |
