diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-10-25 08:46:56 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-10-25 08:52:29 -0600 |
| commit | 746da8fe47003997ae0b762fe325c7fa8040cafb (patch) | |
| tree | 78f743b46cf02cb303a06540e532ece3d1f868f3 /tb/sim/tarea2.py | |
| parent | 2864ed33089d43a898928095de01eefecaf448e4 (diff) | |
Add sim test: tarea2
Diffstat (limited to 'tb/sim/tarea2.py')
| -rw-r--r-- | tb/sim/tarea2.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tb/sim/tarea2.py b/tb/sim/tarea2.py new file mode 100644 index 0000000..921ea6f --- /dev/null +++ b/tb/sim/tarea2.py @@ -0,0 +1,23 @@ +N = 20 + +mem_dumps = [range(0x100, 0x108), range(0x200, 0x200 + 4 * N)] + +def init(): + init_reg(r0, N) + +def final(): + a, b, s = 1, 1, 0 + mem = [] + + for _ in range(N): + s += a + c = a + b + mem.append(a) + a, b = b, c + + if s > 10000: + break + + assert_reg(r5, 0x104) + assert_mem(0x100, [s, 0xff if s > 10000 else 0xaa]) + assert_mem(0x200, mem) |
