From f7a256bc5bf63a894df402c11751e53785835654 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 21 Oct 2021 13:18:46 +0200 Subject: [PATCH] tools/litex_client: Add --length parameter for MMAP read accesses. --- litex/tools/litex_client.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/litex/tools/litex_client.py b/litex/tools/litex_client.py index de9e54896..3e0a0b5b5 100644 --- a/litex/tools/litex_client.py +++ b/litex/tools/litex_client.py @@ -120,11 +120,12 @@ def dump_registers(port, filter=None): wb.close() -def read_memory(port, addr): +def read_memory(port, addr, length): wb = RemoteClient(port=port) wb.open() - print("0x{:08x}".format(wb.read(addr))) + for offset in range(length//4): + print(f"0x{addr + 4*offset:08x} : 0x{wb.read(addr + 4*offset):08x}") wb.close() @@ -146,6 +147,7 @@ def main(): parser.add_argument("--filter", default=None, help="Registers filter (to be used with --regs).") parser.add_argument("--read", default=None, help="Do a MMAP Read to SoC bus (--read addr)") parser.add_argument("--write", default=None, nargs=2, help="Do a MMAP Write to SoC bus (--write addr data)") + parser.add_argument("--length", default="4", help="MMAP access length") args = parser.parse_args() port = int(args.port, 0) @@ -157,7 +159,7 @@ def main(): dump_registers(port=port, filter=args.filter) if args.read: - read_memory(port=port, addr=int(args.read, 0)) + read_memory(port=port, addr=int(args.read, 0), length=int(args.length, 0)) if args.write: write_memory(port=port, addr=int(args.write[0], 0), data=int(args.write[1], 0))