convert to dictionary spec system
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 2 Aug 2018 06:03:01 +0000 (07:03 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 2 Aug 2018 06:03:01 +0000 (07:03 +0100)
src/spec/gen.py
src/spec/i_class.py

index 81226b305b4595ecc50d2f560f83fae602dbab97..e556ae1523bad7d12ad5c443ee7caaf7d4b68f80 100644 (file)
@@ -4,7 +4,7 @@ from spec.interfaces import Pinouts
 
 
 def specgen(of, pth, pinouts, bankspec, muxwidths, pinbanks, fixedpins,
-            fastbus):
+            configs):
     """ generates a specification of pinouts (tsv files)
         for reading in by pinmux.
 
@@ -29,13 +29,21 @@ def specgen(of, pth, pinouts, bankspec, muxwidths, pinbanks, fixedpins,
     #print pinouts.ganged.items()
     if not os.path.exists(pth):
         os.makedirs(pth)
+    with open(os.path.join(pth, 'configs.txt'), 'w') as f:
+        for (name, d) in configs.items():
+            d = d.items()
+            d.sort()
+            vals = []
+            for (k, v) in d:
+                vals.append("%s=%s" % (k, repr(v)))
+            line = [name.lower(), '\t'.join(vals)]
+            line = '\t'.join(line)
+            f.write("%s\n" % line)
+
     with open(os.path.join(pth, 'interfaces.txt'), 'w') as f:
         for k in pinouts.fnspec.keys():
             s = pinouts.fnspec[k]
             line = [k.lower(), str(len(s))]
-            for b in fastbus:
-                if b.startswith(k.lower()):
-                    line.append(b)
             line = '\t'.join(line)
             f.write("%s\n" % line)
             s0 = s[list(s.keys())[0]]  # hack, take first
index 780decd39376b8318ecb808f4e6efe37644c7448..37ad622f6966c1d9d780563abe3c3083012770b2 100644 (file)
@@ -61,7 +61,11 @@ def pinspec():
                       }
 
     ps = PinSpec(pinbanks, fixedpins, function_names,
-                 ['lcd', 'jtag', 'fb', 'sdr'])
+                 {'lcd': {'bus': 'fastbus'},
+                  'jtag': {'bus': 'fastbus'},
+                  'fb': {'bus': 'fastbus'},
+                  'sdr': {'bus': 'fastbus'}
+                 })
 
     # Bank A, 0-27
     ps.gpio("", ('A', 0), 0, 0, 28)