tools/litex_client/RemoteClient: allow use without local csr.csv file.

In some case, we just want to access MMAP manually without having the csr.csv file:
wb = RemoteClient()
wb.open()
wb.read(0x40000000)
wb.close()
This commit is contained in:
Florent Kermarrec 2020-09-29 13:01:44 +02:00
parent a1c023b900
commit 6d07f01f5b
1 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,7 @@
# Copyright (c) 2016 Tim 'mithro' Ansell <mithro@mithis.com> # Copyright (c) 2016 Tim 'mithro' Ansell <mithro@mithis.com>
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
import os
import socket import socket
from litex.tools.remote.etherbone import EtherbonePacket, EtherboneRecord from litex.tools.remote.etherbone import EtherbonePacket, EtherboneRecord
@ -14,11 +15,16 @@ from litex.tools.remote.csr_builder import CSRBuilder
class RemoteClient(EtherboneIPC, CSRBuilder): class RemoteClient(EtherboneIPC, CSRBuilder):
def __init__(self, host="localhost", port=1234, base_address=0, csr_csv="csr.csv", csr_data_width=None, debug=False): def __init__(self, host="localhost", port=1234, base_address=0, csr_csv=None, csr_data_width=None, debug=False):
# If csr_csv set to None and local csr.csv file exists, use it.
if csr_csv is None and os.path.exists("csr.csv"):
csr_csv = "csr.csv"
# If valid csr_csv file found, build the CSRs.
if csr_csv is not None: if csr_csv is not None:
CSRBuilder.__init__(self, self, csr_csv, csr_data_width) CSRBuilder.__init__(self, self, csr_csv, csr_data_width)
else: # Else if csr_data_width set to None, force to csr_data_width 32-bit.
assert csr_data_width is not None elif csr_data_width is None:
csr_data_width = 32
self.host = host self.host = host
self.port = port self.port = port
self.base_address = base_address self.base_address = base_address