From: Luke Kenneth Casson Leighton Date: Tue, 31 Jul 2018 06:00:21 +0000 (+0100) Subject: specify mux width by argument X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cc3fcc845f9b99589ea0e235ed13726a829a251c;p=pinmux.git specify mux width by argument --- diff --git a/src/spec/base.py b/src/spec/base.py index b41cc37..86ad570 100644 --- a/src/spec/base.py +++ b/src/spec/base.py @@ -7,15 +7,20 @@ from spec.ifaceprint import display_fixed class PinSpec(Pinouts): def __init__(self, pinbanks, fixedpins, function_names, fast=None): self.fastbus = fast or [] - self.pinbanks = pinbanks + self.pinbanks = {} + self.muxwidths = {} + for bank, (sz, muxwidth) in pinbanks.items(): + self.pinbanks[bank] = sz + self.muxwidths[bank] = muxwidth self.fixedpins = fixedpins self.function_names = function_names bankspec = {} self.offs = 0 - pkeys = sorted(pinbanks.keys()) + pkeys = sorted(self.pinbanks.keys()) + print self.pinbanks for kn in pkeys: bankspec[kn] = self.offs - self.offs += pinbanks[kn] + self.offs += self.pinbanks[kn] self.scenarios = [] @@ -41,8 +46,8 @@ auto-generated by [[pinouts.py]] bk = sorted(self.pinbanks.keys()) for bank in bk: of.write( - "\n## Bank %s (%d pins)\n\n" % - (bank, self.pinbanks[bank])) + "\n## Bank %s (%d pins, width %d)\n\n" % + (bank, self.pinbanks[bank], self.muxwidths[bank])) display(of, self, bank) of.write("\n# Pinouts (Fixed function)\n\n") diff --git a/src/spec/minitest.py b/src/spec/minitest.py index ccff41c..a30fa50 100644 --- a/src/spec/minitest.py +++ b/src/spec/minitest.py @@ -8,7 +8,8 @@ from spec.ifaceprint import display_fixed def pinspec(): pinbanks = { - 'A': 28, + 'A': (28, 4), + 'B': (4, 1), } fixedpins = { 'CTRL_SYS': [ @@ -63,7 +64,7 @@ def pinspec(): ps.gpio("", ('A', 0), 0, 0, 28) ps.rgbttl("", ('A', 0), 1, limit=22) ps.mspi("0", ('A', 10), 2) - ps.mquadspi("", ('A', 4), 2) + ps.mquadspi("0", ('A', 4), 2) ps.uart("0", ('A', 16), 2) ps.i2c("1", ('A', 18), 2) ps.pwm("", ('A', 21), 2, 0, 3) @@ -81,6 +82,8 @@ def pinspec(): ps.uart("1", ('A', 2), 2) ps.uart("2", ('A', 14), 2) + ps.mquadspi("1", ('B', 0), 0) + # Scenarios below can be spec'd out as either "find first interface" # by name/number e.g. SPI1, or as "find in bank/mux" which must be # spec'd as "BM:Name" where B is bank (A-F), M is Mux (0-3)