tools/litex_client: Add filter parameter to dump_registrers to only dump/display the filtered registers:
ex: litex_cli --regs --filter=pcie_phy will only dump/display pcie_phy registers.
This commit is contained in:
parent
5011b564c3
commit
f014e4cbd2
|
@ -106,7 +106,7 @@ def dump_identifier(port):
|
|||
|
||||
wb.close()
|
||||
|
||||
def dump_registers(port):
|
||||
def dump_registers(port, filter=None):
|
||||
wb = RemoteClient(port=port)
|
||||
wb.open()
|
||||
|
||||
|
@ -115,6 +115,7 @@ def dump_registers(port):
|
|||
wb.base_address = -wb.mems.csr.base
|
||||
|
||||
for name, register in wb.regs.__dict__.items():
|
||||
if (filter is None) or filter in name:
|
||||
print("0x{:08x} : 0x{:08x} {}".format(register.addr, register.read(), name))
|
||||
|
||||
wb.close()
|
||||
|
@ -138,10 +139,11 @@ def write_memory(port, addr, data):
|
|||
# Run ----------------------------------------------------------------------------------------------
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="LiteX Client utility")
|
||||
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 = argparse.ArgumentParser(description="LiteX Client utility.")
|
||||
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("--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)")
|
||||
args = parser.parse_args()
|
||||
|
@ -152,7 +154,7 @@ def main():
|
|||
dump_identifier(port=port)
|
||||
|
||||
if args.regs:
|
||||
dump_registers(port=port)
|
||||
dump_registers(port=port, filter=args.filter)
|
||||
|
||||
if args.read:
|
||||
read_memory(port=port, addr=int(args.read, 0))
|
||||
|
|
Loading…
Reference in New Issue