create flexbus interface
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 26 Jul 2018 08:33:37 +0000 (09:33 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 26 Jul 2018 08:33:37 +0000 (09:33 +0100)
src/bsv/interface_decl.py

index 1efeac1d6519079abe24141709b5b13b1f780cc1..ad1413996d840d52167bd93bbb5e5c528c9527cf 100644 (file)
@@ -488,6 +488,17 @@ class InterfaceLCD(InterfaceBus, Interface):
         return len(pins)
 
 
+class InterfaceFlexBus(InterfaceBus, Interface):
+
+    def __init__(self, *args):
+        InterfaceBus.__init__(self, ['ad_out', 'ad_out_en', 'ad_in'],
+                              "Bit#({0})", "ad")
+        Interface.__init__(self, *args)
+
+    def get_n_iopins(self, pins):  # HACK! assume in/out/outen so div by 3
+        return len(pins) / 3
+
+
 class InterfaceSD(InterfaceBus, Interface):
 
     def __init__(self, *args):
@@ -547,6 +558,7 @@ class Interfaces(InterfacesBase, PeripheralInterfaces):
                                  'mspi': InterfaceNSPI,
                                  'lcd': InterfaceLCD,
                                  'sd': InterfaceSD,
+                                 'fb': InterfaceFlexBus,
                                  'qspi': InterfaceNSPI,
                                  'mqspi': InterfaceNSPI,
                                  'eint': InterfaceEINT})