diff options
| author | 2023-04-21 17:39:18 +0000 | |
|---|---|---|
| committer | 2023-04-21 17:39:18 +0000 | |
| commit | 619734f54eaa8ab12214174b97e3bfca5be9ca1a (patch) | |
| tree | 5e081f59ff6b0ffe9abaa95dd40aea8048e86a4c /sim.cpp | |
| parent | license and bump version (diff) | |
Diffstat (limited to 'sim.cpp')
| -rw-r--r-- | sim.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
@@ -29,14 +29,27 @@ static void run_clock() { main_time++; } -static void run(word i, word j) { +static void run(word i, word j, bool reset_in_middle) { // Processor is twos-compliment mod->a1 = i; mod->a2 = j; mod->arm = 1; - while (!mod->fin) - run_clock(); + if (!reset_in_middle) { + while (!mod->fin) + run_clock(); + } else { + int i = 0; + while (!mod->fin) { + if (i == 10) { + mod->rst_L = 0; + } else if (i == 20) { + mod->rst_L = 1; + } + run_clock(); + i++; + } + } dword expected = (dword) i * (dword) j; if (mod->outn != expected) { @@ -55,16 +68,17 @@ int main(int argc, char **argv) { mod->clk = 0; mod->arm = 0; + mod->rst_L = 1; run_clock(); - run(minint, minint); - run(minint, maxint); - run(maxint, minint); - run(maxint, maxint); + run(minint, minint, false); + run(minint, maxint, false); + run(maxint, minint, false); + run(maxint, maxint, false); - for (word i = -20; i < 20; i++) { - for (word j = - 20; j < 20; j++) { - run(i, j); + for (word i = -40; i < 40; i++) { + for (word j = - 40; j < 40; j++) { + run(i, j, rand() % 1); } } |
