give independent names to spblock512w64b8ws
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 19 Apr 2021 17:55:50 +0000 (18:55 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Mon, 19 Apr 2021 17:55:50 +0000 (18:55 +0100)
src/soc/bus/SPBlock512W64B8W.py

index d00aa53267f2fcfaf1153f09e9d870ca646f3129..70ed531b07fadfddf4e866bc0ba0d7903e7dec8b 100644 (file)
@@ -13,6 +13,10 @@ class SPBlock512W64B8W(Elaboratable):
     """
 
     def __init__(self, bus=None, features=None, name=None):
+        if name:
+            self.idx = int(name.split("_")[-1])
+        else:
+            self.idx = 0
         self.enable = Signal(reset=1) # enable signal, defaults to 1
         if features is None:
             features = frozenset()
@@ -44,8 +48,10 @@ class SPBlock512W64B8W(Elaboratable):
 
         # create Chips4Makers 4k SRAM cell here, mark it as "black box"
         # for coriolis2 to pick up
-        sram = Instance("spblock512w64b8w", i_a=a, o_q=q, i_d=d,
-                                            i_we=we, i_clk=ClockSignal())
+        idx = self.idx
+        sram = Instance("spblock512w64b8w_%d" % idx, i_a=a, o_q=q,
+                                                     i_d=d, i_we=we,
+                                                     i_clk=ClockSignal())
         m.submodules.spb = sram
         # has to be added to the actual module rather than the instance
         # sram.attrs['blackbox'] = 1