bus/dfi: filter signals by direction
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Wed, 15 Feb 2012 20:48:05 +0000 (21:48 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Wed, 15 Feb 2012 20:48:05 +0000 (21:48 +0100)
migen/bus/dfi.py

index 3364f12f1fb21137fb90b0877a13109b168a6310..5fb2a044e1181bf703456416da7e35b5617a0e93 100644 (file)
@@ -26,19 +26,20 @@ class Interface:
                self.phases = [SimpleInterface(self.pdesc) for i in range(nphases)]
        
        # Returns pairs (DFI-mandated signal name, Migen signal object)
-       def get_standard_names(self):
+       def get_standard_names(self, m2s=True, s2m=True):
                r = []
                add_suffix = len(self.phases) > 1
                for n, phase in enumerate(self.phases):
                        for signal in self.pdesc.desc:
-                               if add_suffix:
-                                       if signal[0] == M_TO_S:
-                                               suffix = "_p" + int(n)
+                               if (m2s and signal[0] == M_TO_S) or (s2m and signal[0] == S_TO_M):
+                                       if add_suffix:
+                                               if signal[0] == M_TO_S:
+                                                       suffix = "_p" + int(n)
+                                               else:
+                                                       suffix = "_w" + int(n)
                                        else:
-                                               suffix = "_w" + int(n)
-                               else:
-                                       suffix = ""
-                       r.append(("dfi_" + signal[1] + suffix, getattr(self, signal[1])))
+                                               suffix = ""
+                                       r.append(("dfi_" + signal[1] + suffix, getattr(phase, signal[1])))
                return r
 
 class Interconnect: