add name to HyperRAM module so as to be able to pass name
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 Apr 2022 11:56:10 +0000 (12:56 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 22 Apr 2022 11:56:10 +0000 (12:56 +0100)
to resource bus.  this allows multiple HyperRAM modules to be added

lambdasoc/periph/hyperram.py

index ef7a8112c0a85ad2796c5217cfae4a74ee627e6e..da4e83e4b61f66b2ec9eca1fd5edf883bcc7f8b0 100644 (file)
@@ -158,10 +158,11 @@ class HyperRAM(Peripheral, Elaboratable):
     Cypress S27KL0641DABHI020 requires latency=6
     """
     def __init__(self, *, io, phy_kls,
+                          name=None,
                           latency=6,
                           addr_width=23, # 8 GBytes, per IC
                           bus=None, features=frozenset()):
-        super().__init__()
+        super().__init__(name=name)
         self.n_cs = n_cs = len(io.cs_n)
         self.cs_bits = cs_bits = n_cs.bit_length()-1
         self.io = io
@@ -174,7 +175,9 @@ class HyperRAM(Peripheral, Elaboratable):
                                       features=features)
         self.size = 2**addr_width
         mmap = MemoryMap(addr_width=addr_width, data_width=8)
-        mmap.add_resource(object(), name="hyperram", size=self.size)
+        if name is None:
+            name = "hyperram"
+        mmap.add_resource(object(), name=name, size=self.size)
         self.bus.memory_map = mmap
         # # #