Skip to content

Commit

Permalink
tools/litex_client/read: Handle errors by returning default values.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Jan 3, 2025
1 parent eec7733 commit 1225bf4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion litex/tools/litex_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,16 @@ def read(self, addr, length=None, burst="incr"):
self.send_packet(self.socket, packet)

# Receive response
response = self.receive_packet(self.socket, addr_size)
if response == 0:
# Handle error by returning default values
if self.debug:
print("Timeout occurred during read. Returning default values.")
return 0 if length is None else [0] * length_int

packet = EtherbonePacket(
addr_width = self.csr_bus_address_width,
init = self.receive_packet(self.socket, addr_size)
init = response
)
packet.decode()
datas = packet.records.pop().writes.get_datas()
Expand Down

0 comments on commit 1225bf4

Please sign in to comment.