diff options
| author | Alejandro Soto <alejandro@34project.org> | 2024-02-13 12:16:46 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2024-02-20 11:12:23 -0600 |
| commit | f31e32fbb1f6b010057ccbca26edd0be8f6bd60c (patch) | |
| tree | 8150a09f69744fc337e6a625a42f204696e5cbfd /sim | |
| parent | 2c8c4d13a3d679646c2162b168e19103b42fb6ae (diff) | |
sim: implement non-virtual memory dumps
Diffstat (limited to 'sim')
| -rwxr-xr-x | sim/sim.py | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -152,10 +152,23 @@ def recv_mem_dump(): while_running() out(f'{COLOR_BLUE}{line}{COLOR_RESET}') -def read_mem(base, length, *, may_fail=False, phys=False): +mem_virtual = True + +def set_mem_phys(): + global mem_virtual + mem_virtual = False + +def set_mem_virt(): + global mem_virtual + mem_virtual = True + +def read_mem(base, length, *, may_fail=False, phys=None): fragments = [] i = 0 + if phys is None: + phys = not mem_virtual + if halted and length > 0: print('dump-phys' if phys else 'dump-mem', base >> 2, (length + base - (base & ~0b11) + 0b11) >> 2, file=sim_end, flush=True) recv_mem_dump() @@ -357,6 +370,8 @@ prelude = { 'init_reg': init_reg, 'dump_regs': dump_regs, 'split_dword': split_dword, + 'set_mem_phys': set_mem_phys, + 'set_mem_virt': set_mem_virt, 'register_interrupt': register_interrupt, } |
