start adding fast/external bus spec
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 25 Jul 2018 04:35:11 +0000 (05:35 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 25 Jul 2018 04:35:11 +0000 (05:35 +0100)
src/bsv/peripheral_gen/base.py
src/bsv/peripheral_gen/jtag.py
src/bsv/peripheral_gen/rgbttl.py
src/bsv/pinmux_generator.py
src/pinmux_generator.py
src/spec/base.py
src/spec/gen.py
src/spec/i_class.py

index a595dbe23306444b58474dcb8386a4713cf9630c..6de39323750f674a4ac3f0c59a8efba2ccac0b17 100644 (file)
@@ -8,9 +8,6 @@ class PBase(object):
     def slowifdeclmux(self, name, count):
         return ''
 
-    def slowifinstance(self, name, count):
-        return ''
-
     def slowimport(self):
         return ''
 
@@ -179,6 +176,13 @@ class PBase(object):
     def mk_ext_ifacedef(self, iname, inum):
         return ''
 
+    def extifinstance(self, name, count):
+        sname = self.peripheral.iname().format(count)
+        pname = self.get_iname(count)
+        template = "        interface {0} = pinmux.peripheral_side.{1};"
+        return template.format(pname, sname)
+
+
 
 mkplic_rule = """\
      rule rl_connect_{0}_to_plic_{2};
@@ -230,7 +234,7 @@ class PeripheralIface(object):
             self.slow = slow(ifacename)
             self.slow.peripheral = self
         for fname in ['slowimport',
-                      'slowifinstance', 'slowifdecl', 'slowifdeclmux',
+                      'extifinstance', 'slowifdecl', 'slowifdeclmux',
                       'mkslow_peripheral', 'mk_plic', 'mk_ext_ifacedef',
                       'mk_connection', 'mk_cellconn', 'mk_pincon']:
             fn = CallFn(self, fname)
@@ -271,11 +275,11 @@ class PeripheralInterfaces(object):
             ret.append(self.data[name].slowimport())
         return '\n'.join(list(filter(None, ret)))
 
-    def slowifinstance(self, *args):
+    def extifinstance(self, *args):
         ret = []
         for (name, count) in self.ifacecount:
             for i in range(count):
-                ret.append(self.data[name].slowifinstance(name, i))
+                ret.append(self.data[name].extifinstance(name, i))
         return '\n'.join(list(filter(None, ret)))
 
     def slowifdeclmux(self, *args):
index e86880d22d43a0f8b21f0b0343eacf91ddb4f53f..589ecf8af6c6d65f44c581aa1264b99cd8594c98 100644 (file)
@@ -14,11 +14,5 @@ class jtag(PBase):
 
     def slowifdeclmux(self, name, count):
         sname = self.get_iname(count)
-        return "        interface PeripheralSideJTAG %s_out;" % sname
-
-    def slowifinstance(self, name, count):
-        sname = self.peripheral.iname().format(count)
-        pname = self.get_iname(count)
-        template = "        interface {0}_out = pinmux.peripheral_side.{1};"
-        return template.format(pname, sname)
+        return "        interface PeripheralSideJTAG %s;" % sname
 
index fa7e49ab7773647dbe10e8c3dd87fe9e196bacd3..3d3f6b536c03cd34fbdfb0e0fdecc6102daa699b 100644 (file)
@@ -36,11 +36,5 @@ class rgbttl(PBase):
 
     def slowifdeclmux(self, name, count):
         sname = self.get_iname(count)
-        return "        interface PeripheralSideLCD %s_out;" % sname
-
-    def slowifinstance(self, name, count):
-        sname = self.peripheral.iname().format(count)
-        pname = self.get_iname(count)
-        template = "        interface {0}_out = pinmux.peripheral_side.{1};"
-        return template.format(pname, sname)
+        return "        interface PeripheralSideLCD %s;" % sname
 
index bf4bfa6576eb539a6037799329542ee7a3e57ead..2abce7c8768fe57766874dff30f8caeb0e65a4a9 100644 (file)
@@ -110,7 +110,7 @@ def write_slow(slow, slowt, p, ifaces, iocells):
     mkcon = ifaces.mk_connection()
     mkcellcon = ifaces.mk_cellconn()
     pincon = ifaces.mk_pincon()
-    inst = ifaces.slowifinstance()
+    inst = ifaces.extifinstance()
     mkplic = ifaces.mk_plic()
     numsloirqs = ifaces.mk_sloirqsdef()
     ifacedef = ifaces.mk_ext_ifacedef()
index b8afe99d69ccff76eb55a4ec58d77ed49233d882..2f04f34b08f638d60aec0b58a8a106a065e57695 100644 (file)
@@ -90,7 +90,8 @@ if __name__ == '__main__':
             if testing:
                 dummytest(ps, output_dir, output_type)
             else:
-                specgen(of, output_dir, pinout, bankspec, pinspec, fixedpins)
+                specgen(of, output_dir, pinout,
+                        bankspec, pinspec, fixedpins, ps.fastbus)
     else:
         if output_type == 'bsv':
             from bsv.pinmux_generator import pinmuxgen as gentypes
index af2d2ab58ae324fb1047d14daed3ba7e617d7e76..b41cc3790ee8a4b53af789e7414b017f5c71a03b 100644 (file)
@@ -5,7 +5,8 @@ from spec.ifaceprint import display_fixed
 
 
 class PinSpec(Pinouts):
-    def __init__(self, pinbanks, fixedpins, function_names):
+    def __init__(self, pinbanks, fixedpins, function_names, fast=None):
+        self.fastbus = fast or []
         self.pinbanks = pinbanks
         self.fixedpins = fixedpins
         self.function_names = function_names
index 2c1335f6d0d89a11504794c774ff1562a5dec55d..1ce10e3cdc473f0f7255aeec86fe40b461dc8d54 100644 (file)
@@ -3,7 +3,7 @@ import os.path
 from spec.interfaces import Pinouts
 
 
-def specgen(of, pth, pinouts, bankspec, pinbanks, fixedpins):
+def specgen(of, pth, pinouts, bankspec, pinbanks, fixedpins, fastbus):
     """ generates a specification of pinouts (tsv files)
         for reading in by pinmux.
 
@@ -31,7 +31,12 @@ def specgen(of, pth, pinouts, bankspec, pinbanks, fixedpins):
     with open(os.path.join(pth, 'interfaces.txt'), 'w') as f:
         for k in pinouts.fnspec.keys():
             s = pinouts.fnspec[k]
-            f.write("%s\t%d\n" % (k.lower(), len(s)))
+            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
             gangedgroup = pinouts.ganged[k]
             with open(os.path.join(pth, '%s.txt' % k.lower()), 'w') as g:
index 8a456117dd2e43b7c558c17bc53ba0a69ab1f2d4..daf064a6b76b321ee189bbdb7abcde36aa3a2176 100644 (file)
@@ -57,7 +57,8 @@ def pinspec():
                       'ULPI2': 'ULPI (USB Low Pin-count) 2',
                       }
 
-    ps = PinSpec(pinbanks, fixedpins, function_names)
+    ps = PinSpec(pinbanks, fixedpins, function_names,
+                 ['lcd0', 'jtag0'])
 
     # Bank A, 0-27
     ps.gpio("", ('A', 0), 0, 0, 28)