tools/litex_client: Add --binary argument to display values in binary.
Useful in some case to avoid decoding hexa manually.
This commit is contained in:
parent
5df1dacd18
commit
ed48fb4d5d
|
@ -119,13 +119,17 @@ def dump_identifier(host, csr_csv, port):
|
||||||
|
|
||||||
bus.close()
|
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 = RemoteClient(host=host, csr_csv=csr_csv, port=port)
|
||||||
bus.open()
|
bus.open()
|
||||||
|
|
||||||
for name, register in bus.regs.__dict__.items():
|
for name, register in bus.regs.__dict__.items():
|
||||||
if (filter is None) or filter in name:
|
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()
|
bus.close()
|
||||||
|
|
||||||
|
@ -360,6 +364,7 @@ def main():
|
||||||
parser.add_argument("--port", default="1234", help="Host bind port.")
|
parser.add_argument("--port", default="1234", help="Host bind port.")
|
||||||
parser.add_argument("--ident", action="store_true", help="Dump SoC identifier.")
|
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("--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("--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("--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).")
|
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,
|
csr_csv = csr_csv,
|
||||||
port = port,
|
port = port,
|
||||||
filter = args.filter,
|
filter = args.filter,
|
||||||
|
binary = args.binary,
|
||||||
)
|
)
|
||||||
|
|
||||||
if args.read:
|
if args.read:
|
||||||
|
|
Loading…
Reference in New Issue