From 1225bf458934d5be91880ed7943975e98bc2ad18 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 3 Jan 2025 15:44:14 +0100 Subject: [PATCH] tools/litex_client/read: Handle errors by returning default values. --- litex/tools/litex_client.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litex/tools/litex_client.py b/litex/tools/litex_client.py index ad30d687b..fb3daaba0 100644 --- a/litex/tools/litex_client.py +++ b/litex/tools/litex_client.py @@ -83,9 +83,16 @@ class RemoteClient(EtherboneIPC, CSRBuilder): 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()