separate pin banks by name
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 20 Jun 2018 09:06:33 +0000 (10:06 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 20 Jun 2018 09:06:33 +0000 (10:06 +0100)
src/spec/base.py
src/spec/ifaceprint.py

index ba0ce10311d8995026efc9e21bd8d327e72a7d70..bf202c1591bc9ff853693d90521952fbf30be541 100644 (file)
@@ -37,7 +37,11 @@ auto-generated by [[pinouts.py]]
 [[!toc  ]]
 
 """)
-        display(of, self)
+        bk = self.pinbanks.keys()
+        bk.sort()
+        for bank in bk:
+            of.write("\n## Bank %s (%d pins)\n\n" % (bank, self.pinbanks[bank]))
+            display(of, self, bank)
 
         of.write("\n# Pinouts (Fixed function)\n\n")
         fixedpins = display_fixed(of, self.fixedpins, len(self))
index 4af0e59d6b1bcd2d3355e36f4e493a05c04eeac3..3dc60f7bb9163813d2337ac2311feb3587d42559 100644 (file)
@@ -3,7 +3,7 @@
 from copy import deepcopy
 
 
-def display(of, pins):
+def display(of, pins, banksel=None):
     of.write("""\
 | Pin | Mux0        | Mux1        | Mux2        | Mux3        |
 | --- | ----------- | ----------- | ----------- | ----------- |
@@ -11,6 +11,16 @@ def display(of, pins):
     pinidx = sorted(pins.keys())
     for pin in pinidx:
         pdata = pins.get(pin)
+        if banksel:
+            skip = False
+            for mux in range(4):
+                if mux not in pdata:
+                    continue
+                name, bank = pdata[mux]
+                if banksel != bank:
+                    skip = True
+            if skip:
+                continue
         res = '| %3d |' % pin
         for mux in range(4):
             if mux not in pdata: