move slowifdeclmux to class
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 5 Aug 2018 19:23:44 +0000 (20:23 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 5 Aug 2018 19:23:44 +0000 (20:23 +0100)
src/bsv/peripheral_gen/base.py

index 53b5360b4de126901432f7683add55037ffe7c1b..6a22061cb8a14aad4f174619ecf63b6c29b6b1aa 100644 (file)
@@ -676,6 +676,7 @@ class PeripheralInterfaces(object):
             ('mk_ext_ifacedef', MkExtIface, 8),
             ('axi_addr_map', MkAxiAddrMap, 8),
             ('axi_fastaddr_map', MkAxiFastAddrMap, 8),
+            ('slowifdeclmux', MkSlowIfDeclMux, 8),
         ):
             fn = CallIfaceFn(self, kls, indent)
             setattr(self, fname, types.MethodType(fn, self))
@@ -721,13 +722,6 @@ class PeripheralInterfaces(object):
                 ret.append(self.data[name].extifdecl(name, i))
         return '\n'.join(li(list(filter(None, ret)), 8))
 
-    def slowifdeclmux(self, *args):
-        ret = []
-        for (name, count) in self.ifacecount:
-            for i in range(count):
-                ret.append(self.data[name].slowifdeclmux(name, i))
-        return '\n'.join(li(list(filter(None, ret)), 8))
-
     def fastifdecl(self, *args):
         ret = []
         for (name, count) in self.ifacecount:
@@ -963,6 +957,14 @@ class IfaceIter(object):
     def next(self):
         return self.__next__()
 
+class MkSlowIfDeclMux(IfaceIter):
+
+    def check(self, name, i):
+        return True
+
+    def item(self, name, i):
+        return self.ifaces.data[name].slowifdeclmux(name, i)
+
 
 class MkAxiFastAddrMap(IfaceIter):