interconnect: Add name parameter to Wishbone/AXI SRAMs nad use it in add_ram to improve generated memory names.

This commit is contained in:
Florent Kermarrec 2022-05-09 10:29:15 +02:00
parent 7370a9fe6f
commit 2db57d4be3
3 changed files with 5 additions and 5 deletions

View File

@ -851,7 +851,7 @@ class SoC(Module):
"axi-lite": axi.AXILiteInterface, "axi-lite": axi.AXILiteInterface,
}[self.bus.standard] }[self.bus.standard]
ram_bus = interface_cls(data_width=self.bus.data_width, bursting=self.bus.bursting) ram_bus = interface_cls(data_width=self.bus.data_width, bursting=self.bus.bursting)
ram = ram_cls(size, bus=ram_bus, init=contents, read_only=(mode == "r")) ram = ram_cls(size, bus=ram_bus, init=contents, read_only=(mode == "r"), name=name)
self.bus.add_slave(name, ram.bus, SoCRegion(origin=origin, size=size, mode=mode)) self.bus.add_slave(name, ram.bus, SoCRegion(origin=origin, size=size, mode=mode))
self.check_if_exists(name) self.check_if_exists(name)
self.logger.info("RAM {} {} {}.".format( self.logger.info("RAM {} {} {}.".format(

View File

@ -795,7 +795,7 @@ class AXILite2CSR(Module):
# AXILite SRAM ------------------------------------------------------------------------------------- # AXILite SRAM -------------------------------------------------------------------------------------
class AXILiteSRAM(Module): class AXILiteSRAM(Module):
def __init__(self, mem_or_size, read_only=None, init=None, bus=None): def __init__(self, mem_or_size, read_only=None, init=None, bus=None, name=None):
if bus is None: if bus is None:
bus = AXILiteInterface() bus = AXILiteInterface()
self.bus = bus self.bus = bus
@ -805,7 +805,7 @@ class AXILiteSRAM(Module):
assert(mem_or_size.width <= bus_data_width) assert(mem_or_size.width <= bus_data_width)
self.mem = mem_or_size self.mem = mem_or_size
else: else:
self.mem = Memory(bus_data_width, mem_or_size//(bus_data_width//8), init=init) self.mem = Memory(bus_data_width, mem_or_size//(bus_data_width//8), init=init, name=name)
if read_only is None: if read_only is None:
if hasattr(self.mem, "bus_read_only"): if hasattr(self.mem, "bus_read_only"):

View File

@ -344,7 +344,7 @@ class Converter(Module):
# Wishbone SRAM ------------------------------------------------------------------------------------ # Wishbone SRAM ------------------------------------------------------------------------------------
class SRAM(Module): class SRAM(Module):
def __init__(self, mem_or_size, read_only=None, init=None, bus=None): def __init__(self, mem_or_size, read_only=None, init=None, bus=None, name=None):
if bus is None: if bus is None:
bus = Interface() bus = Interface()
self.bus = bus self.bus = bus
@ -353,7 +353,7 @@ class SRAM(Module):
assert(mem_or_size.width <= bus_data_width) assert(mem_or_size.width <= bus_data_width)
self.mem = mem_or_size self.mem = mem_or_size
else: else:
self.mem = Memory(bus_data_width, mem_or_size//(bus_data_width//8), init=init) self.mem = Memory(bus_data_width, mem_or_size//(bus_data_width//8), init=init, name=name)
if read_only is None: if read_only is None:
if hasattr(self.mem, "bus_read_only"): if hasattr(self.mem, "bus_read_only"):