diff --git a/litex/tools/litex_client.py b/litex/tools/litex_client.py index b27a1b54a..f832f4cc8 100644 --- a/litex/tools/litex_client.py +++ b/litex/tools/litex_client.py @@ -119,13 +119,17 @@ def dump_identifier(host, csr_csv, port): bus.close() -def dump_registers(host, csr_csv, port, filter=None): +def dump_registers(host, csr_csv, port, filter=None, binary=False): bus = RemoteClient(host=host, csr_csv=csr_csv, port=port) bus.open() for name, register in bus.regs.__dict__.items(): if (filter is None) or filter in name: - print("0x{:08x} : 0x{:08x} {}".format(register.addr, register.read(), name)) + register_value = { + True : f"{register.read():032b}", + False : f"{register.read():08x}", + }[binary] + print("0x{:08x} : 0x{} {}".format(register.addr, register_value, name)) bus.close() @@ -360,6 +364,7 @@ def main(): parser.add_argument("--port", default="1234", help="Host bind port.") parser.add_argument("--ident", action="store_true", help="Dump SoC identifier.") parser.add_argument("--regs", action="store_true", help="Dump SoC registers.") + parser.add_argument("--binary", action="store_true", help="Use binary format for displayed values.") 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/reg).") parser.add_argument("--write", default=None, nargs=2, help="Do a MMAP Write to SoC bus (--write addr/reg data).") @@ -384,6 +389,7 @@ def main(): csr_csv = csr_csv, port = port, filter = args.filter, + binary = args.binary, ) if args.read: