mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
tools/litex_client/read: Handle errors by returning default values.
This commit is contained in:
parent
eec7733008
commit
1225bf4589
@ -83,9 +83,16 @@ class RemoteClient(EtherboneIPC, CSRBuilder):
|
|||||||
self.send_packet(self.socket, packet)
|
self.send_packet(self.socket, packet)
|
||||||
|
|
||||||
# Receive response
|
# 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(
|
packet = EtherbonePacket(
|
||||||
addr_width = self.csr_bus_address_width,
|
addr_width = self.csr_bus_address_width,
|
||||||
init = self.receive_packet(self.socket, addr_size)
|
init = response
|
||||||
)
|
)
|
||||||
packet.decode()
|
packet.decode()
|
||||||
datas = packet.records.pop().writes.get_datas()
|
datas = packet.records.pop().writes.get_datas()
|
||||||
|
Loading…
Reference in New Issue
Block a user