From: Luke Kenneth Casson Leighton Date: Thu, 2 Aug 2018 06:03:01 +0000 (+0100) Subject: convert to dictionary spec system X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=343e005826e676bb85c33bb24c9c8adbf1b5af57;p=pinmux.git convert to dictionary spec system --- diff --git a/src/spec/gen.py b/src/spec/gen.py index 81226b3..e556ae1 100644 --- a/src/spec/gen.py +++ b/src/spec/gen.py @@ -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 diff --git a/src/spec/i_class.py b/src/spec/i_class.py index 780decd..37ad622 100644 --- a/src/spec/i_class.py +++ b/src/spec/i_class.py @@ -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)